diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-02-03 19:23:39 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-02-03 19:23:39 +0100 |
commit | a065a2c873e80ea933b5cb6ef542ad7a759714e1 (patch) | |
tree | 0b2f3e61764afc8589187383d7751bf84181650e /src/migrations/versions/3f83bfe93fc_adding_category.py | |
parent | alembic patch (diff) | |
download | newspipe-a065a2c873e80ea933b5cb6ef542ad7a759714e1.tar.gz newspipe-a065a2c873e80ea933b5cb6ef542ad7a759714e1.tar.bz2 newspipe-a065a2c873e80ea933b5cb6ef542ad7a759714e1.zip |
carpy tests for alembic...
Diffstat (limited to 'src/migrations/versions/3f83bfe93fc_adding_category.py')
-rw-r--r-- | src/migrations/versions/3f83bfe93fc_adding_category.py | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/migrations/versions/3f83bfe93fc_adding_category.py b/src/migrations/versions/3f83bfe93fc_adding_category.py deleted file mode 100644 index b8412418..00000000 --- a/src/migrations/versions/3f83bfe93fc_adding_category.py +++ /dev/null @@ -1,42 +0,0 @@ -"""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') |