Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File checksum validation doesn't happen #5

Open
abhi2495 opened this issue Jul 19, 2020 · 2 comments
Open

File checksum validation doesn't happen #5

abhi2495 opened this issue Jul 19, 2020 · 2 comments
Projects
Milestone

Comments

@abhi2495
Copy link

abhi2495 commented Jul 19, 2020

If any changes are made to an already migrated sql script file and run again, there are no logs ( neither error / nor any info) for this.
Seems like the library has the following logic : For a file named like V1__xxxxxx.sql , during migration, it parses the version , which is 1 here and checks in migrations table whether the record with id=1 is present. If it's there, it does nothing, else executes the script.

Thus even if we rename the file after __ (double underscore) keeping the version same, or change it's content, it simply ignores.

This behaviour is quite different from Flyway where checksum computation happens for every script.

Another probable missing feature:

For a multi-tenant microservice, if we choose schema-per-tenant approach (i.e same database server, different schemas for different tenants), then using this library how are we supposed to run migration scripts (creating the tables etc ) for every schema during application startup ? If I am not wrong, the ConnectionFactory requires mentioning schema.

@nkonev
Copy link
Owner

nkonev commented Jul 21, 2020

Seems like the library has the following logic : For a file named like V1__xxxxxx.sql , during migration, it parses the version , which is 1 here and checks in migrations table whether the record with id=1 is present. If it's there, it does nothing, else executes the script.

Thus even if we rename the file after __ (double underscore) keeping the version same, or change it's content, it simply ignores.

yes.

I think actually there are two issues:

  1. calculate and validate checksums in order to prevent modifying already applied migrations
  2. support schemas

  1. looks complex to implement. I know Liquibase and Flyway have this, but is it common practice - to occasionally change already applied migrations ? I believe that the code review prevents this. In addition, in case when we have applied migrations V1 and V3, Liquibase allows to insert V2 between them. Anyway, PRs are welcome.
  2. to solve this - I think to make migrator's schema and table names configurable.

@nkonev
Copy link
Owner

nkonev commented Jul 24, 2020

  1. has been done in 1.3.0

@nkonev nkonev added this to the V2.x milestone Dec 14, 2021
@nkonev nkonev added this to In progress in V2.x Dec 14, 2021
@nkonev nkonev moved this from In progress to TODO in V2.x Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
V2.x
TODO
Development

No branches or pull requests

2 participants