diff options
| author | rubenwardy <rw@rubenwardy.com> | 2020-01-18 23:10:11 +0000 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2020-01-18 23:10:11 +0000 |
| commit | 22d02edbd858649e1c890621d72867d913f8dc57 (patch) | |
| tree | fd721e7a045a1108c754ed3758d6ea0aec095dc4 /migrations | |
| parent | 5a496f68588ac0e7565f386d418c051f57df0c8b (diff) | |
| download | cheatdb-22d02edbd858649e1c890621d72867d913f8dc57.tar.xz | |
Add constraint for release tasks and approval
Diffstat (limited to 'migrations')
| -rw-r--r-- | migrations/versions/306ce331a2a7_.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/migrations/versions/306ce331a2a7_.py b/migrations/versions/306ce331a2a7_.py new file mode 100644 index 0000000..7e7c0ce --- /dev/null +++ b/migrations/versions/306ce331a2a7_.py @@ -0,0 +1,26 @@ +"""empty message + +Revision ID: 306ce331a2a7 +Revises: 6dca6eceb04d +Create Date: 2020-01-18 23:00:40.487425 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '306ce331a2a7' +down_revision = '6dca6eceb04d' +branch_labels = None +depends_on = None + + +def upgrade(): + conn = op.get_bind() + op.create_check_constraint("CK_approval_valid", "package_release", "not approved OR (task_id IS NULL AND NOT url = '')") + + +def downgrade(): + conn = op.get_bind() + op.drop_constraint("CK_approval_valid", "package_release", type_="check") |
