diff --git a/alembic/versions/cac6140fdbf9_initial_migration.py b/alembic/versions/f1540475192e_initial_migration.py similarity index 97% rename from alembic/versions/cac6140fdbf9_initial_migration.py rename to alembic/versions/f1540475192e_initial_migration.py index a5017b72..fe6c114d 100644 --- a/alembic/versions/cac6140fdbf9_initial_migration.py +++ b/alembic/versions/f1540475192e_initial_migration.py @@ -1,19 +1,18 @@ """Initial migration -Revision ID: cac6140fdbf9 -Revises: -Create Date: 2024-05-13 16:18:47.291448 +Revision ID: f1540475192e +Revises: +Create Date: 2024-05-13 17:48:42.947299 """ from typing import Sequence, Union -from alembic import op import sqlalchemy as sa -from sqlalchemy.dialects import mysql -from sqlalchemy.dialects import oracle +from alembic import op +from sqlalchemy.dialects import mysql, oracle # revision identifiers, used by Alembic. -revision: str = 'cac6140fdbf9' +revision: str = 'f1540475192e' down_revision: Union[str, None] = None branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None @@ -21,7 +20,7 @@ def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.execute("CREATE SCHEMA IF NOT EXISTS cdb_latiss") + op.execute('CREATE SCHEMA IF NOT EXISTS cdb_latiss') op.create_table('exposure', sa.Column('exposure_id', sa.BIGINT().with_variant(mysql.BIGINT(), 'mysql').with_variant(oracle.NUMBER(precision=38, scale=0, asdecimal=False), 'oracle').with_variant(sa.BIGINT(), 'postgresql'), nullable=False, comment='Unique identifier.'), sa.Column('exposure_name', sa.VARCHAR(length=20).with_variant(mysql.VARCHAR(length=20), 'mysql').with_variant(oracle.VARCHAR2(length=20), 'oracle').with_variant(sa.VARCHAR(length=20), 'postgresql'), nullable=False, comment='Official name of the exposure.'), @@ -80,15 +79,15 @@ def upgrade() -> None: schema='cdb_latiss' ) op.create_table('exposure_flexdata_schema', - sa.Column('key', sa.TEXT().with_variant(mysql.LONGTEXT(), 'mysql').with_variant(sa.CLOB(), 'oracle').with_variant(sa.TEXT(), 'postgresql'), nullable=True, comment='Name of key.'), + sa.Column('key', sa.TEXT().with_variant(mysql.LONGTEXT(), 'mysql').with_variant(sa.CLOB(), 'oracle').with_variant(sa.TEXT(), 'postgresql'), nullable=False, comment='Name of key.'), sa.Column('dtype', sa.TEXT().with_variant(mysql.LONGTEXT(), 'mysql').with_variant(sa.CLOB(), 'oracle').with_variant(sa.TEXT(), 'postgresql'), nullable=True, comment='Name of the data type of the value, one of bool, int, float, str.'), sa.Column('doc', sa.TEXT().with_variant(mysql.LONGTEXT(), 'mysql').with_variant(sa.CLOB(), 'oracle').with_variant(sa.TEXT(), 'postgresql'), nullable=True, comment='Documentation string. Can include units and IVOA UCD.'), sa.PrimaryKeyConstraint('key'), schema='cdb_latiss' ) op.create_table('exposure_flexdata', - sa.Column('obs_id', sa.BIGINT().with_variant(mysql.BIGINT(), 'mysql').with_variant(oracle.NUMBER(precision=38, scale=0, asdecimal=False), 'oracle').with_variant(sa.BIGINT(), 'postgresql'), nullable=True, comment='Unique identifier.'), - sa.Column('key', sa.TEXT().with_variant(mysql.LONGTEXT(), 'mysql').with_variant(sa.CLOB(), 'oracle').with_variant(sa.TEXT(), 'postgresql'), nullable=True, comment='Name of key.'), + sa.Column('obs_id', sa.BIGINT().with_variant(mysql.BIGINT(), 'mysql').with_variant(oracle.NUMBER(precision=38, scale=0, asdecimal=False), 'oracle').with_variant(sa.BIGINT(), 'postgresql'), nullable=False, comment='Unique identifier.'), + sa.Column('key', sa.TEXT().with_variant(mysql.LONGTEXT(), 'mysql').with_variant(sa.CLOB(), 'oracle').with_variant(sa.TEXT(), 'postgresql'), nullable=False, comment='Name of key.'), sa.Column('value', sa.TEXT().with_variant(mysql.LONGTEXT(), 'mysql').with_variant(sa.CLOB(), 'oracle').with_variant(sa.TEXT(), 'postgresql'), nullable=True, comment='Content of value as a string.'), sa.ForeignKeyConstraint(['key'], ['cdb_latiss.exposure_flexdata_schema.key'], name='fk_key'), sa.ForeignKeyConstraint(['obs_id'], ['cdb_latiss.exposure.exposure_id'], name='fk_obs_id'),