aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-07-11 00:53:03 +0100
committerrubenwardy <rw@rubenwardy.com>2020-07-11 00:53:03 +0100
commit5f7be4b4337358e35c9eda4b261260a08a958b4a (patch)
tree1a24fe62c3ba28d1867fb6a3fbbd475f8b6a2aba /migrations
parent9bf20df941deb666c0452cb425cf337d425dc59d (diff)
downloadcheatdb-5f7be4b4337358e35c9eda4b261260a08a958b4a.tar.xz
Add package and created_at to Notifications
Diffstat (limited to 'migrations')
-rw-r--r--migrations/versions/f612e293070a_.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/migrations/versions/f612e293070a_.py b/migrations/versions/f612e293070a_.py
new file mode 100644
index 0000000..b451236
--- /dev/null
+++ b/migrations/versions/f612e293070a_.py
@@ -0,0 +1,43 @@
+"""empty message
+
+Revision ID: f612e293070a
+Revises: 019da77ba02d
+Create Date: 2020-07-10 23:32:02.465374
+
+"""
+from alembic import op
+import sqlalchemy as sa
+import datetime
+
+# revision identifiers, used by Alembic.
+revision = 'f612e293070a'
+down_revision = '019da77ba02d'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.add_column('notification', sa.Column('created_at', sa.DateTime(), nullable=True, server_default=datetime.datetime.utcnow().isoformat()))
+ op.add_column('notification', sa.Column('package_id', sa.Integer(), nullable=True))
+ op.alter_column('notification', 'causer_id',
+ existing_type=sa.INTEGER(),
+ nullable=False)
+ op.alter_column('notification', 'user_id',
+ existing_type=sa.INTEGER(),
+ nullable=False)
+ op.create_foreign_key(None, 'notification', 'package', ['package_id'], ['id'])
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_constraint(None, 'notification', type_='foreignkey')
+ op.alter_column('notification', 'user_id',
+ existing_type=sa.INTEGER(),
+ nullable=True)
+ op.alter_column('notification', 'causer_id',
+ existing_type=sa.INTEGER(),
+ nullable=True)
+ op.drop_column('notification', 'package_id')
+ # ### end Alembic commands ###