Seeds

Seed data is used to populate the database with initial data that is essential for the application to function. It is stored in the data/seeds directory and belongs in version control.

Syntax

$ vela seeds <action>

The action can be one of the following:

  • load - Load seeds into the database
  • save - Save the current data as seeds
  • clear - Clear seeded records

Seeds vs fixtures

Seeds are real data the application needs — plans, categories, roles, an initial admin. They ship with the project and are loaded on deploy. Fixtures are throwaway mock data for development and tests, and are loaded after seeds so they can reference seed records.

On deploy

vela deploy loads the seed files into the target’s database once the release is live, on every deploy. Loading only adds the records that are missing, matched by id: a record that is already there is left as it is, so a change made in the admin panel survives later deploys, and editing a seed file does not change a record that was already loaded. To load seeds into a deployed copy between deploys, run vela seeds load -t <target>.

In tests

vela test:server loads seeds into its throwaway database before every run, so tests start from the same data the app ships with.