From ab67d697efcf195d036d74dca12291dbcfb047af Mon Sep 17 00:00:00 2001 From: Kian-Tat Lim Date: Wed, 4 Dec 2024 17:01:57 -0800 Subject: [PATCH] Add migrations to fix ccdvisit views. --- ...eceff286_fix_visit_id_in_ccdvisit_views.py | 30 +++++++++++++++++++ ...10c6ed81_fix_visit_id_in_ccdvisit_views.py | 30 +++++++++++++++++++ ...b3673c90_fix_visit_id_in_ccdvisit_views.py | 30 +++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 alembic/latiss/versions/adbbeceff286_fix_visit_id_in_ccdvisit_views.py create mode 100644 alembic/lsstcomcam/versions/913d10c6ed81_fix_visit_id_in_ccdvisit_views.py create mode 100644 alembic/lsstcomcamsim/versions/ab45b3673c90_fix_visit_id_in_ccdvisit_views.py diff --git a/alembic/latiss/versions/adbbeceff286_fix_visit_id_in_ccdvisit_views.py b/alembic/latiss/versions/adbbeceff286_fix_visit_id_in_ccdvisit_views.py new file mode 100644 index 00000000..abcd28a6 --- /dev/null +++ b/alembic/latiss/versions/adbbeceff286_fix_visit_id_in_ccdvisit_views.py @@ -0,0 +1,30 @@ +"""Fix visit_id in ccdvisit views. + +Revision ID: adbbeceff286 +Revises: 47c0b5ce839e +Create Date: 2024-12-05 00:56:52.135839+00:00 + +""" + +from typing import Sequence, Union + +from alembic import op + + +# revision identifiers, used by Alembic. +revision: str = "adbbeceff286" +down_revision: Union[str, None] = "47c0b5ce839e" +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.execute("ALTER TABLE cdb_latiss.ccdvisit1 RENAME COLUMN exposure_id TO visit_id") + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.execute("ALTER TABLE cdb_latiss.ccdvisit1 RENAME COLUMN visit_id TO exposure_id") + # ### end Alembic commands ### diff --git a/alembic/lsstcomcam/versions/913d10c6ed81_fix_visit_id_in_ccdvisit_views.py b/alembic/lsstcomcam/versions/913d10c6ed81_fix_visit_id_in_ccdvisit_views.py new file mode 100644 index 00000000..89742731 --- /dev/null +++ b/alembic/lsstcomcam/versions/913d10c6ed81_fix_visit_id_in_ccdvisit_views.py @@ -0,0 +1,30 @@ +"""Fix visit_id in ccdvisit views. + +Revision ID: 913d10c6ed81 +Revises: 12f0d22a2347 +Create Date: 2024-12-05 00:56:53.875464+00:00 + +""" + +from typing import Sequence, Union + +from alembic import op + + +# revision identifiers, used by Alembic. +revision: str = "913d10c6ed81" +down_revision: Union[str, None] = "12f0d22a2347" +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.execute("ALTER TABLE cdb_latiss.ccdvisit1 RENAME COLUMN exposure_id TO visit_id") + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.execute("ALTER TABLE cdb_latiss.ccdvisit1 RENAME COLUMN visit_id TO exposure_id") + # ### end Alembic commands ### diff --git a/alembic/lsstcomcamsim/versions/ab45b3673c90_fix_visit_id_in_ccdvisit_views.py b/alembic/lsstcomcamsim/versions/ab45b3673c90_fix_visit_id_in_ccdvisit_views.py new file mode 100644 index 00000000..3a5be24b --- /dev/null +++ b/alembic/lsstcomcamsim/versions/ab45b3673c90_fix_visit_id_in_ccdvisit_views.py @@ -0,0 +1,30 @@ +"""Fix visit_id in ccdvisit views. + +Revision ID: ab45b3673c90 +Revises: cb09b95e12fb +Create Date: 2024-12-05 00:56:55.551902+00:00 + +""" + +from typing import Sequence, Union + +from alembic import op + + +# revision identifiers, used by Alembic. +revision: str = "ab45b3673c90" +down_revision: Union[str, None] = "cb09b95e12fb" +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.execute("ALTER TABLE cdb_latiss.ccdvisit1 RENAME COLUMN exposure_id TO visit_id") + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.execute("ALTER TABLE cdb_latiss.ccdvisit1 RENAME COLUMN visit_id TO exposure_id") + # ### end Alembic commands ###