ent icon indicating copy to clipboard operation
ent copied to clipboard

handle set default + nullable: false better

Open lolopinto opened this issue 1 year ago • 1 comments

These forms set or remove the default value for a column. Note that defaults only apply to subsequent INSERT commands; they do not cause rows already in the table to change. Defaults may also be created for views, in which case they are inserted into INSERT statements on the view before the view's ON INSERT rule is applied.

https://www.postgresql.org/docs/7.3/sql-altertable.html

the following steps ends up with a very sad error

  1. new field nullable
  2. set default value + nullable: false

we end up with 2 migration files and because postgres doesn't actually change the default values, trying to set value to not null doesn't work, leading to a sad error

local branch error-for-server-default-nullable-false-same-time

lolopinto avatar Aug 22 '23 01:08 lolopinto

https://github.com/lolopinto/ent/issues/1245 is the same thing

lolopinto avatar Sep 07 '23 04:09 lolopinto