From 98e76b6c218d8cde08bd56b470799d4356f5dc9a Mon Sep 17 00:00:00 2001
From: Kian-Tat Lim <ktl@slac.stanford.edu>
Date: Tue, 25 Jun 2024 21:43:56 +0000
Subject: [PATCH] Change vignette field datatypes.

---
 .../versions/59776480aa4d_fix_vignetting.py   | 82 +++++++++++++++++++
 .../versions/d54a539aad4d_fix_vignetting.py   | 82 +++++++++++++++++++
 .../versions/3f8460378c1e_fix_vignetting.py   | 82 +++++++++++++++++++
 3 files changed, 246 insertions(+)
 create mode 100644 alembic/latiss/versions/59776480aa4d_fix_vignetting.py
 create mode 100644 alembic/lsstcomcam/versions/d54a539aad4d_fix_vignetting.py
 create mode 100644 alembic/lsstcomcamsim/versions/3f8460378c1e_fix_vignetting.py

diff --git a/alembic/latiss/versions/59776480aa4d_fix_vignetting.py b/alembic/latiss/versions/59776480aa4d_fix_vignetting.py
new file mode 100644
index 00000000..28cd1782
--- /dev/null
+++ b/alembic/latiss/versions/59776480aa4d_fix_vignetting.py
@@ -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 ###
diff --git a/alembic/lsstcomcam/versions/d54a539aad4d_fix_vignetting.py b/alembic/lsstcomcam/versions/d54a539aad4d_fix_vignetting.py
new file mode 100644
index 00000000..d16c4799
--- /dev/null
+++ b/alembic/lsstcomcam/versions/d54a539aad4d_fix_vignetting.py
@@ -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 ###
diff --git a/alembic/lsstcomcamsim/versions/3f8460378c1e_fix_vignetting.py b/alembic/lsstcomcamsim/versions/3f8460378c1e_fix_vignetting.py
new file mode 100644
index 00000000..af522d56
--- /dev/null
+++ b/alembic/lsstcomcamsim/versions/3f8460378c1e_fix_vignetting.py
@@ -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 ###