-
Notifications
You must be signed in to change notification settings - Fork 513
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
fixes 4879 postgresql class-cast error in alter table rename column during migrations #4880
Merged
AlecKazakova
merged 8 commits into
cashapp:master
from
griffio:fix-rename-column-migration
Jan 31, 2024
Merged
fixes 4879 postgresql class-cast error in alter table rename column during migrations #4880
AlecKazakova
merged 8 commits into
cashapp:master
from
griffio:fix-rename-column-migration
Jan 31, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
griffio
changed the title
Add failure test case for rename
Add failure test case for rename in migration
Dec 4, 2023
griffio
force-pushed
the
fix-rename-column-migration
branch
from
December 6, 2023 17:18
6bc1cc1
to
17f995f
Compare
griffio
changed the title
Add failure test case for rename in migration
fixes 4879 postgresql class-cast error in alter table rename column during migrations
Dec 6, 2023
AlecKazakova
approved these changes
Jan 29, 2024
Unsure how to resolve this conflict will need your help with that |
I will have a look this week as there are PRs with a failing test now |
griffio
force-pushed
the
fix-rename-column-migration
branch
from
January 30, 2024 16:29
dc548c0
to
35ef097
Compare
Needs to be re-run ♻️ - problem fetching deps from npm |
Rename in migration files Caused by: java.lang.ClassCastException: class app.cash.sqldelight.dialects.postgresql.grammar.psi.impl.PostgreSqlAlterTableRenameColumnImpl cannot be cast to class com.alecstrong.sql.psi.core.psi.mixins.ColumnDefMixin (app.cash.sqldelight.dialects.postgresql.grammar.psi.impl.PostgreSqlAlterTableRenameColumnImpl and com.alecstrong.sql.psi.core.psi.mixins.ColumnDefMixin are in unnamed module of loader 'app') `at com.alecstrong.sql.psi.core.psi.mixins.InsertStmtValuesMixin.annotate(InsertStmtValuesMixin.kt:58)`
This fixes the class cast exception so that the correct compiler annotation error messages are displayed SqlColumnAlias needs to have a parent element that implements SqlColumnDef. The renamed column must also copy the nullable state from the renamed column so that the correct nullable type is maintained after renaming
first migrated to alpha remains a Long not null type
Revert to singleOrNulll copy the original column (nullable) and set the new NamedElement from the columnAlias
fixes for AlterTableAlterColumnMixin
open AlterTableRenameColumnMixin, ideally we should be using this PostgreSql implementation This is for consistency with other PR changes
griffio
force-pushed
the
fix-rename-column-migration
branch
from
January 31, 2024 08:47
35ef097
to
398ca4b
Compare
hfhbd
pushed a commit
that referenced
this pull request
Apr 2, 2024
…uring migrations (#4880) * Add failure test case for rename Rename in migration files Caused by: java.lang.ClassCastException: class app.cash.sqldelight.dialects.postgresql.grammar.psi.impl.PostgreSqlAlterTableRenameColumnImpl cannot be cast to class com.alecstrong.sql.psi.core.psi.mixins.ColumnDefMixin (app.cash.sqldelight.dialects.postgresql.grammar.psi.impl.PostgreSqlAlterTableRenameColumnImpl and com.alecstrong.sql.psi.core.psi.mixins.ColumnDefMixin are in unnamed module of loader 'app') `at com.alecstrong.sql.psi.core.psi.mixins.InsertStmtValuesMixin.annotate(InsertStmtValuesMixin.kt:58)` * Update AlterTableRenameColumnMixin to inherit SqlColumnDefImpl This fixes the class cast exception so that the correct compiler annotation error messages are displayed SqlColumnAlias needs to have a parent element that implements SqlColumnDef. The renamed column must also copy the nullable state from the renamed column so that the correct nullable type is maintained after renaming * Now add the migrated property name first migrated to alpha remains a Long not null type * Update AlterTableRenameColumnMixin Revert to singleOrNulll copy the original column (nullable) and set the new NamedElement from the columnAlias * AlterTableAlterColumnMixin fixes for AlterTableAlterColumnMixin * AlterTableRenameColumnMixin extends AlterTableRenameColumnMixin open AlterTableRenameColumnMixin, ideally we should be using this PostgreSql implementation This is for consistency with other PR changes * update test * Rebase changes
This pull request was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #4879
🥼 🦠 🔬 This PR fixes the error in postgresql dialect migrations when renaming a column by making
AlterTableRenameColumnMixin
implementSqlColumDef
.Rename in migration fails when the queries are not renamed to the new column, this is because the
compiler annotation message that is expected raises a class cast exception instead.
SqlColumnAlias
needs to have a parent element that implements SqlColumnDef.The renamed column must also copy the nullable state from the renamed column so
that the correct nullable type is maintained after renaming.
Build test failure reports
🍔 🐘 Have tested snapshot against local project https://github.com/griffio/sqldelight-postgres-01