diff --git a/lnschema_core/__init__.py b/lnschema_core/__init__.py index b7e83a6b..cce980d5 100644 --- a/lnschema_core/__init__.py +++ b/lnschema_core/__init__.py @@ -43,7 +43,7 @@ """ # This is lnschema-module yvzi. _schema_id = "yvzi" -_migration = "049d7dfc80a8" +_migration = "1f29517759b7" __version__ = "0.7.2" # denote a pre-release for 0.1.0 with 0.1a1 from . import id, type # noqa diff --git a/lnschema_core/migrations/versions/2022-09-24-1f29517759b7-v0_7_3.py b/lnschema_core/migrations/versions/2022-09-24-1f29517759b7-v0_7_3.py new file mode 100644 index 00000000..a15a0802 --- /dev/null +++ b/lnschema_core/migrations/versions/2022-09-24-1f29517759b7-v0_7_3.py @@ -0,0 +1,83 @@ +"""v0.7.3. + +Revision ID: 1f29517759b7 +Revises: 049d7dfc80a8 +Create Date: 2022-09-24 10:32:37.801549 + +""" +import sqlalchemy as sa # noqa +import sqlmodel # noqa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "1f29517759b7" +down_revision = "049d7dfc80a8" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + with op.batch_alter_table("dobject", schema=None) as batch_op: + batch_op.alter_column( + "created_at", + existing_type=sa.DATETIME(), + nullable=False, + existing_server_default=sa.text("(CURRENT_TIMESTAMP)"), + ) + + with op.batch_alter_table("jupynb", schema=None) as batch_op: + batch_op.alter_column( + "created_at", + existing_type=sa.DATETIME(), + nullable=False, + existing_server_default=sa.text("(CURRENT_TIMESTAMP)"), + ) + + with op.batch_alter_table("pipeline", schema=None) as batch_op: + batch_op.alter_column( + "created_at", + existing_type=sa.DATETIME(), + nullable=False, + existing_server_default=sa.text("(CURRENT_TIMESTAMP)"), + ) + + with op.batch_alter_table("pipeline_run", schema=None) as batch_op: + batch_op.alter_column( + "created_at", + existing_type=sa.DATETIME(), + nullable=False, + existing_server_default=sa.text("(CURRENT_TIMESTAMP)"), + ) + + with op.batch_alter_table("storage", schema=None) as batch_op: + batch_op.alter_column( + "created_at", + existing_type=sa.DATETIME(), + nullable=False, + existing_server_default=sa.text("(CURRENT_TIMESTAMP)"), + ) + + with op.batch_alter_table("user", schema=None) as batch_op: + batch_op.alter_column( + "created_at", + existing_type=sa.DATETIME(), + nullable=False, + existing_server_default=sa.text("(CURRENT_TIMESTAMP)"), + ) + batch_op.drop_constraint("user", type_="unique") + batch_op.drop_index("ix_user_email") + batch_op.create_index(batch_op.f("ix_user_email"), ["email"], unique=True) + batch_op.drop_index("ix_user_handle") + batch_op.create_index(batch_op.f("ix_user_handle"), ["handle"], unique=True) + + with op.batch_alter_table("version_yvzi", schema=None) as batch_op: + batch_op.alter_column( + "created_at", + existing_type=sa.DATETIME(), + nullable=False, + existing_server_default=sa.text("(CURRENT_TIMESTAMP)"), + ) + + +def downgrade() -> None: + pass diff --git a/tests/testdb.lndb b/tests/testdb.lndb index cc60c3f5..610d847c 100644 Binary files a/tests/testdb.lndb and b/tests/testdb.lndb differ