From b35e9773198ef2d8b37c4ca223f08147db47de0b Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Sat, 12 Dec 2015 21:14:28 +0100 Subject: moving the root of source code from / to /src/ --- ...ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py (limited to 'src/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py') diff --git a/src/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py b/src/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py new file mode 100644 index 00000000..2c8eeda5 --- /dev/null +++ b/src/migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py @@ -0,0 +1,36 @@ +"""moving icons to their own table + +Revision ID: 25ca960a207 +Revises: 19bdaa6208e +Create Date: 2015-08-03 14:36:21.626411 + +""" + +# revision identifiers, used by Alembic. +revision = '25ca960a207' +down_revision = '19bdaa6208e' + +from alembic import op +import sqlalchemy as sa + +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') + + +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') -- cgit