Skip to content

Latest commit

 

History

History
37 lines (21 loc) · 1.06 KB

Seeds-Migrations.md

File metadata and controls

37 lines (21 loc) · 1.06 KB

Home | Emulators | Seeds & Migrations | Deployment | Test Runners | Known Issues

Seeds

A seed adds user data to the database.

// TODO: Fix up our current seeds

Migrations

A migration is a script that either:

  • setups up new structure required for new functionality
  • transforms existing data (e.g. restructuring) to accomodate new functionality

Creating migrations

Migrations are stored in admin/migrations:

  • must start with a 3 digit number (E.g. 001-your-migration.ts)
  • contain an up method that performs the transformation on a Firestore instance
  1. Make a copy of _000-template.ts and rename it with the next available consecutive number.

  2. Write your database changes in a batched write or transaction inside the up method (example in the template).

Running migrations

Runs all unperformed migrations

- from admin -

yarn migrate

To see what migrations have been run, inspect configuration/migrations in Firestore.