Skip to content

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

Merged
vmihailenco merged 4 commits into
masterfrom
fix/automigrator-create-migrations
Nov 21, 2024
Merged

🐛 AutoMigrator: Do not create migrations if nothing to migrate#1063
vmihailenco merged 4 commits into
masterfrom
fix/automigrator-create-migrations

Conversation

@bevzzz

@bevzzz bevzzz commented Nov 19, 2024

Copy link
Copy Markdown
Collaborator

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
@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