Livesync: Fix intermediate alembic steps

This commit is contained in:
Adrian Moennich 2015-03-10 17:13:18 +01:00
parent bbf2f54832
commit c3566fceba

View File

@ -11,6 +11,7 @@ from sqlalchemy.dialects import postgresql
from sqlalchemy.sql.ddl import CreateSchema, DropSchema
from indico.core.db.sqlalchemy import UTCDateTime, PyIntEnum
from indico.core.db.sqlalchemy.util.bulk_rename import _rename_constraint
from indico_livesync.models.queue import ChangeType
@ -29,11 +30,11 @@ def upgrade():
sa.Column('initial_data_exported', sa.Boolean(), nullable=False),
sa.Column('last_run', UTCDateTime(), nullable=False),
sa.Column('settings', postgresql.JSON(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.PrimaryKeyConstraint('id', name='agents_pkey'),
schema='plugin_livesync')
op.create_table('queues',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('agent_id', sa.Integer(), nullable=False, index=True),
sa.Column('agent_id', sa.Integer(), nullable=False),
sa.Column('timestamp', UTCDateTime(), nullable=False),
sa.Column('processed', sa.Boolean(), nullable=False),
sa.Column('change', PyIntEnum(ChangeType), nullable=False),
@ -42,9 +43,12 @@ def upgrade():
sa.Column('event_id', sa.String()),
sa.Column('contrib_id', sa.String()),
sa.Column('subcontrib_id', sa.String()),
sa.ForeignKeyConstraint(['agent_id'], ['plugin_livesync.agents.id']),
sa.PrimaryKeyConstraint('id'),
sa.ForeignKeyConstraint(['agent_id'], ['plugin_livesync.agents.id'], name='queues_agent_id_fkey'),
sa.PrimaryKeyConstraint('id', name='queues_pkey'),
sa.Index('ix_plugin_livesync_queues_agent_id', 'agent_id'),
schema='plugin_livesync')
# later migrations expect the old name...
op.execute(_rename_constraint('plugin_livesync', 'queues', 'ck_queues_valid_enum_change', 'queues_change_check'))
def downgrade():