redash/migrations/versions/71477dadd6ef_favorites_unique_constraint.py
Arik Fraimovich 2dff8b9a00
Black support for the Python codebase (#4297)
* Apply black formatting

* Add auto formatting when committing to master

* Update CONTRIBUTING.md re. Black & Prettier
2019-12-11 13:54:29 +02:00

27 lines
537 B
Python

"""favorites_unique_constraint
Revision ID: 71477dadd6ef
Revises: 0f740a081d20
Create Date: 2018-07-11 12:49:52.792123
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "71477dadd6ef"
down_revision = "0f740a081d20"
branch_labels = None
depends_on = None
def upgrade():
op.create_unique_constraint(
"unique_favorite", "favorites", ["object_type", "object_id", "user_id"]
)
def downgrade():
op.drop_constraint("unique_favorite", "favorites", type_="unique")