-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: clean tables and rename table/schema
- Loading branch information
herve.le-bars
committed
Apr 5, 2024
1 parent
c32a25d
commit b725880
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/alembic/versions/730f5251b9dd_tables_clean_and_rename.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 @@ | ||
"""tables_clean_and_rename | ||
Revision ID: 730f5251b9dd | ||
Revises: 4e912be8a176 | ||
Create Date: 2024-04-05 15:00:40.225950 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '730f5251b9dd' | ||
down_revision = '4e912be8a176' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.rename_table('spire_ais_data', 'stg_spire_ais_data') | ||
# rename mpa_fr_with_mn with drop to manually drop it | ||
op.rename_table('mpa_fr_with_mn', 'drop_mpa_fr_with_mn') | ||
pass | ||
|
||
|
||
def downgrade() -> None: | ||
# nothing to do if drop_mpa_fr_with_mn has been manually dropped | ||
op.execute('ALTER TABLE IF EXISTS drop_mpa_fr_with_mn RENAME TO mpa_fr_with_mn') | ||
op.rename_table('stg_spire_ais_data', 'spire_ais_data') | ||
pass |