-
Notifications
You must be signed in to change notification settings - Fork 0
/
2023-07-02_73b155c137af_autoincrement_intake_id.py
83 lines (75 loc) · 2.36 KB
/
2023-07-02_73b155c137af_autoincrement_intake_id.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""autoincrement intake id
Revision ID: 73b155c137af
Revises: 9674564fde8d
Create Date: 2023-07-02 16:59:48.480850
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "73b155c137af"
down_revision = "9674564fde8d"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("caregivers_intake_id_fkey", "caregivers", type_="foreignkey")
op.create_foreign_key(
None, "caregivers", "intakes", ["intake_id"], ["id"], ondelete="CASCADE"
)
op.drop_constraint(
"intakes_concerns_intake_id_fkey", "intakes_concerns", type_="foreignkey"
)
op.create_foreign_key(
None, "intakes_concerns", "intakes", ["intake_id"], ["id"], ondelete="CASCADE"
)
op.drop_constraint(
"intakes_goals_intake_id_fkey", "intakes_goals", type_="foreignkey"
)
op.create_foreign_key(
None, "intakes_goals", "intakes", ["intake_id"], ["id"], ondelete="CASCADE"
)
op.drop_constraint(
"other_permitted_individuals_intake_id_fkey",
"other_permitted_individuals",
type_="foreignkey",
)
op.create_foreign_key(
None,
"other_permitted_individuals",
"intakes",
["intake_id"],
["id"],
ondelete="CASCADE",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "other_permitted_individuals", type_="foreignkey")
op.create_foreign_key(
"other_permitted_individuals_intake_id_fkey",
"other_permitted_individuals",
"intakes",
["intake_id"],
["id"],
)
op.drop_constraint(None, "intakes_goals", type_="foreignkey")
op.create_foreign_key(
"intakes_goals_intake_id_fkey",
"intakes_goals",
"intakes",
["intake_id"],
["id"],
)
op.drop_constraint(None, "intakes_concerns", type_="foreignkey")
op.create_foreign_key(
"intakes_concerns_intake_id_fkey",
"intakes_concerns",
"intakes",
["intake_id"],
["id"],
)
op.drop_constraint(None, "caregivers", type_="foreignkey")
op.create_foreign_key(
"caregivers_intake_id_fkey", "caregivers", "intakes", ["intake_id"], ["id"]
)
# ### end Alembic commands ###