generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
475b3ae
commit 172528d
Showing
61 changed files
with
2,632 additions
and
800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ | ||
{ | ||
"id": 1, | ||
"alert_level": "High Streamflow Advisory" | ||
}, | ||
{ | ||
"id": 2, | ||
"alert_level": "Flood Watch" | ||
}, | ||
{ | ||
"id": 3, | ||
"alert_level": "Flood Warning" | ||
} | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
backend/alembic/versions/V4_rename_basin_and_sub_basin_pks.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""rename basin and sub basin pks | ||
Revision ID: V7 | ||
Revises: V6 | ||
Create Date: 2024-01-31 12:01:14.390799 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "V4" | ||
down_revision: Union[str, None] = "V3" | ||
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.execute("ALTER TABLE py_api.basins RENAME COLUMN id TO basin_id;") | ||
op.execute("ALTER TABLE py_api.subbasins RENAME COLUMN id TO subbasin_id;") | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.execute("ALTER TABLE py_api.basins RENAME COLUMN basin_id TO id;") | ||
op.execute("ALTER TABLE py_api.subbasins RENAME COLUMN subbasin_id TO id;") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
"""create alert tables | ||
Revision ID: V5 | ||
Revises: V4 | ||
Create Date: 2024-02-01 13:28:40.806607 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
import sqlmodel | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "V5" | ||
down_revision: Union[str, None] = "V4" | ||
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( | ||
"alert_levels", | ||
sa.Column("alert_level_id", sa.Integer(), nullable=False), | ||
sa.Column("alert_level", sqlmodel.sql.sqltypes.AutoString(), nullable=False), | ||
sa.PrimaryKeyConstraint("alert_level_id"), | ||
schema="py_api", | ||
) | ||
op.create_table( | ||
"alerts", | ||
sa.Column( | ||
"alert_description", sqlmodel.sql.sqltypes.AutoString(), nullable=False | ||
), | ||
sa.Column( | ||
"alert_hydro_conditions", sqlmodel.sql.sqltypes.AutoString(), nullable=False | ||
), | ||
sa.Column( | ||
"alert_meteorological_conditions", | ||
sqlmodel.sql.sqltypes.AutoString(), | ||
nullable=False, | ||
), | ||
sa.Column("alert_created", sa.DateTime(), nullable=False), | ||
sa.Column("alert_updated", sa.DateTime(), nullable=False), | ||
sa.Column("author_name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), | ||
sa.Column("alert_status", sqlmodel.sql.sqltypes.AutoString(), nullable=False), | ||
sa.Column("alert_id", sa.Integer(), nullable=False), | ||
sa.PrimaryKeyConstraint("alert_id"), | ||
schema="py_api", | ||
) | ||
op.create_table( | ||
"cap_event", | ||
sa.Column("alert_id", sa.Integer(), nullable=False), | ||
sa.Column("alert_level_id", sa.Integer(), nullable=False), | ||
sa.Column( | ||
"cap_event_status", sqlmodel.sql.sqltypes.AutoString(), nullable=False | ||
), | ||
sa.Column("cap_event_created_date", sa.DateTime(), nullable=False), | ||
sa.Column("cap_event_updated_date", sa.DateTime(), nullable=False), | ||
sa.Column("cap_event_id", sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["alert_id"], | ||
["py_api.alerts.alert_id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["alert_level_id"], | ||
["py_api.alert_levels.alert_level_id"], | ||
), | ||
sa.PrimaryKeyConstraint("cap_event_id"), | ||
schema="py_api", | ||
) | ||
op.create_table( | ||
"cap_event_areas", | ||
sa.Column("cap_event_area_id", sa.Integer(), nullable=False), | ||
sa.Column("basin_id", sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["basin_id"], | ||
["py_api.basins.basin_id"], | ||
), | ||
sa.PrimaryKeyConstraint("cap_event_area_id"), | ||
) | ||
op.create_table( | ||
"alert_areas", | ||
sa.Column("alert_id", sa.Integer(), nullable=False), | ||
sa.Column("basin_id", sa.Integer(), nullable=False), | ||
sa.Column("alert_level_id", sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["alert_id"], | ||
["py_api.alerts.alert_id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["alert_level_id"], | ||
["py_api.alert_levels.alert_level_id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["basin_id"], | ||
["py_api.basins.basin_id"], | ||
), | ||
sa.PrimaryKeyConstraint("alert_id", "basin_id", "alert_level_id"), | ||
sa.UniqueConstraint("alert_id", "basin_id", "alert_level_id"), | ||
schema="py_api", | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("alert_areas", schema="py_api") | ||
op.drop_table("cap_event_areas", schema="py_api") | ||
op.drop_table("cap_event", schema="py_api") | ||
op.drop_table("alerts", schema="py_api") | ||
op.drop_table("alert_levels", schema="py_api") | ||
# ### end Alembic commands ### |
Oops, something went wrong.