From 91d912a6bd9c84855f713a60d9698df9ebaba7c3 Mon Sep 17 00:00:00 2001 From: Mark Steward Date: Thu, 23 May 2024 01:07:47 +0100 Subject: [PATCH] Alembic got these backwards --- ...e0c_remove_calendarsource_and_external_.py | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/migrations/versions/bdcf93945e0c_remove_calendarsource_and_external_.py b/migrations/versions/bdcf93945e0c_remove_calendarsource_and_external_.py index 3c424ee73..176ce0da4 100644 --- a/migrations/versions/bdcf93945e0c_remove_calendarsource_and_external_.py +++ b/migrations/versions/bdcf93945e0c_remove_calendarsource_and_external_.py @@ -16,38 +16,16 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_index('ix_calendar_source_user_id', table_name='calendar_source') - op.drop_table('calendar_source') + op.drop_table('favourite_calendar_event') op.drop_index('ix_calendar_event_source_id', table_name='calendar_event') op.drop_table('calendar_event') - op.drop_table('favourite_calendar_event') + op.drop_index('ix_calendar_source_user_id', table_name='calendar_source') + op.drop_table('calendar_source') # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.create_table('favourite_calendar_event', - sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False), - sa.Column('event_id', sa.INTEGER(), autoincrement=False, nullable=False), - sa.ForeignKeyConstraint(['event_id'], ['calendar_event.id'], name='fk_favourite_calendar_event_event_id_calendar_event'), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='fk_favourite_calendar_event_user_id_user'), - sa.PrimaryKeyConstraint('user_id', 'event_id', name='pk_favourite_calendar_event') - ) - op.create_table('calendar_event', - sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), - sa.Column('uid', sa.VARCHAR(), autoincrement=False, nullable=True), - sa.Column('start_dt', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), - sa.Column('end_dt', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), - sa.Column('source_id', sa.INTEGER(), autoincrement=False, nullable=False), - sa.Column('summary', sa.VARCHAR(), autoincrement=False, nullable=True), - sa.Column('description', sa.VARCHAR(), autoincrement=False, nullable=True), - sa.Column('location', sa.VARCHAR(), autoincrement=False, nullable=True), - sa.Column('displayed', sa.BOOLEAN(), autoincrement=False, nullable=False), - sa.ForeignKeyConstraint(['source_id'], ['calendar_source.id'], name='fk_calendar_event_source_id_calendar_source'), - sa.PrimaryKeyConstraint('id', name='pk_calendar_event'), - sa.UniqueConstraint('source_id', 'uid', name='uq_calendar_event_source_id') - ) - op.create_index('ix_calendar_event_source_id', 'calendar_event', ['source_id'], unique=False) op.create_table('calendar_source', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('url', sa.VARCHAR(), autoincrement=False, nullable=False), @@ -66,4 +44,26 @@ def downgrade(): sa.PrimaryKeyConstraint('id', name='pk_calendar_source') ) op.create_index('ix_calendar_source_user_id', 'calendar_source', ['user_id'], unique=False) + op.create_table('calendar_event', + sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), + sa.Column('uid', sa.VARCHAR(), autoincrement=False, nullable=True), + sa.Column('start_dt', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), + sa.Column('end_dt', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), + sa.Column('source_id', sa.INTEGER(), autoincrement=False, nullable=False), + sa.Column('summary', sa.VARCHAR(), autoincrement=False, nullable=True), + sa.Column('description', sa.VARCHAR(), autoincrement=False, nullable=True), + sa.Column('location', sa.VARCHAR(), autoincrement=False, nullable=True), + sa.Column('displayed', sa.BOOLEAN(), autoincrement=False, nullable=False), + sa.ForeignKeyConstraint(['source_id'], ['calendar_source.id'], name='fk_calendar_event_source_id_calendar_source'), + sa.PrimaryKeyConstraint('id', name='pk_calendar_event'), + sa.UniqueConstraint('source_id', 'uid', name='uq_calendar_event_source_id') + ) + op.create_index('ix_calendar_event_source_id', 'calendar_event', ['source_id'], unique=False) + op.create_table('favourite_calendar_event', + sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False), + sa.Column('event_id', sa.INTEGER(), autoincrement=False, nullable=False), + sa.ForeignKeyConstraint(['event_id'], ['calendar_event.id'], name='fk_favourite_calendar_event_event_id_calendar_event'), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='fk_favourite_calendar_event_user_id_user'), + sa.PrimaryKeyConstraint('user_id', 'event_id', name='pk_favourite_calendar_event') + ) # ### end Alembic commands ###