mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix revision d058: use util wrappers; rearrange ops
Rearrange ops in downgrade block to mirror ops in upgrade block in reverse order: upgrade: - do A - do B downgrade: - undo B - undo A
This commit is contained in:
+14
-9
@@ -5,7 +5,6 @@ Revises: c39f1de47a04
|
||||
Create Date: 2022-06-09 12:24:44.329038
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
from sqlalchemy import (
|
||||
Column,
|
||||
ForeignKey,
|
||||
@@ -15,8 +14,14 @@ from sqlalchemy import (
|
||||
)
|
||||
|
||||
from galaxy.model.migrations.util import (
|
||||
add_column,
|
||||
add_unique_constraint,
|
||||
create_index,
|
||||
create_table,
|
||||
drop_column,
|
||||
drop_index,
|
||||
drop_table,
|
||||
drop_unique_constraint,
|
||||
)
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
@@ -27,9 +32,8 @@ depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column("quota", Column("quota_source_label", String(32), default=None))
|
||||
|
||||
op.create_table(
|
||||
add_column("quota", Column("quota_source_label", String(32), default=None))
|
||||
create_table(
|
||||
"user_quota_source_usage",
|
||||
Column("id", Integer, primary_key=True),
|
||||
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
|
||||
@@ -38,12 +42,13 @@ def upgrade():
|
||||
Column("disk_usage", Numeric(15, 0)),
|
||||
)
|
||||
add_unique_constraint("uqsu_unique_label_per_user", "user_quota_source_usage", ["user_id", "quota_source_label"])
|
||||
op.drop_index("ix_default_quota_association_type", "default_quota_association")
|
||||
op.create_index("ix_quota_quota_source_label", "quota", ["quota_source_label"])
|
||||
drop_index("ix_default_quota_association_type", "default_quota_association")
|
||||
create_index("ix_quota_quota_source_label", "quota", ["quota_source_label"])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.create_index("ix_default_quota_association_type", "default_quota_association", ["type"], unique=True)
|
||||
op.drop_table("user_quota_source_usage")
|
||||
op.drop_index("ix_quota_quota_source_label", "quota")
|
||||
drop_index("ix_quota_quota_source_label", "quota")
|
||||
create_index("ix_default_quota_association_type", "default_quota_association", ["type"], unique=True)
|
||||
drop_unique_constraint("uqsu_unique_label_per_user", "user_quota_source_usage")
|
||||
drop_table("user_quota_source_usage")
|
||||
drop_column("quota", "quota_source_label")
|
||||
|
||||
Reference in New Issue
Block a user