Skip to content

migrate version fails on empty database #160

Closed
@Anonymous-Coward

Description

@Anonymous-Coward

Steps to reproduce:

  • create an empty migrations directory
  • develop some migrations on a local database
  • create/configure a second environment, targeting another database, which is empty
  • run migrate version for the second environment, using a valid migration version

Expected results:

  • the second database gets updated to the specified version, even if it is not the last

Actual results:

  • the migrations execution fails with an error message stating that the changelog table is missing

Background: in continuous integration setups, you don't always want to migrate to the latest version. The migrations in the source code repository may be well ahead of what needs to be deployed into a test environment, therefore you only update the database for that test environment to the database version corresponding to the app version that gets deployed there. That test environment may get reset to the initial state upon each deployment.

Workaround that works: first run migrate up, and only then run migrate version . But that's not nice or convenient, especially when having a lot of migrations between head and what needs to be deployed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions