-
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
bf81367
commit 5f1d0f7
Showing
4 changed files
with
151 additions
and
49 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
code/alembic/versions/ce7ce568b948_update_station_model.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 @@ | ||
"""update Station model | ||
Revision ID: ce7ce568b948 | ||
Revises: 5661cd0d79fd | ||
Create Date: 2024-09-28 00:07:13.078189 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'ce7ce568b948' | ||
down_revision: Union[str, None] = '5661cd0d79fd' | ||
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! ### | ||
pass | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
pass | ||
# ### 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,52 @@ | ||
"""Add Location model | ||
Revision ID: d37e07dca078 | ||
Revises: ce7ce568b948 | ||
Create Date: 2024-09-29 23:06:13.815037 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'd37e07dca078' | ||
down_revision: Union[str, None] = 'ce7ce568b948' | ||
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('locations', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('lat', sa.Float(), nullable=True), | ||
sa.Column('lon', sa.Float(), nullable=True), | ||
sa.Column('height', sa.Float(), nullable=True), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_index(op.f('ix_locations_id'), 'locations', ['id'], unique=False) | ||
op.add_column('measurements', sa.Column('location_id', sa.Integer(), nullable=True)) | ||
op.create_foreign_key(None, 'measurements', 'locations', ['location_id'], ['id']) | ||
op.add_column('stations', sa.Column('location_id', sa.Integer(), nullable=True)) | ||
op.create_foreign_key(None, 'stations', 'locations', ['location_id'], ['id']) | ||
op.drop_column('stations', 'height') | ||
op.drop_column('stations', 'lat') | ||
op.drop_column('stations', 'lon') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('stations', sa.Column('lon', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True)) | ||
op.add_column('stations', sa.Column('lat', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True)) | ||
op.add_column('stations', sa.Column('height', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True)) | ||
op.drop_constraint(None, 'stations', type_='foreignkey') | ||
op.drop_column('stations', 'location_id') | ||
op.drop_constraint(None, 'measurements', type_='foreignkey') | ||
op.drop_column('measurements', 'location_id') | ||
op.drop_index(op.f('ix_locations_id'), table_name='locations') | ||
op.drop_table('locations') | ||
# ### 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
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