Skip to content

Commit 6fee8c0

Browse files
Make migration
1 parent 09d183e commit 6fee8c0

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
"""validation_calibration_activities
2+
3+
Revision ID: edfd39c3a464
4+
Revises: 6856ab93bd63
5+
Create Date: 2025-07-26 13:01:43.811634
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
from alembic import op
12+
import sqlalchemy as sa
13+
from alembic_postgresql_enum import TableReference
14+
15+
from sqlalchemy import Text
16+
import app.db.types
17+
18+
# revision identifiers, used by Alembic.
19+
revision: str = "edfd39c3a464"
20+
down_revision: Union[str, None] = "6856ab93bd63"
21+
branch_labels: Union[str, Sequence[str], None] = None
22+
depends_on: Union[str, Sequence[str], None] = None
23+
24+
25+
def upgrade() -> None:
26+
# ### commands auto generated by Alembic - please adjust! ###
27+
op.create_table(
28+
"calibration",
29+
sa.Column("id", sa.Uuid(), nullable=False),
30+
sa.ForeignKeyConstraint(["id"], ["activity.id"], name=op.f("fk_calibration_id_activity")),
31+
sa.PrimaryKeyConstraint("id", name=op.f("pk_calibration")),
32+
)
33+
op.create_table(
34+
"validation",
35+
sa.Column("id", sa.Uuid(), nullable=False),
36+
sa.ForeignKeyConstraint(["id"], ["activity.id"], name=op.f("fk_validation_id_activity")),
37+
sa.PrimaryKeyConstraint("id", name=op.f("pk_validation")),
38+
)
39+
op.sync_enum_values(
40+
enum_schema="public",
41+
enum_name="activitytype",
42+
new_values=["simulation_execution", "simulation_generation", "validation", "calibration"],
43+
affected_columns=[
44+
TableReference(table_schema="public", table_name="activity", column_name="type")
45+
],
46+
enum_values_to_rename=[],
47+
)
48+
# ### end Alembic commands ###
49+
50+
51+
def downgrade() -> None:
52+
# ### commands auto generated by Alembic - please adjust! ###
53+
op.sync_enum_values(
54+
enum_schema="public",
55+
enum_name="activitytype",
56+
new_values=["simulation_execution", "simulation_generation"],
57+
affected_columns=[
58+
TableReference(table_schema="public", table_name="activity", column_name="type")
59+
],
60+
enum_values_to_rename=[],
61+
)
62+
op.drop_table("validation")
63+
op.drop_table("calibration")
64+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)