diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2015-08-03 14:36:13 +0200 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2015-08-03 15:50:41 +0200 |
commit | 0caffceec8b58bc3f78c0d8ea36d2f7e9da668ec (patch) | |
tree | 25ede52ae4b02a2377ae40d2c146c7ed2e9abe2a /migrations/versions | |
parent | ensuring the icon isn't empty and redoing a bit of logging (diff) | |
download | newspipe-0caffceec8b58bc3f78c0d8ea36d2f7e9da668ec.tar.gz newspipe-0caffceec8b58bc3f78c0d8ea36d2f7e9da668ec.tar.bz2 newspipe-0caffceec8b58bc3f78c0d8ea36d2f7e9da668ec.zip |
sqlalchemy was requesting icons everytime feed where listed
so i choosed to move the icons into their own table
Diffstat (limited to 'migrations/versions')
-rw-r--r-- | migrations/versions/19bdaa6208e_add_icon_column.py | 2 | ||||
-rw-r--r-- | migrations/versions/25ca960a207_mv_icons_from_feed_tbl_to_icon_tbl.py | 36 |
2 files changed, 37 insertions, 1 deletions
diff --git a/migrations/versions/19bdaa6208e_add_icon_column.py b/migrations/versions/19bdaa6208e_add_icon_column.py index 5762d6d7..2efa376f 100644 --- a/migrations/versions/19bdaa6208e_add_icon_column.py +++ b/migrations/versions/19bdaa6208e_add_icon_column.py @@ -1,4 +1,4 @@ -"""empty message +"""adding icon columns Revision ID: 19bdaa6208e Revises: 422da2d0234 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 new file mode 100644 index 00000000..2c8eeda5 --- /dev/null +++ b/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') |