Alter column to nullable #1969
Answered
by
simolus3
bernardoveras
asked this question in
Q&A
-
I want to turn an already existing column into NULLABLE, how do I add this change to the migration? |
Beta Was this translation helpful? Give feedback.
Answered by
simolus3
Aug 4, 2022
Replies: 1 comment 1 reply
-
This is quite simple to do with drift's builtin support for complex table migrations. Essentially, you
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
bernardoveras
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is quite simple to do with drift's builtin support for complex table migrations. Essentially, you
schemaVersion
.await m.alterTable(TableMigration(yourModifiedTable));
. This will re-create the table without loosing data. In your case, you don't need a more complex migration since all the existing data is compatible with the new schema (non-nullable rows can of course be stored in a nullable column).