-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(api) : Fix the import command and migrations
The _di_geocodage_code_insee has been removed recently; the import did not work anymore. Also, the _di_geocodage_score column always was absent, there was no need to keep it in the table.
- Loading branch information
Showing
2 changed files
with
59 additions
and
28 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
api/src/alembic/versions/20240820_115237_517603187775_cleanup_unused_fields.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,56 @@ | ||
"""Cleanup unused fields | ||
Revision ID: 517603187775 | ||
Revises: 9f9a66546e3a | ||
Create Date: 2024-08-20 11:52:37.705289 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "517603187775" | ||
down_revision = "9f9a66546e3a" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.drop_column("api__services", "_di_geocodage_score") | ||
op.drop_column("api__services", "_di_geocodage_code_insee") | ||
op.drop_column("api__structures", "_di_geocodage_score") | ||
op.drop_column("api__structures", "_di_geocodage_code_insee") | ||
|
||
|
||
def downgrade() -> None: | ||
op.add_column( | ||
"api__structures", | ||
sa.Column( | ||
"_di_geocodage_code_insee", sa.VARCHAR(), autoincrement=False, nullable=True | ||
), | ||
) | ||
op.add_column( | ||
"api__structures", | ||
sa.Column( | ||
"_di_geocodage_score", | ||
sa.DOUBLE_PRECISION(precision=53), | ||
autoincrement=False, | ||
nullable=True, | ||
), | ||
) | ||
op.add_column( | ||
"api__services", | ||
sa.Column( | ||
"_di_geocodage_code_insee", sa.VARCHAR(), autoincrement=False, nullable=True | ||
), | ||
) | ||
op.add_column( | ||
"api__services", | ||
sa.Column( | ||
"_di_geocodage_score", | ||
sa.DOUBLE_PRECISION(precision=53), | ||
autoincrement=False, | ||
nullable=True, | ||
), | ||
) |
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