Coder Social home page Coder Social logo

ryanmitchell / eloquent-driver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from statamic/eloquent-driver

1.0 3.0 2.0 368 KB

A package that allows you to store Statamic entries in a database.

Home Page: https://statamic.dev/knowledge-base/storing-entries-in-a-database

License: MIT License

PHP 100.00%

eloquent-driver's Introduction

Statamic Eloquent Driver

Provides support for storing your Statamic data in a database, rather than flat files.

Installation & Usage

You can install and configure the Eloquent Driver using a single command:

php please install:eloquent-driver

The command will install the statamic/eloquent-driver package, publish the config file, then prompt you to select which repositories you wish to move to the database. The command will then publish the relevant migrations and run php artisan migrate behind the scenes.

The command will also give you the opportunity to indicate whether you'd like existing data to be imported.

Importing flat-file content

If you originally opt-out of importing existing content, then later change your mind, you can import existing content by running the relevant commands:

  • Assets: php please eloquent:import-assets
  • Blueprints and Fieldsets: php please eloquent:import-blueprints
  • Collections: php please eloquent:import-collections
  • Entries: php please eloquent:import-entries
  • Forms: php please eloquent:import-forms
  • Globals: php please eloquent:import-globals
  • Navs: php please eloquent:import-navs
  • Revisions: php please eloquent:import-revisions
  • Taxonomies: php please eloquent:import-taxonomies

Syncing Assets

If your assets are being driven by the Eloquent Driver and you're managing your assets outside of Statamic (eg. directly in the filesystem), you should run the php please eloquent:sync-assets command to add any missing files to the database, and remove files that no longer exist on the filesystem.

Exporting to flat files

If you wish to move back to flat-files, you may use the following commands to export your content out of the database:

  • Assets: php please eloquent:export-assets
  • Blueprints and Fieldsets: php please eloquent:export-blueprints
  • Collections: php please eloquent:export-collections
  • Entries: php please eloquent:export-entries
  • Forms: php please eloquent:export-forms
  • Globals: php please eloquent:export-globals
  • Navs: php please eloquent:export-navs
  • Revisions: php please eloquent:export-revisions
  • Taxonomies: php please eloquent:export-taxonomies

Configuration

The configuration file, found in config/statamic/eloquent-driver.php is automatically published when you install the Eloquent Driver.

For each of the repositories, it allows you to determine if they should be driven by flat-files (file) or Eloquent (eloquent). Some repositories also have additional options, like the ability to override the model used.

Upgrading

After updating to a new version of the Eloquent Driver, please ensure you run php artisan migrate to update your database to the latest schema.

Questions

Can I store users in the database too?

By default, Statamic users live in the users directory of your project. If you wish to move them to the database, please follow this guide.

Can I store some collections in the database, while keeping others in flat-files?

This driver does not make it possible to have some collections flat-file driven and others Eloquent driven. If you're looking for that, you may want to checkout the Runway addon, which is part of The Rad Pack.

eloquent-driver's People

Contributors

ajcsilva avatar alt-ben avatar andreasbohman avatar clementmas avatar dejury avatar dimitri-koenig avatar dnwjn avatar duncanmcclean avatar edalzell avatar enespolat24 avatar frittenkeez avatar helloiamlukas avatar indykoning avatar jackmcdade avatar jasonvarga avatar jesseleite avatar jonassiewertsen avatar ken-vde avatar modrictin avatar nckrtl avatar petemolinero avatar phpsa avatar piljac1 avatar robdekort avatar ryanmitchell avatar stylecibot avatar sylvesterdamgaard avatar vintagesucks avatar wonderne avatar yaser2490 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

mkael1 adaptdk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.