-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
dbf1daf55faf_cascade_delete_for_period_stars.py
34 lines (26 loc) · 1.35 KB
/
dbf1daf55faf_cascade_delete_for_period_stars.py
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
"""cascade delete for period stars
Revision ID: dbf1daf55faf
Revises: 1a44b70c747
Create Date: 2016-10-08 10:14:03.852963
"""
revision = 'dbf1daf55faf'
down_revision = '1a44b70c747'
branch_labels = None
depends_on = None
from alembic import op
def upgrade():
op.drop_constraint('report_all_daily_ibfk_1', 'report_all_daily', type_='foreignkey')
op.drop_constraint('report_all_monthly_ibfk_1', 'report_all_monthly', type_='foreignkey')
op.drop_constraint('report_all_weekly_ibfk_1', 'report_all_weekly', type_='foreignkey')
op.create_foreign_key(None, 'report_all_daily', 'repos', ['id'], ['id'], ondelete='CASCADE')
op.create_foreign_key(None, 'report_all_monthly', 'repos', ['id'], ['id'], ondelete='CASCADE')
op.create_foreign_key(None, 'report_all_weekly', 'repos', ['id'], ['id'], ondelete='CASCADE')
def downgrade():
op.drop_constraint(None, 'report_all_weekly', type_='foreignkey')
op.create_foreign_key('report_all_weekly_ibfk_1', 'report_all_weekly', 'repos', ['id'], ['id'])
op.drop_constraint(None, 'report_all_monthly', type_='foreignkey')
op.create_foreign_key(
'report_all_monthly_ibfk_1', 'report_all_monthly', 'repos', ['id'], ['id']
)
op.drop_constraint(None, 'report_all_daily', type_='foreignkey')
op.create_foreign_key('report_all_daily_ibfk_1', 'report_all_daily', 'repos', ['id'], ['id'])