diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2015-05-18 23:05:14 +0200 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2015-07-02 15:34:16 +0200 |
commit | 84e335ebe6ffdd0d543e2a52060b417ba89ff378 (patch) | |
tree | b184d049b8e7b72372ba0b67a889bb82b82534ac | |
parent | sqlite can't drop column, ignoring drop statement (diff) | |
download | newspipe-84e335ebe6ffdd0d543e2a52060b417ba89ff378.tar.gz newspipe-84e335ebe6ffdd0d543e2a52060b417ba89ff378.tar.bz2 newspipe-84e335ebe6ffdd0d543e2a52060b417ba89ff378.zip |
adding filters field
-rwxr-xr-x | manager.py | 4 | ||||
-rw-r--r-- | migrations/versions/422da2d0234_adding_filters_field.py | 22 | ||||
-rw-r--r-- | pyaggr3g470r/models/feed.py | 1 |
3 files changed, 25 insertions, 2 deletions
@@ -1,8 +1,6 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- -import asyncio - from bootstrap import application, db, populate_g from flask.ext.script import Manager from flask.ext.migrate import Migrate, MigrateCommand @@ -39,6 +37,8 @@ def fetch(user, password, limit=100, retreive_all=False): @manager.command def fetch_asyncio(user_id, feed_id): "Crawl the feeds with asyncio." + import asyncio + with application.app_context(): populate_g() from pyaggr3g470r.models import User diff --git a/migrations/versions/422da2d0234_adding_filters_field.py b/migrations/versions/422da2d0234_adding_filters_field.py new file mode 100644 index 00000000..bcbdf042 --- /dev/null +++ b/migrations/versions/422da2d0234_adding_filters_field.py @@ -0,0 +1,22 @@ +"""adding filters field + +Revision ID: 422da2d0234 +Revises: 17dcb75f3fe +Create Date: 2015-05-18 23:03:15.809549 + +""" + +# revision identifiers, used by Alembic. +revision = '422da2d0234' +down_revision = '17dcb75f3fe' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.add_column('feed', sa.Column('filters', sa.PickleType(), nullable=True)) + + +def downgrade(): + op.drop_column('feed', 'filters') diff --git a/pyaggr3g470r/models/feed.py b/pyaggr3g470r/models/feed.py index e43045f1..793642fb 100644 --- a/pyaggr3g470r/models/feed.py +++ b/pyaggr3g470r/models/feed.py @@ -42,6 +42,7 @@ class Feed(db.Model): site_link = db.Column(db.String(), default="") enabled = db.Column(db.Boolean(), default=True) created_date = db.Column(db.DateTime(), default=datetime.now) + filters = db.Column(db.PickleType, default=[]) # cache handling etag = db.Column(db.String(), default="") |