Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle set default + nullable: false better #1615

Open
lolopinto opened this issue Aug 22, 2023 · 1 comment
Open

handle set default + nullable: false better #1615

lolopinto opened this issue Aug 22, 2023 · 1 comment

Comments

@lolopinto
Copy link
Owner

lolopinto commented Aug 22, 2023

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
Copy link
Owner Author

#1245 is the same thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant