diff --git a/src/backend/langflow/alembic/versions/006b3990db50_add_unique_constraints.py b/src/backend/langflow/alembic/versions/006b3990db50_add_unique_constraints.py new file mode 100644 index 000000000..4c891635b --- /dev/null +++ b/src/backend/langflow/alembic/versions/006b3990db50_add_unique_constraints.py @@ -0,0 +1,47 @@ +"""Add unique constraints + +Revision ID: 006b3990db50 +Revises: 1ef9c4f3765d +Create Date: 2023-12-13 18:55:52.587360 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +import sqlmodel + + +# revision identifiers, used by Alembic. +revision: str = '006b3990db50' +down_revision: Union[str, None] = '1ef9c4f3765d' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('apikey', schema=None) as batch_op: + batch_op.create_unique_constraint(None, ['id']) + + with op.batch_alter_table('flow', schema=None) as batch_op: + batch_op.create_unique_constraint(None, ['id']) + + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.create_unique_constraint(None, ['id']) + + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.drop_constraint(None, type_='unique') + + with op.batch_alter_table('flow', schema=None) as batch_op: + batch_op.drop_constraint(None, type_='unique') + + with op.batch_alter_table('apikey', schema=None) as batch_op: + batch_op.drop_constraint(None, type_='unique') + + # ### end Alembic commands ###