Add unique constraints to tables
This commit is contained in:
parent
372f39bcad
commit
cc666e1ce5
1 changed files with 8 additions and 10 deletions
|
|
@ -8,10 +8,8 @@ Create Date: 2023-12-13 18:55:52.587360
|
||||||
from typing import Sequence, Union
|
from typing import Sequence, Union
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa # noqa: F401
|
||||||
import sqlmodel
|
import sqlmodel # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision: str = '006b3990db50'
|
revision: str = '006b3990db50'
|
||||||
down_revision: Union[str, None] = '1ef9c4f3765d'
|
down_revision: Union[str, None] = '1ef9c4f3765d'
|
||||||
|
|
@ -22,13 +20,13 @@ depends_on: Union[str, Sequence[str], None] = None
|
||||||
def upgrade() -> None:
|
def upgrade() -> None:
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
with op.batch_alter_table('apikey', schema=None) as batch_op:
|
with op.batch_alter_table('apikey', schema=None) as batch_op:
|
||||||
batch_op.create_unique_constraint(None, ['id'])
|
batch_op.create_unique_constraint('uq_apikey_id', ['id'])
|
||||||
|
|
||||||
with op.batch_alter_table('flow', schema=None) as batch_op:
|
with op.batch_alter_table('flow', schema=None) as batch_op:
|
||||||
batch_op.create_unique_constraint(None, ['id'])
|
batch_op.create_unique_constraint('uq_flow_id', ['id'])
|
||||||
|
|
||||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||||
batch_op.create_unique_constraint(None, ['id'])
|
batch_op.create_unique_constraint('uq_user_id', ['id'])
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
@ -36,12 +34,12 @@ def upgrade() -> None:
|
||||||
def downgrade() -> None:
|
def downgrade() -> None:
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||||
batch_op.drop_constraint(None, type_='unique')
|
batch_op.drop_constraint('uq_user_id', type_='unique')
|
||||||
|
|
||||||
with op.batch_alter_table('flow', schema=None) as batch_op:
|
with op.batch_alter_table('flow', schema=None) as batch_op:
|
||||||
batch_op.drop_constraint(None, type_='unique')
|
batch_op.drop_constraint('uq_flow_id', type_='unique')
|
||||||
|
|
||||||
with op.batch_alter_table('apikey', schema=None) as batch_op:
|
with op.batch_alter_table('apikey', schema=None) as batch_op:
|
||||||
batch_op.drop_constraint(None, type_='unique')
|
batch_op.drop_constraint('uq_apikey_id', type_='unique')
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue