aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2016-01-31 03:01:11 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-31 03:01:11 +0100
commitb3a1cdc3429287f4221fac036bb4476ef47d679f (patch)
tree184ed5068ce13faf2c07d8cd03cc3f1ba1918bba
parentredoing navbar in react (diff)
downloadnewspipe-b3a1cdc3429287f4221fac036bb4476ef47d679f.tar.gz
newspipe-b3a1cdc3429287f4221fac036bb4476ef47d679f.tar.bz2
newspipe-b3a1cdc3429287f4221fac036bb4476ef47d679f.zip
adding migration
-rw-r--r--src/migrations/versions/3f83bfe93fc_adding_category.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/migrations/versions/3f83bfe93fc_adding_category.py b/src/migrations/versions/3f83bfe93fc_adding_category.py
new file mode 100644
index 00000000..b8412418
--- /dev/null
+++ b/src/migrations/versions/3f83bfe93fc_adding_category.py
@@ -0,0 +1,42 @@
+"""adding category
+
+Revision ID: 3f83bfe93fc
+Revises: 25ca960a207
+Create Date: 2015-09-01 14:15:04.212563
+"""
+
+# revision identifiers, used by Alembic.
+revision = '3f83bfe93fc'
+down_revision = 'db64b766362f'
+
+import conf
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+ op.create_table('category',
+ sa.Column('id', sa.Integer(), nullable=False),
+ sa.Column('name', sa.String(), nullable=True),
+ sa.Column('user_id', sa.Integer(), nullable=True),
+ sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
+ sa.PrimaryKeyConstraint('id'))
+ op.add_column('article',
+ sa.Column('category_id', sa.Integer(), nullable=True))
+ op.add_column('feed',
+ sa.Column('category_id', sa.Integer(), nullable=True))
+ if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI:
+ op.create_foreign_key(None, 'article', 'category',
+ ['category_id'], ['id'])
+ op.create_foreign_key(None, 'feed', 'category',
+ ['category_id'], ['id'])
+
+
+def downgrade():
+ if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI:
+ op.drop_constraint(None, 'feed', type_='foreignkey')
+ op.drop_constraint(None, 'feed', type_='foreignkey')
+ op.drop_column('feed', 'category_id')
+ op.drop_constraint(None, 'article', type_='foreignkey')
+ op.drop_column('article', 'category_id')
+ op.drop_table('category')
bgstack15