Skip to content

Commit

Permalink
Alembic got these backwards
Browse files Browse the repository at this point in the history
  • Loading branch information
marksteward committed May 23, 2024
1 parent 962d5fb commit 91d912a
Showing 1 changed file with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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 ###

0 comments on commit 91d912a

Please sign in to comment.