|
10 | 10 |
|
11 | 11 |
|
12 | 12 | # revision identifiers, used by Alembic.
|
13 |
| -revision = 'a1f05c8f324c' |
14 |
| -down_revision = '117790caec65' |
| 13 | +revision = "a1f05c8f324c" |
| 14 | +down_revision = "117790caec65" |
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 |
| - with op.batch_alter_table('log_record_tag', schema=None) as batch_op: |
22 |
| - batch_op.drop_constraint('log_record_tag_tag_id_fkey', type_='foreignkey') |
23 |
| - batch_op.create_foreign_key(None, 'tags', ['tag_id'], ['tag_id'], ondelete='CASCADE') |
24 |
| - |
25 |
| - with op.batch_alter_table('residents', schema=None) as batch_op: |
26 |
| - batch_op.add_column(sa.Column('last_modified', sa.DateTime(), server_default=sa.text('now()'), nullable=False)) |
| 21 | + with op.batch_alter_table("log_record_tag", schema=None) as batch_op: |
| 22 | + batch_op.drop_constraint("log_record_tag_tag_id_fkey", type_="foreignkey") |
| 23 | + batch_op.create_foreign_key( |
| 24 | + None, "tags", ["tag_id"], ["tag_id"], ondelete="CASCADE" |
| 25 | + ) |
| 26 | + |
| 27 | + with op.batch_alter_table("residents", schema=None) as batch_op: |
| 28 | + batch_op.add_column( |
| 29 | + sa.Column( |
| 30 | + "last_modified", |
| 31 | + sa.DateTime(), |
| 32 | + server_default=sa.text("now()"), |
| 33 | + nullable=False, |
| 34 | + ) |
| 35 | + ) |
27 | 36 |
|
28 | 37 | # ### end Alembic commands ###
|
29 | 38 |
|
30 | 39 |
|
31 | 40 | def downgrade():
|
32 | 41 | # ### commands auto generated by Alembic - please adjust! ###
|
33 |
| - with op.batch_alter_table('residents', schema=None) as batch_op: |
34 |
| - batch_op.drop_column('last_modified') |
35 |
| - |
36 |
| - with op.batch_alter_table('log_record_tag', schema=None) as batch_op: |
37 |
| - batch_op.drop_constraint(None, type_='foreignkey') |
38 |
| - batch_op.create_foreign_key('log_record_tag_tag_id_fkey', 'tags', ['tag_id'], ['tag_id']) |
| 42 | + with op.batch_alter_table("residents", schema=None) as batch_op: |
| 43 | + batch_op.drop_column("last_modified") |
| 44 | + |
| 45 | + with op.batch_alter_table("log_record_tag", schema=None) as batch_op: |
| 46 | + batch_op.drop_constraint(None, type_="foreignkey") |
| 47 | + batch_op.create_foreign_key( |
| 48 | + "log_record_tag_tag_id_fkey", "tags", ["tag_id"], ["tag_id"] |
| 49 | + ) |
39 | 50 |
|
40 | 51 | # ### end Alembic commands ###
|
0 commit comments