diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-03-10 14:28:47 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-03-10 14:28:47 +0100 |
commit | 6217315aae1392bc6c2e1881ba8e763def40969a (patch) | |
tree | 6fb4c81739d10cfc2e4d1b8d8aa346a6812d4290 | |
parent | Bug fix. (diff) | |
download | newspipe-6217315aae1392bc6c2e1881ba8e763def40969a.tar.gz newspipe-6217315aae1392bc6c2e1881ba8e763def40969a.tar.bz2 newspipe-6217315aae1392bc6c2e1881ba8e763def40969a.zip |
changed the type of the column 'last_modified' to string.
-rw-r--r-- | migrations/versions/17dcb75f3fe_changed_the_type_of_the_column_last_.py | 29 | ||||
-rw-r--r-- | pyaggr3g470r/models/feed.py | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/migrations/versions/17dcb75f3fe_changed_the_type_of_the_column_last_.py b/migrations/versions/17dcb75f3fe_changed_the_type_of_the_column_last_.py new file mode 100644 index 00000000..e7790b3f --- /dev/null +++ b/migrations/versions/17dcb75f3fe_changed_the_type_of_the_column_last_.py @@ -0,0 +1,29 @@ +"""changed the type of the column 'last_modified' to string. + +Revision ID: 17dcb75f3fe +Revises: cde34831ea +Create Date: 2015-03-10 14:20:53.676344 + +""" + +# revision identifiers, used by Alembic. +revision = '17dcb75f3fe' +down_revision = 'cde34831ea' + +from alembic import op +import sqlalchemy as sa + +from datetime import datetime + +def upgrade(): + unix_start = datetime(1970, 1, 1) + op.drop_column('feed', 'last_modified') + op.add_column('feed', sa.Column('last_modified', sa.String(), + nullable=True, default=unix_start, server_default=str(unix_start))) + + +def downgrade(): + unix_start = datetime(1970, 1, 1) + op.drop_column('feed', 'last_modified') + op.add_column('feed', sa.Column('last_modified', sa.DateTime(), + nullable=True, default=unix_start, server_default=unix_start)) diff --git a/pyaggr3g470r/models/feed.py b/pyaggr3g470r/models/feed.py index c80f302c..ccc8094f 100644 --- a/pyaggr3g470r/models/feed.py +++ b/pyaggr3g470r/models/feed.py @@ -47,7 +47,7 @@ class Feed(db.Model): # cache handling etag = db.Column(db.String(), default="") - last_modified = db.Column(db.DateTime(), default=datetime.now) + last_modified = db.Column(db.String(), default="") last_retrieved = db.Column(db.DateTime(), default=datetime(1970, 1, 1)) # error logging |