]> git.lizzy.rs Git - cheatdb.git/blob - migrations/versions/f612e293070a_.py
Add the ability to lock threads
[cheatdb.git] / migrations / versions / f612e293070a_.py
1 """empty message
2
3 Revision ID: f612e293070a
4 Revises: 019da77ba02d
5 Create Date: 2020-07-10 23:32:02.465374
6
7 """
8 from alembic import op
9 import sqlalchemy as sa
10 import datetime
11
12 # revision identifiers, used by Alembic.
13 revision = 'f612e293070a'
14 down_revision = '019da77ba02d'
15 branch_labels = None
16 depends_on = None
17
18
19 def upgrade():
20         # ### commands auto generated by Alembic - please adjust! ###
21         op.add_column('notification', sa.Column('created_at', sa.DateTime(), nullable=True, server_default=datetime.datetime.utcnow().isoformat()))
22         op.add_column('notification', sa.Column('package_id', sa.Integer(), nullable=True))
23         op.alter_column('notification', 'causer_id',
24                            existing_type=sa.INTEGER(),
25                            nullable=False)
26         op.alter_column('notification', 'user_id',
27                            existing_type=sa.INTEGER(),
28                            nullable=False)
29         op.create_foreign_key(None, 'notification', 'package', ['package_id'], ['id'])
30         # ### end Alembic commands ###
31
32
33 def downgrade():
34         # ### commands auto generated by Alembic - please adjust! ###
35         op.drop_constraint(None, 'notification', type_='foreignkey')
36         op.alter_column('notification', 'user_id',
37                            existing_type=sa.INTEGER(),
38                            nullable=True)
39         op.alter_column('notification', 'causer_id',
40                            existing_type=sa.INTEGER(),
41                            nullable=True)
42         op.drop_column('notification', 'package_id')
43         # ### end Alembic commands ###