-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2024_12_18_1431-86303e239b4d_add_event_dates.py
91 lines (83 loc) · 2.82 KB
/
2024_12_18_1431-86303e239b4d_add_event_dates.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
84
85
86
87
88
89
90
91
"""add event dates
Revision ID: 86303e239b4d
Revises: 3527051d7f9b
Create Date: 2024-12-18 14:31:26.278718
"""
from typing import Sequence, Union
import geoalchemy2
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "86303e239b4d"
down_revision: Union[str, None] = "3527051d7f9b"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"event_date",
sa.Column("lifecycle_date_id", sa.UUID(as_uuid=False), nullable=False),
sa.Column("decision_id", sa.UUID(as_uuid=False), nullable=True),
sa.Column("processing_event_id", sa.UUID(as_uuid=False), nullable=True),
sa.Column("interaction_event_id", sa.UUID(as_uuid=False), nullable=True),
sa.Column("starting_at", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column("ending_at", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column(
"id",
sa.UUID(as_uuid=False),
server_default=sa.text("gen_random_uuid()"),
nullable=False,
),
sa.Column(
"created_at",
sa.TIMESTAMP(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column(
"modified_at",
sa.TIMESTAMP(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.ForeignKeyConstraint(
["decision_id"],
["codes.name_of_plan_case_decision.id"],
name="name_of_plan_case_decision_id_fkey",
),
sa.ForeignKeyConstraint(
["interaction_event_id"],
["codes.type_of_interaction_event.id"],
name="type_of_interaction_event_fkey",
),
sa.ForeignKeyConstraint(
["lifecycle_date_id"],
["hame.lifecycle_date.id"],
name="lifecycle_date_id_fkey",
ondelete="CASCADE",
),
sa.ForeignKeyConstraint(
["processing_event_id"],
["codes.type_of_processing_event.id"],
name="type_of_processing_event_fkey",
),
sa.PrimaryKeyConstraint("id"),
schema="hame",
)
op.create_index(
op.f("ix_hame_event_date_lifecycle_date_id"),
"event_date",
["lifecycle_date_id"],
unique=False,
schema="hame",
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
op.f("ix_hame_event_date_lifecycle_date_id"),
table_name="event_date",
schema="hame",
)
op.drop_table("event_date", schema="hame")
# ### end Alembic commands ###