-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4cf42964a0f8_refactor_queue_table.py
More file actions
47 lines (37 loc) · 1.02 KB
/
4cf42964a0f8_refactor_queue_table.py
File metadata and controls
47 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""refactor queue table
Revision ID: 4cf42964a0f8
Revises: 3131b2ccb06f
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '4cf42964a0f8'
down_revision = '3131b2ccb06f'
def upgrade():
op.rename_table('queue', 'base_queue')
op.create_check_constraint(
'base_queue_autopause_check',
'base_queue',
"autopause in ('no', 'yes', 'all')",
)
op.drop_constraint('queue_autopause_check', 'base_queue')
op.drop_constraint('queue_pkey', 'base_queue')
op.create_primary_key(
'base_queue_pkey',
'base_queue',
['name'],
)
def downgrade():
op.rename_table('base_queue', 'queue')
op.create_check_constraint(
'queue_autopause_check',
'queue',
"autopause in ('no', 'yes', 'all')",
)
op.drop_constraint('base_queue_autopause_check', 'queue')
op.drop_constraint('base_queue_pkey', 'queue')
op.create_primary_key(
'queue_pkey',
'queue',
['name'],
)