-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajout colonne clé d'unicité d'une vue - cf #129
- Loading branch information
1 parent
40efba3
commit b96b78b
Showing
3 changed files
with
47 additions
and
2 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
34 changes: 34 additions & 0 deletions
34
backend/gn_module_export/migrations/fdc2d823a8b9_add_primary_key_view_column_in_t_exports.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,34 @@ | ||
"""Add primary key view column in t_exports | ||
Revision ID: fdc2d823a8b9 | ||
Revises: c2d02e345a06 | ||
Create Date: 2023-05-11 17:33:00.460204 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "fdc2d823a8b9" | ||
down_revision = "4cac712a2ce6" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.add_column( | ||
"t_exports", | ||
sa.Column("view_pk_column", sa.Unicode, server_default=None), | ||
schema="gn_exports", | ||
) | ||
op.execute( | ||
""" | ||
UPDATE gn_exports.t_exports SET view_pk_column='id_synthese' | ||
WHERE label = 'Synthese SINP'; | ||
""" | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_column("t_exports", "view_pk_column", schema="gn_exports") |
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