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

Popular posts from this blog

javascript - Feed FileReader from server side files -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

php - Webix Data Loading from Laravel Link -