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

change_column with {null: false} executes SQL "DROP NOT NULL" #62

Open
briskt opened this issue Nov 7, 2019 · 1 comment
Open

change_column with {null: false} executes SQL "DROP NOT NULL" #62

briskt opened this issue Nov 7, 2019 · 1 comment
Labels
bug Something isn't working s: triage
Milestone

Comments

@briskt
Copy link

briskt commented Nov 7, 2019

Attempting to change a PostgreSQL column from NULL to NOT NULL. Added the following fizz command to a new migration:

change_column("posts", "destination_id", "integer", {null: false})

Running pop migrate -d produces:

sql - ALTER TABLE "posts" ALTER COLUMN "destination_id" TYPE integer, ALTER COLUMN "destination_id" DROP NOT NULL;```

instead of:

sql - ALTER TABLE "posts" ALTER COLUMN "destination_id" TYPE integer, ALTER COLUMN "destination_id" SET NOT NULL;

Workaround (empty options) is easy, but it seems this should work too.

@stanislas-m stanislas-m added the proposal A suggestion for a change, feature, enhancement, etc label Nov 9, 2019
@briskt
Copy link
Author

briskt commented Dec 6, 2019

A colleague of mine hit this yesterday, except on a new column. He did:

add_column("posts", "kilograms", "numeric(13,4)", {null: false})

expecting that it would make a non-nullable column.

aeneasr added a commit that referenced this issue Dec 2, 2021
@sio4 sio4 added bug Something isn't working s: triage and removed proposal A suggestion for a change, feature, enhancement, etc labels Sep 7, 2022
@sio4 sio4 added this to the v2 milestone Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working s: triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants