Skip to content

[$40] "npm run init-db" should init already done migrations #147

Closed
@maxceem

Description

@maxceem

When we run the TaaS API locally we are running "npm run init-db" to create the DB schema.
The created DB schema already includes all the changes we've done using migrations scripts inside the migrations folder.
But if we run npm run migrate we would get an error, because it would try to apply all the migrations again.
This is bad because we might need to test migrations locally if we are working on some DB updates.

To fix this, when we run "npm run init-db" we have to make sure, that the migrations which are already applied to the current DB schema would not be re-applied again.

To do so I think the best way is:

  • when run "npm run init-db" we have to add all the filenames in migration folder to the SequalizeMeta table:
    image
  • make sure that table is also created
  • if a table exists, data should be cleared here and re-populated based on the file list in the migrations directory

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions