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

🐛 AutoMigrator: Do not create migrations if nothing to migrate #1063

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Nov 19, 2024

While working on #1062 I noticed that AutoMigrator would create migration files and DB entries even when models haven't been updated and there isn't anything to migrate. This PR addresses this issue.

It also mistakenly puts non-transactional migrations in .tx.sql files and vice versa because of a wrong value being passed to createSQLMigrations.

Finally, BunModelInspector should drop surrounding '' from string literals in bun:"default:'John Doe'" to make the value comparable to the value retrieved from the database, i.e. a Go-string "John Doe".

- Check correct file prefixes for generated SQL files
- Test the 'nothing to migrate' case
- Make sure string literal in default-tag is comparable to the value stored in the database
@bevzzz bevzzz requested a review from vmihailenco November 19, 2024 22:06
@vmihailenco vmihailenco merged commit cb319f8 into master Nov 21, 2024
3 checks passed
@vmihailenco vmihailenco deleted the fix/automigrator-create-migrations branch November 21, 2024 13:49
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.

2 participants