Skip to content

Add a strict option to ensure migration step content was not changed #1138

@Shinigami92

Description

@Shinigami92

Description

Add a strict option to ensure that the produced SQL content of a migration step was not changed along the migration history, so neither project contributors or node-pg-migrate itself does not produce suddenly conflicting intermediate migration steps.

e.g. when there is a major node-pg-migrate update, it could happen that produced SQL changed.
Maybe it is just a renaming of a default type like decimal <-> numeric or a project contributor accidentally touched a migration file that was already rolled out to a prod DB.

Suggested solution

The strict option adds the normalized SQL content of a migration step as e.g. md5 hash into the migration table in a new column.
If the strict mode is enabled, the content is always checked before running new migrations to ensure that the content did not changed.

Additionally there should be a regenerate hash functionality so it is possible to force-override wanted changes.

Alternative

The strict naming is still up for rename.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions