-
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.
Prefix aut nav treni with venezia (#172)
* Create migration to replace in tables stations, stops, stop_times * Rename all references to aut, nav, treni
- Loading branch information
Showing
8 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
alembic/versions/dd839935b0bb_prefix_aut_nav_treni_with_venezia.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,48 @@ | ||
"""Prefix aut, nav, treni with venezia | ||
Revision ID: dd839935b0bb | ||
Revises: d55702afa188 | ||
Create Date: 2024-01-19 15:11:41.149726 | ||
""" | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'dd839935b0bb' | ||
down_revision = 'd55702afa188' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# in stations rename aut to venezia-aut, nav to venezia-nav, treni to venezia-treni | ||
op.execute("UPDATE stations SET source='venezia-aut' WHERE source='aut'") | ||
op.execute("UPDATE stations SET source='venezia-nav' WHERE source='nav'") | ||
op.execute("UPDATE stations SET source='venezia-treni' WHERE source='treni'") | ||
|
||
# in stops rename aut to venezia-aut, nav to venezia-nav, treni to venezia-treni | ||
op.execute("UPDATE stops SET source='venezia-aut' WHERE source='aut'") | ||
op.execute("UPDATE stops SET source='venezia-nav' WHERE source='nav'") | ||
op.execute("UPDATE stops SET source='venezia-treni' WHERE source='treni'") | ||
|
||
# in stop_times rename aut to venezia-aut, nav to venezia-nav, treni to venezia-treni | ||
op.execute("UPDATE stop_times SET source='venezia-aut' WHERE source='aut'") | ||
op.execute("UPDATE stop_times SET source='venezia-nav' WHERE source='nav'") | ||
op.execute("UPDATE stop_times SET source='venezia-treni' WHERE source='treni'") | ||
|
||
|
||
def downgrade() -> None: | ||
# in stations rename venezia-aut to aut, venezia-nav to nav, venezia-treni to treni | ||
op.execute("UPDATE stations SET source='aut' WHERE source='venezia-aut'") | ||
op.execute("UPDATE stations SET source='nav' WHERE source='venezia-nav'") | ||
op.execute("UPDATE stations SET source='treni' WHERE source='venezia-treni'") | ||
|
||
# in stops rename venezia-aut to aut, venezia-nav to nav, venezia-treni to treni | ||
op.execute("UPDATE stops SET source='aut' WHERE source='venezia-aut'") | ||
op.execute("UPDATE stops SET source='nav' WHERE source='venezia-nav'") | ||
op.execute("UPDATE stops SET source='treni' WHERE source='venezia-treni'") | ||
|
||
# in stop_times rename venezia-aut to aut, venezia-nav to nav, venezia-treni to treni | ||
op.execute("UPDATE stop_times SET source='aut' WHERE source='venezia-aut'") | ||
op.execute("UPDATE stop_times SET source='nav' WHERE source='venezia-nav'") | ||
op.execute("UPDATE stop_times SET source='treni' WHERE source='venezia-treni'") |
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
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
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