TypeORM migration generation
The typeorm-migration
tool is used to generate, apply and revert database migrations. It follows the conventions below.
- The migrations are generated in the
db/migrations
folder. - The database connection is inferred from the
DB_XXX
environment variables. - All entities should be exported from
lib/model
commonjs module, i.e. the entity classes must be compiled from TypeScript.
Here are some useful commands:
npx squid-typeorm-migration apply # apply pending migrations
npx squid-typeorm-migration generate # generate the migration for the schema defined in schema.graphql
rm -r db/migrations # clean the db/migrations folder