correct pattern for adding a column with a default value, without setting a server_default ? #1730
-
|
I need to add a new
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
well it's SQLite, so we dont exactly have ALTER COLUMN (it looks like ALTER TABLE/ADD/DROP COLUMN is coming along though). I guess how it could work is, do the ADD COLUMN including the default value of 1, then do an alembic batch migrate to remove the default (which will create a new table and copy the old one over). if this were any other database, then yes you could just drop the server default directly. |
Beta Was this translation helpful? Give feedback.
well it's SQLite, so we dont exactly have ALTER COLUMN (it looks like ALTER TABLE/ADD/DROP COLUMN is coming along though). I guess how it could work is, do the ADD COLUMN including the default value of 1, then do an alembic batch migrate to remove the default (which will create a new table and copy the old one over). if this were any other database, then yes you could just drop the server default directly.