Skip to content

[cli] new feature: 'migrate info': warn about changed-after-installed migrations #870

@salewski

Description

@salewski
 $ sqlx --version  sqlx-cli 0.2.0  $ git rev-parse --short=12 HEAD  7f1bff406d94

Related to:

Related tangentially to:


It would be useful to have sqlx migrate info warn the user about migrations whose file checksum no longer matches the value recorded in the db, similar to how sqlx database setup does.

For example, if I:

  1. sqlx database setup
  2. change the migration file
  3. sqlx database setup

Upon the second setup invocation an error is emitted:

 error: migration 20201202222356 was previously applied but has been modified

That's quite nice.

From the perspective of treating the sqlx migrate info command as the thing to use to answer the question, "Where does the database stand with respect to the available migrations?", it would be nice if it were able to provide similar information. Currently it shows that the migration was successfully installed at some point in the past, but does not give any indication that the migration script has been modified:

 $ sqlx migrate info  20201202222356/installed name-of-migration

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easycliConcerns `sqlx-cli`enhancementNew feature or requestmigrationsProposals or bugs involving migrations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions