diff options
Diffstat (limited to 'migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py')
-rw-r--r-- | migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py b/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py index 2c8eeda5..ef54259a 100644 --- a/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py +++ b/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py @@ -7,8 +7,8 @@ Create Date: 2015-08-03 14:36:21.626411 """ # revision identifiers, used by Alembic. -revision = '25ca960a207' -down_revision = '19bdaa6208e' +revision = "25ca960a207" +down_revision = "19bdaa6208e" from alembic import op import sqlalchemy as sa @@ -17,20 +17,22 @@ import conf def upgrade(): - op.create_table('icon', - sa.Column('url', sa.String(), nullable=False), - sa.Column('content', sa.String(), nullable=True), - sa.Column('mimetype', sa.String(), nullable=True), - sa.PrimaryKeyConstraint('url')) - op.add_column('feed', sa.Column('icon_url', sa.String(), nullable=True)) - if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: - op.create_foreign_key(None, 'feed', 'icon', ['icon_url'], ['url']) - op.drop_column('feed', 'icon') + op.create_table( + "icon", + sa.Column("url", sa.String(), nullable=False), + sa.Column("content", sa.String(), nullable=True), + sa.Column("mimetype", sa.String(), nullable=True), + sa.PrimaryKeyConstraint("url"), + ) + op.add_column("feed", sa.Column("icon_url", sa.String(), nullable=True)) + if "sqlite" not in conf.SQLALCHEMY_DATABASE_URI: + op.create_foreign_key(None, "feed", "icon", ["icon_url"], ["url"]) + op.drop_column("feed", "icon") def downgrade(): - op.add_column('feed', sa.Column('icon', sa.VARCHAR(), nullable=True)) - if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: - op.drop_constraint(None, 'feed', type_='foreignkey') - op.drop_column('feed', 'icon_url') - op.drop_table('icon') + op.add_column("feed", sa.Column("icon", sa.VARCHAR(), nullable=True)) + if "sqlite" not in conf.SQLALCHEMY_DATABASE_URI: + op.drop_constraint(None, "feed", type_="foreignkey") + op.drop_column("feed", "icon_url") + op.drop_table("icon") |