Skip to content

Commit

Permalink
Merge pull request #27 from lsst-dm/tickets/DM-44967b
Browse files Browse the repository at this point in the history
DM-44967: (hotfix) Change vignette field datatypes.
  • Loading branch information
ktlim committed Jun 25, 2024
2 parents a332116 + 98e76b6 commit 60f7e23
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 0 deletions.
82 changes: 82 additions & 0 deletions alembic/latiss/versions/59776480aa4d_fix_vignetting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
"""fix vignetting
Revision ID: 59776480aa4d
Revises: b801850c5cc9
Create Date: 2024-06-25 21:29:10.680116+00:00
"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from sqlalchemy.dialects import oracle

# revision identifiers, used by Alembic.
revision: str = "59776480aa4d"
down_revision: Union[str, None] = "b801850c5cc9"
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.alter_column(
"exposure",
"vignette",
existing_type=sa.INTEGER(),
type_=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
comment="Instrument blocked from the sky: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_comment="Instrument blocked from the sky: Unknown = 0, No = 1, Partially = 2, Fully = 3.",
existing_nullable=True,
schema="cdb_latiss",
)
op.alter_column(
"exposure",
"vignette_min",
existing_type=sa.INTEGER(),
type_=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
comment="Lowest amount of instrument vignetting detected during the exposure: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_comment="Minimum value of vignette during the exposure.",
existing_nullable=True,
schema="cdb_latiss",
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"exposure",
"vignette_min",
existing_type=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
type_=sa.INTEGER(),
comment="Minimum value of vignette during the exposure.",
existing_comment="Lowest amount of instrument vignetting detected during the exposure: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_nullable=True,
schema="cdb_latiss",
)
op.alter_column(
"exposure",
"vignette",
existing_type=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
type_=sa.INTEGER(),
comment="Instrument blocked from the sky: Unknown = 0, No = 1, Partially = 2, Fully = 3.",
existing_comment="Instrument blocked from the sky: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_nullable=True,
schema="cdb_latiss",
)
# ### end Alembic commands ###
82 changes: 82 additions & 0 deletions alembic/lsstcomcam/versions/d54a539aad4d_fix_vignetting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
"""fix vignetting
Revision ID: d54a539aad4d
Revises: 1b1d80c59d58
Create Date: 2024-06-25 21:28:51.589042+00:00
"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from sqlalchemy.dialects import oracle

# revision identifiers, used by Alembic.
revision: str = "d54a539aad4d"
down_revision: Union[str, None] = "1b1d80c59d58"
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.alter_column(
"exposure",
"vignette",
existing_type=sa.INTEGER(),
type_=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
comment="Instrument blocked from the sky: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_comment="Instrument blocked from the sky: Unknown = 0, No = 1, Partially = 2, Fully = 3.",
existing_nullable=True,
schema="cdb_lsstcomcam",
)
op.alter_column(
"exposure",
"vignette_min",
existing_type=sa.INTEGER(),
type_=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
comment="Lowest amount of instrument vignetting detected during the exposure: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_comment="Minimum value of vignette during the exposure.",
existing_nullable=True,
schema="cdb_lsstcomcam",
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"exposure",
"vignette_min",
existing_type=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
type_=sa.INTEGER(),
comment="Minimum value of vignette during the exposure.",
existing_comment="Lowest amount of instrument vignetting detected during the exposure: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_nullable=True,
schema="cdb_lsstcomcam",
)
op.alter_column(
"exposure",
"vignette",
existing_type=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
type_=sa.INTEGER(),
comment="Instrument blocked from the sky: Unknown = 0, No = 1, Partially = 2, Fully = 3.",
existing_comment="Instrument blocked from the sky: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_nullable=True,
schema="cdb_lsstcomcam",
)
# ### end Alembic commands ###
82 changes: 82 additions & 0 deletions alembic/lsstcomcamsim/versions/3f8460378c1e_fix_vignetting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
"""fix vignetting
Revision ID: 3f8460378c1e
Revises: ef3efe082be3
Create Date: 2024-06-25 21:29:01.650070+00:00
"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from sqlalchemy.dialects import oracle

# revision identifiers, used by Alembic.
revision: str = "3f8460378c1e"
down_revision: Union[str, None] = "ef3efe082be3"
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.alter_column(
"exposure",
"vignette",
existing_type=sa.INTEGER(),
type_=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
comment="Instrument blocked from the sky: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_comment="Instrument blocked from the sky: Unknown = 0, No = 1, Partially = 2, Fully = 3.",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"exposure",
"vignette_min",
existing_type=sa.INTEGER(),
type_=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
comment="Lowest amount of instrument vignetting detected during the exposure: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_comment="Minimum value of vignette during the exposure.",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"exposure",
"vignette_min",
existing_type=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
type_=sa.INTEGER(),
comment="Minimum value of vignette during the exposure.",
existing_comment="Lowest amount of instrument vignetting detected during the exposure: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"exposure",
"vignette",
existing_type=sa.VARCHAR(length=10)
.with_variant(mysql.VARCHAR(length=10), "mysql")
.with_variant(oracle.VARCHAR2(length=10), "oracle")
.with_variant(sa.VARCHAR(length=10), "postgresql"),
type_=sa.INTEGER(),
comment="Instrument blocked from the sky: Unknown = 0, No = 1, Partially = 2, Fully = 3.",
existing_comment="Instrument blocked from the sky: UNKNOWN, NO, PARTIALLY, FULLY.",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
# ### end Alembic commands ###

0 comments on commit 60f7e23

Please sign in to comment.