diff --git a/pycroft/model/alembic/versions/bc0e0dd480d4_add_bankaccount_owner.py b/pycroft/model/alembic/versions/bc0e0dd480d4_add_bankaccount_owner.py index 6f9ed7efc..dad485b73 100644 --- a/pycroft/model/alembic/versions/bc0e0dd480d4_add_bankaccount_owner.py +++ b/pycroft/model/alembic/versions/bc0e0dd480d4_add_bankaccount_owner.py @@ -10,81 +10,75 @@ from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. -revision = 'bc0e0dd480d4' -down_revision = '55e9f0d9b5f4' +revision = "bc0e0dd480d4" +down_revision = "55e9f0d9b5f4" branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.add_column('bank_account', sa.Column('owner', sa.String(length=255), nullable=True)) - op.drop_index('bank_account_activity_imported_at', table_name='bank_account_activity') - op.alter_column('log_entry', 'author_id', - existing_type=sa.INTEGER(), - nullable=False) - op.alter_column('membership_fee', 'booking_begin', - existing_type=postgresql.INTERVAL(), - nullable=False) - op.alter_column('membership_fee', 'booking_end', - existing_type=postgresql.INTERVAL(), - nullable=False) - op.alter_column('pre_member', 'passwd_hash', - existing_type=sa.VARCHAR(), - nullable=True) - op.alter_column('pre_member', 'birthdate', - existing_type=sa.DATE(), - nullable=True) - op.alter_column('room_history_entry', 'active_during', - existing_type=postgresql.TSTZRANGE(), - nullable=False) - op.create_index(op.f('ix_room_history_entry_room_id'), 'room_history_entry', ['room_id'], unique=False) - op.create_index(op.f('ix_room_history_entry_user_id'), 'room_history_entry', ['user_id'], unique=False) - op.drop_constraint('room_history_entry_room_id_fkey', 'room_history_entry', type_='foreignkey') - op.drop_constraint('room_history_entry_user_id_fkey', 'room_history_entry', type_='foreignkey') - op.create_foreign_key(None, 'room_history_entry', 'room', ['room_id'], ['id'], ondelete='CASCADE') - op.create_foreign_key(None, 'room_history_entry', 'user', ['user_id'], ['id'], ondelete='CASCADE') - op.alter_column('task', 'task_type', - existing_type=sa.VARCHAR(length=50), - nullable=False) - op.alter_column('traffic_volume', 'user_id', - existing_type=sa.INTEGER(), - nullable=False) + op.add_column("bank_account", sa.Column("owner", sa.String(length=255), nullable=True)) + op.drop_index("bank_account_activity_imported_at", table_name="bank_account_activity") + op.alter_column("log_entry", "author_id", existing_type=sa.INTEGER(), nullable=False) + op.alter_column( + "membership_fee", "booking_begin", existing_type=postgresql.INTERVAL(), nullable=False + ) + op.alter_column( + "membership_fee", "booking_end", existing_type=postgresql.INTERVAL(), nullable=False + ) + op.alter_column("pre_member", "passwd_hash", existing_type=sa.VARCHAR(), nullable=True) + op.alter_column("pre_member", "birthdate", existing_type=sa.DATE(), nullable=True) + op.alter_column( + "room_history_entry", "active_during", existing_type=postgresql.TSTZRANGE(), nullable=False + ) + op.create_index( + op.f("ix_room_history_entry_room_id"), "room_history_entry", ["room_id"], unique=False + ) + op.create_index( + op.f("ix_room_history_entry_user_id"), "room_history_entry", ["user_id"], unique=False + ) + op.drop_constraint("room_history_entry_room_id_fkey", "room_history_entry", type_="foreignkey") + op.drop_constraint("room_history_entry_user_id_fkey", "room_history_entry", type_="foreignkey") + op.create_foreign_key( + None, "room_history_entry", "room", ["room_id"], ["id"], ondelete="CASCADE" + ) + op.create_foreign_key( + None, "room_history_entry", "user", ["user_id"], ["id"], ondelete="CASCADE" + ) + op.alter_column("task", "task_type", existing_type=sa.VARCHAR(length=50), nullable=False) + op.alter_column("traffic_volume", "user_id", existing_type=sa.INTEGER(), nullable=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.alter_column('traffic_volume', 'user_id', - existing_type=sa.INTEGER(), - nullable=True) - op.alter_column('task', 'task_type', - existing_type=sa.VARCHAR(length=50), - nullable=True) - op.drop_constraint(None, 'room_history_entry', type_='foreignkey') - op.drop_constraint(None, 'room_history_entry', type_='foreignkey') - op.create_foreign_key('room_history_entry_user_id_fkey', 'room_history_entry', 'user', ['user_id'], ['id']) - op.create_foreign_key('room_history_entry_room_id_fkey', 'room_history_entry', 'room', ['room_id'], ['id']) - op.drop_index(op.f('ix_room_history_entry_user_id'), table_name='room_history_entry') - op.drop_index(op.f('ix_room_history_entry_room_id'), table_name='room_history_entry') - op.alter_column('room_history_entry', 'active_during', - existing_type=postgresql.TSTZRANGE(), - nullable=True) - op.alter_column('pre_member', 'birthdate', - existing_type=sa.DATE(), - nullable=False) - op.alter_column('pre_member', 'passwd_hash', - existing_type=sa.VARCHAR(), - nullable=False) - op.alter_column('membership_fee', 'booking_end', - existing_type=postgresql.INTERVAL(), - nullable=True) - op.alter_column('membership_fee', 'booking_begin', - existing_type=postgresql.INTERVAL(), - nullable=True) - op.alter_column('log_entry', 'author_id', - existing_type=sa.INTEGER(), - nullable=True) - op.create_index('bank_account_activity_imported_at', 'bank_account_activity', ['imported_at'], unique=False) - op.drop_column('bank_account', 'owner') + op.alter_column("traffic_volume", "user_id", existing_type=sa.INTEGER(), nullable=True) + op.alter_column("task", "task_type", existing_type=sa.VARCHAR(length=50), nullable=True) + op.drop_constraint(None, "room_history_entry", type_="foreignkey") + op.drop_constraint(None, "room_history_entry", type_="foreignkey") + op.create_foreign_key( + "room_history_entry_user_id_fkey", "room_history_entry", "user", ["user_id"], ["id"] + ) + op.create_foreign_key( + "room_history_entry_room_id_fkey", "room_history_entry", "room", ["room_id"], ["id"] + ) + op.drop_index(op.f("ix_room_history_entry_user_id"), table_name="room_history_entry") + op.drop_index(op.f("ix_room_history_entry_room_id"), table_name="room_history_entry") + op.alter_column( + "room_history_entry", "active_during", existing_type=postgresql.TSTZRANGE(), nullable=True + ) + op.alter_column("pre_member", "birthdate", existing_type=sa.DATE(), nullable=False) + op.alter_column("pre_member", "passwd_hash", existing_type=sa.VARCHAR(), nullable=False) + op.alter_column( + "membership_fee", "booking_end", existing_type=postgresql.INTERVAL(), nullable=True + ) + op.alter_column( + "membership_fee", "booking_begin", existing_type=postgresql.INTERVAL(), nullable=True + ) + op.alter_column("log_entry", "author_id", existing_type=sa.INTEGER(), nullable=True) + op.create_index( + "bank_account_activity_imported_at", "bank_account_activity", ["imported_at"], unique=False + ) + op.drop_column("bank_account", "owner") # ### end Alembic commands ###