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

[WIP] Add control options to override and/or validate index file #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rPraml
Copy link
Contributor

@rPraml rPraml commented Nov 22, 2023

Hello Rob, we would like to have some options to override how and if the idx file is used.

We have two use cases:

  1. We want to ensure, that the checksums in the idx file will match to the checksum of the local script. (As far as I see the checksums in the existing index file of your test will not match to the checksum of the SQL files.

As far as I understand the code, the checksum is never calculated or verified at run time. (This means, I can edit SQL files without getting problems, or when merging two branches)

So the setForceLocalCheck = true option in the build pipeline, will ensure, that the checksum in idx file will match to the content

  1. We have migration unit tests, where we check if existing data will be properly migrated.

Imagine, you have a migration in 1.1 where you want to convert everything in a table to uppercase, So we have in /src/main the standard migrations:

  • 1.0__initial.sql (e.g. create table foo(varchar(32) name))
  • 1.1__make_all_uppercase.sql (e.g. update foo set name = ucase(name))

When we verify the migrations in some unit tests, we run them on an empty database. To get data in the DB, we "insert" some scripts in /src/test

  • 1.0.99__insert_test_data.sql (e.g. insert into foo values ('Roland'))

Prior #91 - ebean migration discovered all migrations in the classpath and has executed

  • /src/main/resources/migration/1.0__initial.sql
  • /src/test/resources/migration/1.0.99__insert_test_data.sql
  • /src/main/resources/migration/1.1__make_all_uppercase.sql

A java assert can then check, if everything is properly migrated.

(Note: The conversion to uppercase was just an example. In real life, we have much more complex migrations.)

This PR would help us to cover both use cases (while use case 2 is more important than 1)

@rPraml rPraml changed the title Add control options to override and/or validate index file [WIP] Add control options to override and/or validate index file Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant