12345678910111213141516171819202122232425262728293031323334353637 |
- """Enable unique constraints
- Revision ID: 6a5989118ee3
- Revises: cca57457a0a6
- Create Date: 2019-09-22 17:04:01.945713
- """
- from alembic import op
- import sqlalchemy as sa
- # revision identifiers, used by Alembic.
- revision = "6a5989118ee3"
- down_revision = "cca57457a0a6"
- branch_labels = None
- depends_on = None
- def upgrade():
- with op.batch_alter_table("consumption_types") as batch_op:
- batch_op.create_unique_constraint("uc_consumption_types_name", ["name"])
- with op.batch_alter_table("people") as batch_op2:
- batch_op2.create_unique_constraint("uc_people_aardbei_id", ["aardbei_id"])
- batch_op2.create_unique_constraint("uc_people_full_name", ["full_name"])
- batch_op2.create_unique_constraint("uc_people_display_name", ["display_name"])
- def downgrade():
- with op.batch_alter_table("people") as batch_op2:
- batch_op2.drop_constraint("uc_people_display_name", type_="unique")
- batch_op2.drop_constraint("uc_people_full_name", type_="unique")
- batch_op2.drop_constraint("uc_people_aardbei_id", type_="unique")
- with op.batch_alter_table("consumption_types") as batch_op:
- batch_op.drop_constraint("uc_consumption_types_name", type_="unique")
|