|
10 | 10 | from sqlalchemy.dialects import postgresql
|
11 | 11 |
|
12 | 12 | # revision identifiers, used by Alembic.
|
13 |
| -revision = '6ba7859cdf27' |
14 |
| -down_revision = 'a1f05c8f324c' |
| 13 | +revision = "6ba7859cdf27" |
| 14 | +down_revision = "a1f05c8f324c" |
15 | 15 | branch_labels = None
|
16 | 16 | depends_on = None
|
17 | 17 |
|
18 | 18 |
|
19 | 19 | def upgrade():
|
20 | 20 | # ### commands auto generated by Alembic - please adjust! ###
|
21 |
| - op.drop_table('entities') |
22 |
| - with op.batch_alter_table('residents', schema=None) as batch_op: |
23 |
| - batch_op.create_unique_constraint(None, ['initial', 'room_num']) |
| 21 | + op.drop_table("entities") |
| 22 | + with op.batch_alter_table("residents", schema=None) as batch_op: |
| 23 | + batch_op.create_unique_constraint(None, ["initial", "room_num"]) |
24 | 24 |
|
25 | 25 | # ### end Alembic commands ###
|
26 | 26 |
|
27 | 27 |
|
28 | 28 | def downgrade():
|
29 | 29 | # ### commands auto generated by Alembic - please adjust! ###
|
30 |
| - with op.batch_alter_table('residents', schema=None) as batch_op: |
31 |
| - batch_op.drop_constraint(None, type_='unique') |
32 |
| - |
33 |
| - op.create_table('entities', |
34 |
| - sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), |
35 |
| - sa.Column('string_field', sa.VARCHAR(), autoincrement=False, nullable=False), |
36 |
| - sa.Column('int_field', sa.INTEGER(), autoincrement=False, nullable=False), |
37 |
| - sa.Column('enum_field', postgresql.ENUM('A', 'B', 'C', 'D', name='enum'), autoincrement=False, nullable=False), |
38 |
| - sa.Column('string_array_field', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=False), |
39 |
| - sa.Column('bool_field', sa.BOOLEAN(), autoincrement=False, nullable=False), |
40 |
| - sa.Column('file_name', sa.VARCHAR(), autoincrement=False, nullable=True), |
41 |
| - sa.PrimaryKeyConstraint('id', name='entities_pkey') |
| 30 | + with op.batch_alter_table("residents", schema=None) as batch_op: |
| 31 | + batch_op.drop_constraint(None, type_="unique") |
| 32 | + |
| 33 | + op.create_table( |
| 34 | + "entities", |
| 35 | + sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False), |
| 36 | + sa.Column("string_field", sa.VARCHAR(), autoincrement=False, nullable=False), |
| 37 | + sa.Column("int_field", sa.INTEGER(), autoincrement=False, nullable=False), |
| 38 | + sa.Column( |
| 39 | + "enum_field", |
| 40 | + postgresql.ENUM("A", "B", "C", "D", name="enum"), |
| 41 | + autoincrement=False, |
| 42 | + nullable=False, |
| 43 | + ), |
| 44 | + sa.Column( |
| 45 | + "string_array_field", |
| 46 | + postgresql.ARRAY(sa.VARCHAR()), |
| 47 | + autoincrement=False, |
| 48 | + nullable=False, |
| 49 | + ), |
| 50 | + sa.Column("bool_field", sa.BOOLEAN(), autoincrement=False, nullable=False), |
| 51 | + sa.Column("file_name", sa.VARCHAR(), autoincrement=False, nullable=True), |
| 52 | + sa.PrimaryKeyConstraint("id", name="entities_pkey"), |
42 | 53 | )
|
43 | 54 | # ### end Alembic commands ###
|
0 commit comments