aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-05-29 20:17:18 +0100
committerrubenwardy <rw@rubenwardy.com>2018-05-29 20:17:18 +0100
commite7acd7faa38f4c08beb6e674deab976181034103 (patch)
treeb6281484203bfbe841e5ad9bdd944bf5852f5e37 /migrations
parentf755c7d429f23bd61b4cf7d6bfd75ce29d8553f5 (diff)
downloadcheatdb-e7acd7faa38f4c08beb6e674deab976181034103.tar.xz
Add separate media license
Fixes #91
Diffstat (limited to 'migrations')
-rw-r--r--migrations/versions/aa6d7b595a94_.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/migrations/versions/aa6d7b595a94_.py b/migrations/versions/aa6d7b595a94_.py
new file mode 100644
index 0000000..784082f
--- /dev/null
+++ b/migrations/versions/aa6d7b595a94_.py
@@ -0,0 +1,35 @@
+"""empty message
+
+Revision ID: aa6d7b595a94
+Revises: aa6d21889d22
+Create Date: 2018-05-29 20:09:56.647358
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'aa6d7b595a94'
+down_revision = 'aa6d21889d22'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.add_column('package', sa.Column('media_license_id', sa.Integer()))
+ op.execute('UPDATE package SET media_license_id=license_id')
+ op.alter_column('package', 'media_license_id', nullable=False)
+ op.alter_column('package', 'license_id', existing_type=sa.INTEGER(), nullable=False)
+ op.create_foreign_key(None, 'package', 'license', ['media_license_id'], ['id'])
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.alter_column('package', 'license_id',
+ existing_type=sa.INTEGER(),
+ nullable=True)
+ op.drop_column('package', 'media_license_id')
+ # ### end Alembic commands ###