aboutsummaryrefslogtreecommitdiff
path: root/src/migrations
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-03 07:11:37 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-03 07:11:37 +0100
commitda929a367c3f1fe5f3546be82e47111c2fa84ad3 (patch)
tree89380f41b802256d8fdbf724e7d9e63b48209b4a /src/migrations
parentMerge pull request #30 from jaesivsm/master (diff)
parentwriting a bit of doc, moving crawler together (diff)
downloadnewspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.tar.gz
newspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.tar.bz2
newspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.zip
Merge pull request #31 from jaesivsm/master
redoing UI
Diffstat (limited to 'src/migrations')
-rw-r--r--src/migrations/alembic.ini45
-rw-r--r--src/migrations/versions/3f83bfe93fc_adding_category.py42
-rw-r--r--src/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py2
3 files changed, 88 insertions, 1 deletions
diff --git a/src/migrations/alembic.ini b/src/migrations/alembic.ini
new file mode 100644
index 00000000..f8ed4801
--- /dev/null
+++ b/src/migrations/alembic.ini
@@ -0,0 +1,45 @@
+# A generic, single database configuration.
+
+[alembic]
+# template used to generate migration files
+# file_template = %%(rev)s_%%(slug)s
+
+# set to 'true' to run the environment during
+# the 'revision' command, regardless of autogenerate
+# revision_environment = false
+
+
+# Logging configuration
+[loggers]
+keys = root,sqlalchemy,alembic
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = console
+qualname =
+
+[logger_sqlalchemy]
+level = WARN
+handlers =
+qualname = sqlalchemy.engine
+
+[logger_alembic]
+level = INFO
+handlers =
+qualname = alembic
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(levelname)-5.5s [%(name)s] %(message)s
+datefmt = %H:%M:%S
diff --git a/src/migrations/versions/3f83bfe93fc_adding_category.py b/src/migrations/versions/3f83bfe93fc_adding_category.py
new file mode 100644
index 00000000..b8412418
--- /dev/null
+++ b/src/migrations/versions/3f83bfe93fc_adding_category.py
@@ -0,0 +1,42 @@
+"""adding category
+
+Revision ID: 3f83bfe93fc
+Revises: 25ca960a207
+Create Date: 2015-09-01 14:15:04.212563
+"""
+
+# revision identifiers, used by Alembic.
+revision = '3f83bfe93fc'
+down_revision = 'db64b766362f'
+
+import conf
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+ op.create_table('category',
+ sa.Column('id', sa.Integer(), nullable=False),
+ sa.Column('name', sa.String(), nullable=True),
+ sa.Column('user_id', sa.Integer(), nullable=True),
+ sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
+ sa.PrimaryKeyConstraint('id'))
+ op.add_column('article',
+ sa.Column('category_id', sa.Integer(), nullable=True))
+ op.add_column('feed',
+ sa.Column('category_id', sa.Integer(), nullable=True))
+ if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI:
+ op.create_foreign_key(None, 'article', 'category',
+ ['category_id'], ['id'])
+ op.create_foreign_key(None, 'feed', 'category',
+ ['category_id'], ['id'])
+
+
+def downgrade():
+ if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI:
+ op.drop_constraint(None, 'feed', type_='foreignkey')
+ op.drop_constraint(None, 'feed', type_='foreignkey')
+ op.drop_column('feed', 'category_id')
+ op.drop_constraint(None, 'article', type_='foreignkey')
+ op.drop_column('article', 'category_id')
+ op.drop_table('category')
diff --git a/src/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py b/src/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py
index 116fdaa1..8763f925 100644
--- a/src/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py
+++ b/src/migrations/versions/cde34831ea_adding_feed_and_user_attributes_for_.py
@@ -9,7 +9,7 @@ Create Date: 2015-03-04 22:59:44.665979
# revision identifiers, used by Alembic.
revision = 'cde34831ea'
down_revision = '1b750a389c22'
-
+import conf
from datetime import datetime
from alembic import op
bgstack15