diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-03-10 10:34:00 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-03-10 10:34:00 +0100 |
commit | 677304ba3ecbd204fa2726e6820de84ad09bd868 (patch) | |
tree | bd19fbf2f1a0cddad1980fe15cf4c228867c5d69 /migrations/versions | |
parent | Updated README. (diff) | |
download | newspipe-677304ba3ecbd204fa2726e6820de84ad09bd868.tar.gz newspipe-677304ba3ecbd204fa2726e6820de84ad09bd868.tar.bz2 newspipe-677304ba3ecbd204fa2726e6820de84ad09bd868.zip |
Added a tiny portion of black magic.
Diffstat (limited to 'migrations/versions')
21 files changed, 216 insertions, 187 deletions
diff --git a/migrations/versions/16f8fc3cf0cc_add_column_webpage_in_the_user_table.py b/migrations/versions/16f8fc3cf0cc_add_column_webpage_in_the_user_table.py index 4ff875b7..1bfca7d0 100644 --- a/migrations/versions/16f8fc3cf0cc_add_column_webpage_in_the_user_table.py +++ b/migrations/versions/16f8fc3cf0cc_add_column_webpage_in_the_user_table.py @@ -7,8 +7,8 @@ Create Date: 2016-09-21 08:00:27.160357 """ # revision identifiers, used by Alembic. -revision = '16f8fc3cf0cc' -down_revision = '957d4c5b8ac9' +revision = "16f8fc3cf0cc" +down_revision = "957d4c5b8ac9" branch_labels = None depends_on = None @@ -17,9 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.add_column('user', sa.Column('webpage', - sa.String(), default="")) + op.add_column("user", sa.Column("webpage", sa.String(), default="")) def downgrade(): - op.drop_column('user', 'webpage') + op.drop_column("user", "webpage") 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 035646c6..0da32e20 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 @@ -7,8 +7,8 @@ Create Date: 2015-03-10 14:20:53.676344 """ # revision identifiers, used by Alembic. -revision = '17dcb75f3fe' -down_revision = 'cde34831ea' +revision = "17dcb75f3fe" +down_revision = "cde34831ea" from datetime import datetime import conf @@ -18,17 +18,31 @@ import sqlalchemy as sa def upgrade(): unix_start = datetime(1970, 1, 1) - 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))) + 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) - 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)) + 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/19bdaa6208e_add_icon_column.py b/migrations/versions/19bdaa6208e_add_icon_column.py index 2efa376f..95274b63 100644 --- a/migrations/versions/19bdaa6208e_add_icon_column.py +++ b/migrations/versions/19bdaa6208e_add_icon_column.py @@ -7,8 +7,8 @@ Create Date: 2015-07-03 12:09:58.596010 """ # revision identifiers, used by Alembic. -revision = '19bdaa6208e' -down_revision = '422da2d0234' +revision = "19bdaa6208e" +down_revision = "422da2d0234" from alembic import op import sqlalchemy as sa @@ -16,11 +16,11 @@ import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ### - op.add_column('feed', sa.Column('icon', sa.String(), nullable=True)) + op.add_column("feed", sa.Column("icon", sa.String(), nullable=True)) ### end Alembic commands ### def downgrade(): ### commands auto generated by Alembic - please adjust! ### - op.drop_column('feed', 'icon') + op.drop_column("feed", "icon") ### end Alembic commands ### diff --git a/migrations/versions/1b750a389c22_remove_email_notification_column.py b/migrations/versions/1b750a389c22_remove_email_notification_column.py index 71529855..34021deb 100644 --- a/migrations/versions/1b750a389c22_remove_email_notification_column.py +++ b/migrations/versions/1b750a389c22_remove_email_notification_column.py @@ -7,8 +7,8 @@ Create Date: 2015-02-25 23:01:07.253429 """ # revision identifiers, used by Alembic. -revision = '1b750a389c22' -down_revision = '48f561c0ce6' +revision = "1b750a389c22" +down_revision = "48f561c0ce6" import conf from alembic import op @@ -16,10 +16,9 @@ import sqlalchemy as sa def upgrade(): - if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: - op.drop_column('feed', 'email_notification') + if "sqlite" not in conf.SQLALCHEMY_DATABASE_URI: + op.drop_column("feed", "email_notification") def downgrade(): - op.add_column('feed', sa.Column('email_notification', sa.Boolean(), - default=False)) + op.add_column("feed", sa.Column("email_notification", sa.Boolean(), default=False)) diff --git a/migrations/versions/2472eddbf44b_update_of_the_user_model.py b/migrations/versions/2472eddbf44b_update_of_the_user_model.py index a0194090..0a39c943 100644 --- a/migrations/versions/2472eddbf44b_update_of_the_user_model.py +++ b/migrations/versions/2472eddbf44b_update_of_the_user_model.py @@ -7,8 +7,8 @@ Create Date: 2016-03-01 22:35:03.659694 """ # revision identifiers, used by Alembic. -revision = '2472eddbf44b' -down_revision = 'ac35c979311a' +revision = "2472eddbf44b" +down_revision = "ac35c979311a" branch_labels = None depends_on = None @@ -17,22 +17,23 @@ import sqlalchemy as sa def upgrade(): - op.drop_column('user', 'enabled') - op.add_column('user', sa.Column('is_active', sa.Boolean(), default=False)) - op.add_column('user', sa.Column('is_admin', sa.Boolean(), default=False)) - op.add_column('user', sa.Column('is_api', sa.Boolean(), default=False)) - op.drop_table('role') - + op.drop_column("user", "enabled") + op.add_column("user", sa.Column("is_active", sa.Boolean(), default=False)) + op.add_column("user", sa.Column("is_admin", sa.Boolean(), default=False)) + op.add_column("user", sa.Column("is_api", sa.Boolean(), default=False)) + op.drop_table("role") def downgrade(): - op.drop_column('user', 'is_active') - op.drop_column('user', 'is_admin') - op.drop_column('user', 'is_api') - op.create_table('role', - sa.Column('id', sa.INTEGER(), nullable=False), - sa.Column('name', sa.VARCHAR(), nullable=True), - sa.Column('user_id', sa.INTEGER(), nullable=True), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('name')) + op.drop_column("user", "is_active") + op.drop_column("user", "is_admin") + op.drop_column("user", "is_api") + op.create_table( + "role", + sa.Column("id", sa.INTEGER(), nullable=False), + sa.Column("name", sa.VARCHAR(), nullable=True), + sa.Column("user_id", sa.INTEGER(), nullable=True), + sa.ForeignKeyConstraint(["user_id"], ["user.id"],), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("name"), + ) 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 index 2c8eeda5..ef54259a 100644 --- 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 @@ -7,8 +7,8 @@ Create Date: 2015-08-03 14:36:21.626411 """ # revision identifiers, used by Alembic. -revision = '25ca960a207' -down_revision = '19bdaa6208e' +revision = "25ca960a207" +down_revision = "19bdaa6208e" from alembic import op import sqlalchemy as sa @@ -17,20 +17,22 @@ 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') + 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') + 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") diff --git a/migrations/versions/2c5cc05216fa_adding_tag_handling_capacities.py b/migrations/versions/2c5cc05216fa_adding_tag_handling_capacities.py index f9559fe3..299cca08 100644 --- a/migrations/versions/2c5cc05216fa_adding_tag_handling_capacities.py +++ b/migrations/versions/2c5cc05216fa_adding_tag_handling_capacities.py @@ -7,8 +7,8 @@ Create Date: 2016-11-08 07:41:13.923531 """ # revision identifiers, used by Alembic. -revision = '2c5cc05216fa' -down_revision = 'be2b8b6f33dd' +revision = "2c5cc05216fa" +down_revision = "be2b8b6f33dd" branch_labels = None depends_on = None @@ -17,14 +17,14 @@ import sqlalchemy as sa def upgrade(): - op.create_table('tag', - sa.Column('text', sa.String(), nullable=False), - sa.Column('article_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['article_id'], ['article.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('text', 'article_id') + op.create_table( + "tag", + sa.Column("text", sa.String(), nullable=False), + sa.Column("article_id", sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(["article_id"], ["article.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("text", "article_id"), ) def downgrade(): - op.drop_table('tag') + op.drop_table("tag") diff --git a/migrations/versions/3f83bfe93fc_add_updated_date_column_to_article_table.py b/migrations/versions/3f83bfe93fc_add_updated_date_column_to_article_table.py index 2c67450c..1be2abed 100644 --- a/migrations/versions/3f83bfe93fc_add_updated_date_column_to_article_table.py +++ b/migrations/versions/3f83bfe93fc_add_updated_date_column_to_article_table.py @@ -7,16 +7,16 @@ Create Date: 2016-02-12 21:51:40.868539 """ # revision identifiers, used by Alembic. -revision = '3f83bfe93fc' -down_revision = '25ca960a207' +revision = "3f83bfe93fc" +down_revision = "25ca960a207" from alembic import op import sqlalchemy as sa def upgrade(): - op.add_column('article', sa.Column('updated_date', sa.DateTime(), nullable=True)) + op.add_column("article", sa.Column("updated_date", sa.DateTime(), nullable=True)) def downgrade(): - op.drop_column('article', 'updated_date') + op.drop_column("article", "updated_date") diff --git a/migrations/versions/422da2d0234_adding_filters_field.py b/migrations/versions/422da2d0234_adding_filters_field.py index bcbdf042..e7a35118 100644 --- a/migrations/versions/422da2d0234_adding_filters_field.py +++ b/migrations/versions/422da2d0234_adding_filters_field.py @@ -7,16 +7,16 @@ Create Date: 2015-05-18 23:03:15.809549 """ # revision identifiers, used by Alembic. -revision = '422da2d0234' -down_revision = '17dcb75f3fe' +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)) + op.add_column("feed", sa.Column("filters", sa.PickleType(), nullable=True)) def downgrade(): - op.drop_column('feed', 'filters') + op.drop_column("feed", "filters") diff --git a/migrations/versions/48f561c0ce6_add_column_entry_id.py b/migrations/versions/48f561c0ce6_add_column_entry_id.py index f464849a..11148e8d 100644 --- a/migrations/versions/48f561c0ce6_add_column_entry_id.py +++ b/migrations/versions/48f561c0ce6_add_column_entry_id.py @@ -7,7 +7,7 @@ Create Date: 2015-02-18 21:17:19.346998 """ # revision identifiers, used by Alembic. -revision = '48f561c0ce6' +revision = "48f561c0ce6" down_revision = None branch_labels = None depends_on = None @@ -18,9 +18,9 @@ import sqlalchemy as sa def upgrade(): - op.add_column('article', sa.Column('entry_id', sa.String(), nullable=True)) + op.add_column("article", sa.Column("entry_id", sa.String(), nullable=True)) def downgrade(): - if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: - 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/5553a6c05fa7_add_column_twitter_in_the_user_table.py b/migrations/versions/5553a6c05fa7_add_column_twitter_in_the_user_table.py index 7c7132a8..e7ef9b38 100644 --- a/migrations/versions/5553a6c05fa7_add_column_twitter_in_the_user_table.py +++ b/migrations/versions/5553a6c05fa7_add_column_twitter_in_the_user_table.py @@ -7,8 +7,8 @@ Create Date: 2016-10-06 11:02:41.356322 """ # revision identifiers, used by Alembic. -revision = '5553a6c05fa7' -down_revision = 'f700c4237e9d' +revision = "5553a6c05fa7" +down_revision = "f700c4237e9d" branch_labels = None depends_on = None @@ -17,9 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.add_column('user', sa.Column('twitter', - sa.String(), default="")) + op.add_column("user", sa.Column("twitter", sa.String(), default="")) def downgrade(): - op.drop_column('user', 'twitter') + op.drop_column("user", "twitter") diff --git a/migrations/versions/661199d8768a_problem_with_the_last_upgrade.py b/migrations/versions/661199d8768a_problem_with_the_last_upgrade.py index 1470dd04..0989a892 100644 --- a/migrations/versions/661199d8768a_problem_with_the_last_upgrade.py +++ b/migrations/versions/661199d8768a_problem_with_the_last_upgrade.py @@ -7,8 +7,8 @@ Create Date: 2016-02-13 11:33:14.183576 """ # revision identifiers, used by Alembic. -revision = '661199d8768a' -down_revision = '3f83bfe93fc' +revision = "661199d8768a" +down_revision = "3f83bfe93fc" branch_labels = None depends_on = None @@ -17,8 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.add_column('article', sa.Column('updated_date', sa.DateTime(), nullable=True)) + op.add_column("article", sa.Column("updated_date", sa.DateTime(), nullable=True)) def downgrade(): - op.drop_column('article', 'updated_date') + op.drop_column("article", "updated_date") diff --git a/migrations/versions/8bf5694c0b9e_add_column_automatic_crawling_to_the_.py b/migrations/versions/8bf5694c0b9e_add_column_automatic_crawling_to_the_.py index 5728449a..477e1376 100644 --- a/migrations/versions/8bf5694c0b9e_add_column_automatic_crawling_to_the_.py +++ b/migrations/versions/8bf5694c0b9e_add_column_automatic_crawling_to_the_.py @@ -7,8 +7,8 @@ Create Date: 2016-10-06 13:47:32.784711 """ # revision identifiers, used by Alembic. -revision = '8bf5694c0b9e' -down_revision = '5553a6c05fa7' +revision = "8bf5694c0b9e" +down_revision = "5553a6c05fa7" branch_labels = None depends_on = None @@ -17,9 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.add_column('user', sa.Column('automatic_crawling', - sa.Boolean(), default=True)) + op.add_column("user", sa.Column("automatic_crawling", sa.Boolean(), default=True)) def downgrade(): - op.drop_column('user', 'automatic_crawling') + op.drop_column("user", "automatic_crawling") diff --git a/migrations/versions/957d4c5b8ac9_add_column_is_public_profile_to_the_.py b/migrations/versions/957d4c5b8ac9_add_column_is_public_profile_to_the_.py index 4e967121..d5c03c8a 100644 --- a/migrations/versions/957d4c5b8ac9_add_column_is_public_profile_to_the_.py +++ b/migrations/versions/957d4c5b8ac9_add_column_is_public_profile_to_the_.py @@ -7,8 +7,8 @@ Create Date: 2016-09-20 14:35:31.302555 """ # revision identifiers, used by Alembic. -revision = '957d4c5b8ac9' -down_revision = '2472eddbf44b' +revision = "957d4c5b8ac9" +down_revision = "2472eddbf44b" branch_labels = None depends_on = None @@ -17,9 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.add_column('user', sa.Column('is_public_profile', - sa.Boolean(), default=False)) + op.add_column("user", sa.Column("is_public_profile", sa.Boolean(), default=False)) def downgrade(): - op.drop_column('user', 'is_public_profile') + op.drop_column("user", "is_public_profile") diff --git a/migrations/versions/ac35c979311a_removed_activation_key_from_the_user_.py b/migrations/versions/ac35c979311a_removed_activation_key_from_the_user_.py index 446f9d2f..644720b2 100644 --- a/migrations/versions/ac35c979311a_removed_activation_key_from_the_user_.py +++ b/migrations/versions/ac35c979311a_removed_activation_key_from_the_user_.py @@ -7,8 +7,8 @@ Create Date: 2016-02-18 08:54:43.786641 """ # revision identifiers, used by Alembic. -revision = 'ac35c979311a' -down_revision = '661199d8768a' +revision = "ac35c979311a" +down_revision = "661199d8768a" branch_labels = None depends_on = None @@ -17,11 +17,12 @@ import sqlalchemy as sa def upgrade(): - op.drop_column('user', 'activation_key') - op.add_column('user', sa.Column('enabled', sa.Boolean(), default=False)) + op.drop_column("user", "activation_key") + op.add_column("user", sa.Column("enabled", sa.Boolean(), default=False)) def downgrade(): - op.drop_column('user', 'enabled') - op.add_column('user', sa.Column('activation_key', sa.String(), - nullable=False, default='')) + op.drop_column("user", "enabled") + op.add_column( + "user", sa.Column("activation_key", sa.String(), nullable=False, default="") + ) diff --git a/migrations/versions/b329a1a7366f_add_new_tables_for_the_bookmarks_and_.py b/migrations/versions/b329a1a7366f_add_new_tables_for_the_bookmarks_and_.py index 8f2b015c..20c760e9 100644 --- a/migrations/versions/b329a1a7366f_add_new_tables_for_the_bookmarks_and_.py +++ b/migrations/versions/b329a1a7366f_add_new_tables_for_the_bookmarks_and_.py @@ -7,8 +7,8 @@ Create Date: 2017-05-23 21:42:37.636307 """ # revision identifiers, used by Alembic. -revision = 'b329a1a7366f' -down_revision = '2c5cc05216fa' +revision = "b329a1a7366f" +down_revision = "2c5cc05216fa" branch_labels = None depends_on = None @@ -18,48 +18,47 @@ import sqlalchemy as sa def upgrade(): - op.drop_table('tag') - op.create_table('article_tag', - sa.Column('text', sa.String(), nullable=False), - sa.Column('article_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['article_id'], ['article.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('text', 'article_id') + op.drop_table("tag") + op.create_table( + "article_tag", + sa.Column("text", sa.String(), nullable=False), + sa.Column("article_id", sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(["article_id"], ["article.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("text", "article_id"), ) - op.create_table('bookmark', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('href', sa.String(), default=""), - sa.Column('title', sa.String(), default=""), - sa.Column('description', sa.String(), default=""), - sa.Column('shared', sa.Boolean(), default=False), - sa.Column('to_read', sa.Boolean(), default=False), - sa.Column('time', sa.DateTime(), default=datetime.utcnow), - sa.Column('user_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id') + op.create_table( + "bookmark", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("href", sa.String(), default=""), + sa.Column("title", sa.String(), default=""), + sa.Column("description", sa.String(), default=""), + sa.Column("shared", sa.Boolean(), default=False), + sa.Column("to_read", sa.Boolean(), default=False), + sa.Column("time", sa.DateTime(), default=datetime.utcnow), + sa.Column("user_id", sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(["user_id"], ["user.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("id"), ) - op.create_table('bookmark_tag', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('text', sa.String(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=False), - sa.Column('bookmark_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['bookmark_id'], ['bookmark.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id') + op.create_table( + "bookmark_tag", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("text", sa.String(), nullable=False), + sa.Column("user_id", sa.Integer(), nullable=False), + sa.Column("bookmark_id", sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(["bookmark_id"], ["bookmark.id"], ondelete="CASCADE"), + sa.ForeignKeyConstraint(["user_id"], ["user.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("id"), ) def downgrade(): - op.drop_table('article_tag') - op.drop_table('bookmark_tag') - op.drop_table('bookmark') - op.create_table('tag', - sa.Column('text', sa.String(), nullable=False), - sa.Column('article_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['article_id'], ['article.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('text', 'article_id') + op.drop_table("article_tag") + op.drop_table("bookmark_tag") + op.drop_table("bookmark") + op.create_table( + "tag", + sa.Column("text", sa.String(), nullable=False), + sa.Column("article_id", sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(["article_id"], ["article.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("text", "article_id"), ) diff --git a/migrations/versions/bdd38bd755cb_remove_email_attribute_from_users_.py b/migrations/versions/bdd38bd755cb_remove_email_attribute_from_users_.py index a4d24ff5..47ffb371 100644 --- a/migrations/versions/bdd38bd755cb_remove_email_attribute_from_users_.py +++ b/migrations/versions/bdd38bd755cb_remove_email_attribute_from_users_.py @@ -7,8 +7,8 @@ Create Date: 2018-04-04 23:26:52.517804 """ # revision identifiers, used by Alembic. -revision = 'bdd38bd755cb' -down_revision = 'b329a1a7366f' +revision = "bdd38bd755cb" +down_revision = "b329a1a7366f" branch_labels = None depends_on = None @@ -17,9 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.drop_column('user', 'email') + op.drop_column("user", "email") def downgrade(): - op.add_column('user', sa.Column('email', sa.String(254), unique=True, - index=True)) + op.add_column("user", sa.Column("email", sa.String(254), unique=True, index=True)) diff --git a/migrations/versions/be2b8b6f33dd_add_column_private_to_the_feeds_table.py b/migrations/versions/be2b8b6f33dd_add_column_private_to_the_feeds_table.py index c41aa12a..15244b09 100644 --- a/migrations/versions/be2b8b6f33dd_add_column_private_to_the_feeds_table.py +++ b/migrations/versions/be2b8b6f33dd_add_column_private_to_the_feeds_table.py @@ -7,8 +7,8 @@ Create Date: 2016-10-24 13:28:55.964803 """ # revision identifiers, used by Alembic. -revision = 'be2b8b6f33dd' -down_revision = 'fa10b0bdd045' +revision = "be2b8b6f33dd" +down_revision = "fa10b0bdd045" branch_labels = None depends_on = None @@ -17,9 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.add_column('feed', sa.Column('private', - sa.Boolean(), default=False)) + op.add_column("feed", sa.Column("private", sa.Boolean(), default=False)) def downgrade(): - op.drop_column('feed', 'private') + op.drop_column("feed", "private") 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 639e3988..08969d98 100644 --- a/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py +++ b/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py @@ -7,8 +7,8 @@ Create Date: 2015-03-04 22:59:44.665979 """ # revision identifiers, used by Alembic. -revision = 'cde34831ea' -down_revision = '1b750a389c22' +revision = "cde34831ea" +down_revision = "1b750a389c22" import conf from datetime import datetime @@ -19,26 +19,47 @@ import sqlalchemy as sa def upgrade(): unix_start = datetime(1970, 1, 1) # commands auto generated by Alembic - please adjust! ### - op.add_column('feed', sa.Column('error_count', sa.Integer(), nullable=True, - default=0, server_default="0")) - op.add_column('feed', sa.Column('last_error', sa.String(), nullable=True)) - op.add_column('feed', sa.Column('last_modified', sa.DateTime(), - nullable=True, default=unix_start, server_default=str(unix_start))) - op.add_column('feed', sa.Column('last_retrieved', sa.DateTime(), - nullable=True, default=unix_start, server_default=str(unix_start))) - op.add_column('feed', sa.Column('etag', sa.String(), nullable=True)) - op.add_column('user', sa.Column('refresh_rate', sa.Integer(), - nullable=True, default=60)) + op.add_column( + "feed", + sa.Column( + "error_count", sa.Integer(), nullable=True, default=0, server_default="0" + ), + ) + op.add_column("feed", sa.Column("last_error", sa.String(), nullable=True)) + op.add_column( + "feed", + sa.Column( + "last_modified", + sa.DateTime(), + nullable=True, + default=unix_start, + server_default=str(unix_start), + ), + ) + op.add_column( + "feed", + sa.Column( + "last_retrieved", + sa.DateTime(), + nullable=True, + default=unix_start, + server_default=str(unix_start), + ), + ) + op.add_column("feed", sa.Column("etag", sa.String(), nullable=True)) + op.add_column( + "user", sa.Column("refresh_rate", sa.Integer(), nullable=True, default=60) + ) # end Alembic commands ### def downgrade(): # commands auto generated by Alembic - please adjust! ### - 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') + 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 ### diff --git a/migrations/versions/f700c4237e9d_remove_refresh_rate_column_from_the_.py b/migrations/versions/f700c4237e9d_remove_refresh_rate_column_from_the_.py index aca0d1ba..c69e5fe8 100644 --- a/migrations/versions/f700c4237e9d_remove_refresh_rate_column_from_the_.py +++ b/migrations/versions/f700c4237e9d_remove_refresh_rate_column_from_the_.py @@ -7,8 +7,8 @@ Create Date: 2016-10-05 08:47:51.384069 """ # revision identifiers, used by Alembic. -revision = 'f700c4237e9d' -down_revision = '16f8fc3cf0cc' +revision = "f700c4237e9d" +down_revision = "16f8fc3cf0cc" branch_labels = None depends_on = None @@ -17,9 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.drop_column('user', 'refresh_rate') + op.drop_column("user", "refresh_rate") def downgrade(): - op.add_column('user', sa.Column('refresh_rate', sa.Integer(), - default=60)) + op.add_column("user", sa.Column("refresh_rate", sa.Integer(), default=60)) diff --git a/migrations/versions/fa10b0bdd045_add_bio_column_to_user_table.py b/migrations/versions/fa10b0bdd045_add_bio_column_to_user_table.py index 2d839626..80ee71fc 100644 --- a/migrations/versions/fa10b0bdd045_add_bio_column_to_user_table.py +++ b/migrations/versions/fa10b0bdd045_add_bio_column_to_user_table.py @@ -7,8 +7,8 @@ Create Date: 2016-10-07 10:43:04.428178 """ # revision identifiers, used by Alembic. -revision = 'fa10b0bdd045' -down_revision = '8bf5694c0b9e' +revision = "fa10b0bdd045" +down_revision = "8bf5694c0b9e" branch_labels = None depends_on = None @@ -17,9 +17,8 @@ import sqlalchemy as sa def upgrade(): - op.add_column('user', sa.Column('bio', - sa.String(5000), default="")) + op.add_column("user", sa.Column("bio", sa.String(5000), default="")) def downgrade(): - op.drop_column('user', 'bio') + op.drop_column("user", "bio") |