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

dialect/sql/schema: init db version before executing diff #2440

Merged
merged 1 commit into from Apr 6, 2022

Conversation

CharlesGe129
Copy link
Contributor

What's the problem: Under versioned migration on MySQL 8.0, unique string field would be generated as type varchar(191) instead of varchar(255). This is because in generating migration files by NamedDiff(), sqlDialect's init() method is not called.

Further concern: For init() function, MySQL and Postgres's implementation checks the database version which is what I want. But SQLite's implementation checks the foreign_keys support. So I think there might be a better may to check the database version before doing Diff().

What's the problem: Under versioned migration on MySQL 8.0, unique string field would be generated as type varchar(191) instead of varchar(255). This is because in generating migration files by NamedDiff(), sqlDialect's init() method is not called. 

Further concern: For init() function, MySQL and Postgres's implementation checks the database version which is what I want. But SQLite's implementation checks the foreign_keys support. So I think there might be a better may to check the database version before doing Diff().
@masseelch masseelch merged commit e463cbc into ent:master Apr 6, 2022
@masseelch masseelch changed the title init db version before executing diff dialect:sql/schema: init db version before executing diff Apr 6, 2022
@masseelch masseelch changed the title dialect:sql/schema: init db version before executing diff dialect/sql/schema: init db version before executing diff Apr 6, 2022
@masseelch
Copy link
Collaborator

@all-contributors please add @CharlesGe129 for code.

@allcontributors
Copy link
Contributor

@masseelch

I've put up a pull request to add @CharlesGe129! 🎉

@masseelch
Copy link
Collaborator

@CharlesGe129 Thank you for this. Indeed calling init() is what we should do.

@CharlesGe129
Copy link
Contributor Author

@masseelch Thanks! Glad to be helpful.

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

2 participants