-
Notifications
You must be signed in to change notification settings - Fork 39
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
Grate internal scripts fail when using CreateDatabase scripts #512
Comments
Aha! Good catch! I thought I had tests covering this, but apparently not (strange...). I'll try to write some, and fix the issue. |
* Make sure the replacement tokens are reset when running the internal migrations
I think PR #514 should solve this, do you agree? I make sure to set the _tokens to null whenever I clone the DbMigrator |
…ts (#514) * Make sure the replacement tokens are reset when running the internal migrations
@erikbra This fixes the issue I'm having. Thanks a lot! |
Lovely, @JaDuyve! It is included in release 1.7.2. Thanks for a detailed bug report and solid analysis 😄 |
Describe the bug
The grate internal structure scripts fail when using CreateDatabase scripts. From what I can see, it's caused because the DbMigrator instance is reused from the CreateDatabase scripts. This instance already has the private instance of
_tokens
initialized. Because it's already initialized, the custom UserTokens for the grate internal scripts will not be added to_tokens
causing TokenReplacer not replacing all supposed tokens and intern, the script will fail.These tokens aren't taken into account.
grate/src/grate.core/Migration/GrateMigrator.cs
Lines 576 to 587 in a5d3212
Because
_tokens
is already initialized.grate/src/grate.core/Migration/DbMigrator.cs
Lines 249 to 254 in a5d3212
I think this is issue will occur when anything has run before grate structure.
Could the solution be to create for the grate internal scripts a new instance of GrateMigrator?
To Reproduce
Run grate for new database with CreateDatabase scripts.
Expected behavior
Grate internal structure scripts run without errors.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: