From 5ddee6967f8641eb710622650da0020f33c688ac Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Mon, 18 May 2015 22:57:47 +0200 Subject: sqlite can't drop column, ignoring drop statement --- ...7dcb75f3fe_changed_the_type_of_the_column_last_.py | 19 ++++++++++++------- .../versions/48f561c0ce6_add_column_entry_id.py | 4 +++- ...cde34831ea_adding_feed_and_user_attributes_for_.py | 13 +++++++------ 3 files changed, 22 insertions(+), 14 deletions(-) (limited to 'migrations') 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 index e7790b3f..035646c6 100644 --- a/migrations/versions/17dcb75f3fe_changed_the_type_of_the_column_last_.py +++ b/migrations/versions/17dcb75f3fe_changed_the_type_of_the_column_last_.py @@ -10,20 +10,25 @@ Create Date: 2015-03-10 14:20:53.676344 revision = '17dcb75f3fe' down_revision = 'cde34831ea' +from datetime import datetime +import conf 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))) + if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: + 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)) + if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: + 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/migrations/versions/48f561c0ce6_add_column_entry_id.py b/migrations/versions/48f561c0ce6_add_column_entry_id.py index e5bc5735..f464849a 100644 --- a/migrations/versions/48f561c0ce6_add_column_entry_id.py +++ b/migrations/versions/48f561c0ce6_add_column_entry_id.py @@ -12,6 +12,7 @@ down_revision = None branch_labels = None depends_on = None +import conf from alembic import op import sqlalchemy as sa @@ -21,4 +22,5 @@ def upgrade(): def downgrade(): - op.drop_column('article', 'entry_id') + if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: + op.drop_column('article', 'entry_id') diff --git a/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py b/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py index 03e96564..116fdaa1 100644 --- a/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py +++ b/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py @@ -34,10 +34,11 @@ def upgrade(): def downgrade(): # commands auto generated by Alembic - please adjust! ### - op.drop_column('user', 'refresh_rate') - op.drop_column('feed', 'last_modified') - op.drop_column('feed', 'last_error') - op.drop_column('feed', 'error_count') - op.drop_column('feed', 'last_retrieved') - op.drop_column('feed', 'etag') + if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: + op.drop_column('user', 'refresh_rate') + op.drop_column('feed', 'last_modified') + op.drop_column('feed', 'last_error') + op.drop_column('feed', 'error_count') + op.drop_column('feed', 'last_retrieved') + op.drop_column('feed', 'etag') # end Alembic commands ### -- cgit