sqlalchemy - Alembic default value to be used in add_column -
how alembic use specified default value new column, without making server_default?
only existing rows should receive default value. new rows inserted after should still server_default.
i had similar problem, wanted new column not nullable, not work existing rows, of course. created row without not null constraint first, filled column custom python code , altered column (in same migration) have constraint.
so you'd iterate on existing objects, set values according transient default.
Comments
Post a Comment