Second migration alter my primary key #953
-
Describe the bug First migration: Second migration without updating the model: So I get this error: [SQL: ALTER TABLE ********* ALTER COLUMN id DROP NOT NULL] Using: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
hi there - that's not an error message, that looks like the bottom part of one. nothing here is illustrated going wrong and there's no detail we can work with. if you haven't used Alembic before perhaps this can be a discussion where you can share more details of your configuration and such. |
Beta Was this translation helpful? Give feedback.
-
Hi, The issue seems to be that you are setting nullable=True on a primary key in the sqlalchemy table. Alembic is seeing a difference there and is trying to set the column nullable. To solve this you should remove nullable=True from the table definition |
Beta Was this translation helpful? Give feedback.
Hi,
The issue seems to be that you are setting nullable=True on a primary key in the sqlalchemy table.
Postgresql does not support that: https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-PRIMARY-KEYS
Alembic is seeing a difference there and is trying to set the column nullable.
To solve this you should remove nullable=True from the table definition