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

Why do I need to set .sendFullScript explicitly in code migrations? #406

Open
bowbahdoe opened this issue Oct 29, 2024 · 5 comments
Open

Comments

@bowbahdoe
Copy link

https://caveman.mccue.dev/tutorial/clojure/27_run_tests_against_your_database

I think I might be missing something, because I'm unclear why FileMigrationProvider wouldn't get sendFullScript from the loaded in properties file?

@harawata
Copy link
Member

Hello @bowbahdoe ,

You mean FileMigrationLoader ?
MigrationLoader does not read the content of properties files in which environment-dependent options for command line interface are stored.

I guess you are using the runtime migration.
In that case, passing a DatabaseOperationOption instance is the right way to specify the option.

@bowbahdoe
Copy link
Author

So what is the properties passed to FileMigrationLoader for?

Is there a more straightforward way to just "do whatever migrate up would do"

@harawata
Copy link
Member

So what is the properties passed to FileMigrationLoader for?

properties is used for variable substitution when reading the migration scripts (e.g. ${changelog}).
https://mybatis.org/migrations/runtime-migration.html#migrationloader

Is there a more straightforward way to just "do whatever migrate up would do"

Like, executing the command?
https://www.baeldung.com/run-shell-command-in-java

@bowbahdoe
Copy link
Author

well, yes but I want to be able to "just execute the command" but override the connection stuff with a DataSource object. I know I can make a .properties file, but the DB is made in tests so can reasonably vary on what port its exposed on, password, etc between runs. I could deal with that by writing out a temporary .properties file but thats even more jank.

@harawata
Copy link
Member

With CLI, you can override the settings by setting environment variables.
To override the url, for example, set the new URL to MIGRATIONS_URL.

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

No branches or pull requests

2 participants