diff --git a/migrations/README b/migrations/README deleted file mode 100755 index 98e4f9c..0000000 --- a/migrations/README +++ /dev/null @@ -1 +0,0 @@ -Generic single-database configuration. \ No newline at end of file diff --git a/migrations/alembic.ini b/migrations/alembic.ini deleted file mode 100644 index f8ed480..0000000 --- a/migrations/alembic.ini +++ /dev/null @@ -1,45 +0,0 @@ -# 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/migrations/env.py b/migrations/env.py deleted file mode 100644 index 70961ce..0000000 --- a/migrations/env.py +++ /dev/null @@ -1,73 +0,0 @@ -from __future__ import with_statement -from alembic import context -from sqlalchemy import engine_from_config, pool -from logging.config import fileConfig - -# this is the Alembic Config object, which provides -# access to the values within the .ini file in use. -config = context.config - -# Interpret the config file for Python logging. -# This line sets up loggers basically. -fileConfig(config.config_file_name) - -# add your model's MetaData object here -# for 'autogenerate' support -# from myapp import mymodel -# target_metadata = mymodel.Base.metadata -from flask import current_app -config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_DATABASE_URI')) -target_metadata = current_app.extensions['migrate'].db.metadata - -# other values from the config, defined by the needs of env.py, -# can be acquired: -# my_important_option = config.get_main_option("my_important_option") -# ... etc. - -def run_migrations_offline(): - """Run migrations in 'offline' mode. - - This configures the context with just a URL - and not an Engine, though an Engine is acceptable - here as well. By skipping the Engine creation - we don't even need a DBAPI to be available. - - Calls to context.execute() here emit the given string to the - script output. - - """ - url = config.get_main_option("sqlalchemy.url") - context.configure(url=url) - - with context.begin_transaction(): - context.run_migrations() - -def run_migrations_online(): - """Run migrations in 'online' mode. - - In this scenario we need to create an Engine - and associate a connection with the context. - - """ - engine = engine_from_config( - config.get_section(config.config_ini_section), - prefix='sqlalchemy.', - poolclass=pool.NullPool) - - connection = engine.connect() - context.configure( - connection=connection, - target_metadata=target_metadata - ) - - try: - with context.begin_transaction(): - context.run_migrations() - finally: - connection.close() - -if context.is_offline_mode(): - run_migrations_offline() -else: - run_migrations_online() - diff --git a/migrations/script.py.mako b/migrations/script.py.mako deleted file mode 100755 index 9570201..0000000 --- a/migrations/script.py.mako +++ /dev/null @@ -1,22 +0,0 @@ -"""${message} - -Revision ID: ${up_revision} -Revises: ${down_revision} -Create Date: ${create_date} - -""" - -# revision identifiers, used by Alembic. -revision = ${repr(up_revision)} -down_revision = ${repr(down_revision)} - -from alembic import op -import sqlalchemy as sa -${imports if imports else ""} - -def upgrade(): - ${upgrades if upgrades else "pass"} - - -def downgrade(): - ${downgrades if downgrades else "pass"} diff --git a/migrations/versions/3c8686a285f5_.py b/migrations/versions/3c8686a285f5_.py deleted file mode 100644 index f312f44..0000000 --- a/migrations/versions/3c8686a285f5_.py +++ /dev/null @@ -1,218 +0,0 @@ -"""empty message - -Revision ID: 3c8686a285f5 -Revises: None -Create Date: 2014-05-21 23:43:13.065858 - -""" - -# revision identifiers, used by Alembic. -revision = '3c8686a285f5' -down_revision = None - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ### commands auto generated by Alembic - please adjust! ### - op.create_table('item', - sa.Column('created', sa.DateTime(), nullable=True), - sa.Column('modified', sa.DateTime(), nullable=True), - sa.Column('id', sa.String(length=32), nullable=False), - sa.Column('info', sa.PickleType(), nullable=True), - sa.Column('meta', sa.PickleType(), nullable=True), - sa.Column('added', sa.DateTime(), nullable=True), - sa.Column('accessed', sa.DateTime(), nullable=True), - sa.Column('timesaccessed', sa.Integer(), nullable=True), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('changelog', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('created', sa.DateTime(), nullable=True), - sa.Column('timestamp', sa.BigInteger(), nullable=True), - sa.Column('user_id', sa.String(length=43), nullable=True), - sa.Column('revision', sa.BigInteger(), nullable=True), - sa.Column('data', sa.Text(), nullable=True), - sa.Column('sig', sa.String(length=96), nullable=True), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('user', - sa.Column('created', sa.DateTime(), nullable=True), - sa.Column('modified', sa.DateTime(), nullable=True), - sa.Column('id', sa.String(length=43), nullable=False), - sa.Column('info', sa.PickleType(), nullable=True), - sa.Column('nickname', sa.String(length=256), nullable=True), - sa.Column('pending', sa.String(length=64), nullable=True), - sa.Column('queued', sa.Boolean(), nullable=True), - sa.Column('peered', sa.Boolean(), nullable=True), - sa.Column('online', sa.Boolean(), nullable=True), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('nickname') - ) - op.create_table('metadata', - sa.Column('created', sa.DateTime(), nullable=True), - sa.Column('modified', sa.DateTime(), nullable=True), - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('key', sa.String(length=256), nullable=True), - sa.Column('value', sa.String(length=256), nullable=True), - sa.Column('data', sa.PickleType(), nullable=True), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('person', - sa.Column('name', sa.String(length=1024), nullable=False), - sa.Column('sortname', sa.String(), nullable=True), - sa.Column('numberofnames', sa.Integer(), nullable=True), - sa.PrimaryKeyConstraint('name') - ) - op.create_table('transfer', - sa.Column('item_id', sa.String(length=32), nullable=False), - sa.Column('added', sa.DateTime(), nullable=True), - sa.Column('progress', sa.Float(), nullable=True), - sa.ForeignKeyConstraint(['item_id'], ['item.id'], ), - sa.PrimaryKeyConstraint('item_id') - ) - op.create_table('find', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('item_id', sa.String(length=32), nullable=True), - sa.Column('key', sa.String(length=200), nullable=True), - sa.Column('value', sa.Text(), nullable=True), - sa.Column('findvalue', sa.Text(), nullable=True), - sa.ForeignKeyConstraint(['item_id'], ['item.id'], ), - sa.PrimaryKeyConstraint('id') - ) - op.create_index(op.f('ix_find_key'), 'find', ['key'], unique=False) - op.create_table('list', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(), nullable=True), - sa.Column('index_', sa.Integer(), nullable=True), - sa.Column('type', sa.String(length=64), nullable=True), - sa.Column('query', sa.PickleType(), nullable=True), - sa.Column('user_id', sa.String(length=43), nullable=True), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('useritem', - sa.Column('user_id', sa.String(length=43), nullable=True), - sa.Column('item_id', sa.String(length=32), nullable=True), - sa.ForeignKeyConstraint(['item_id'], ['item.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ) - ) - op.create_table('sort', - sa.Column('item_id', sa.String(length=32), nullable=False), - sa.Column('title', sa.String(length=1000), nullable=True), - sa.Column('author', sa.String(length=1000), nullable=True), - sa.Column('publisher', sa.String(length=1000), nullable=True), - sa.Column('place', sa.String(length=1000), nullable=True), - sa.Column('country', sa.String(length=1000), nullable=True), - sa.Column('date', sa.String(length=1000), nullable=True), - sa.Column('language', sa.String(length=1000), nullable=True), - sa.Column('pages', sa.BigInteger(), nullable=True), - sa.Column('classification', sa.String(length=1000), nullable=True), - sa.Column('extension', sa.String(length=1000), nullable=True), - sa.Column('size', sa.BigInteger(), nullable=True), - sa.Column('created', sa.DateTime(), nullable=True), - sa.Column('added', sa.DateTime(), nullable=True), - sa.Column('modified', sa.DateTime(), nullable=True), - sa.Column('accessed', sa.DateTime(), nullable=True), - sa.Column('timesaccessed', sa.BigInteger(), nullable=True), - sa.Column('mediastate', sa.String(length=1000), nullable=True), - sa.Column('transferadded', sa.DateTime(), nullable=True), - sa.Column('transferprogress', sa.Float(), nullable=True), - sa.Column('id', sa.String(length=1000), nullable=True), - sa.Column('isbn', sa.String(length=1000), nullable=True), - sa.Column('asin', sa.String(length=1000), nullable=True), - sa.Column('lccn', sa.String(length=1000), nullable=True), - sa.Column('olid', sa.String(length=1000), nullable=True), - sa.Column('oclc', sa.String(length=1000), nullable=True), - sa.Column('random', sa.BigInteger(), nullable=True), - sa.ForeignKeyConstraint(['item_id'], ['item.id'], ), - sa.PrimaryKeyConstraint('item_id') - ) - op.create_index(op.f('ix_sort_accessed'), 'sort', ['accessed'], unique=False) - op.create_index(op.f('ix_sort_added'), 'sort', ['added'], unique=False) - op.create_index(op.f('ix_sort_asin'), 'sort', ['asin'], unique=False) - op.create_index(op.f('ix_sort_author'), 'sort', ['author'], unique=False) - op.create_index(op.f('ix_sort_classification'), 'sort', ['classification'], unique=False) - op.create_index(op.f('ix_sort_country'), 'sort', ['country'], unique=False) - op.create_index(op.f('ix_sort_created'), 'sort', ['created'], unique=False) - op.create_index(op.f('ix_sort_date'), 'sort', ['date'], unique=False) - op.create_index(op.f('ix_sort_extension'), 'sort', ['extension'], unique=False) - op.create_index(op.f('ix_sort_id'), 'sort', ['id'], unique=False) - op.create_index(op.f('ix_sort_isbn'), 'sort', ['isbn'], unique=False) - op.create_index(op.f('ix_sort_language'), 'sort', ['language'], unique=False) - op.create_index(op.f('ix_sort_lccn'), 'sort', ['lccn'], unique=False) - op.create_index(op.f('ix_sort_mediastate'), 'sort', ['mediastate'], unique=False) - op.create_index(op.f('ix_sort_modified'), 'sort', ['modified'], unique=False) - op.create_index(op.f('ix_sort_oclc'), 'sort', ['oclc'], unique=False) - op.create_index(op.f('ix_sort_olid'), 'sort', ['olid'], unique=False) - op.create_index(op.f('ix_sort_pages'), 'sort', ['pages'], unique=False) - op.create_index(op.f('ix_sort_place'), 'sort', ['place'], unique=False) - op.create_index(op.f('ix_sort_publisher'), 'sort', ['publisher'], unique=False) - op.create_index(op.f('ix_sort_random'), 'sort', ['random'], unique=False) - op.create_index(op.f('ix_sort_size'), 'sort', ['size'], unique=False) - op.create_index(op.f('ix_sort_timesaccessed'), 'sort', ['timesaccessed'], unique=False) - op.create_index(op.f('ix_sort_title'), 'sort', ['title'], unique=False) - op.create_index(op.f('ix_sort_transferadded'), 'sort', ['transferadded'], unique=False) - op.create_index(op.f('ix_sort_transferprogress'), 'sort', ['transferprogress'], unique=False) - op.create_table('file', - sa.Column('created', sa.DateTime(), nullable=True), - sa.Column('modified', sa.DateTime(), nullable=True), - sa.Column('sha1', sa.String(length=32), nullable=False), - sa.Column('path', sa.String(length=2048), nullable=True), - sa.Column('info', sa.PickleType(), nullable=True), - sa.Column('item_id', sa.String(length=32), nullable=True), - sa.ForeignKeyConstraint(['item_id'], ['item.id'], ), - sa.PrimaryKeyConstraint('sha1') - ) - op.create_table('listitem', - sa.Column('list_id', sa.Integer(), nullable=True), - sa.Column('item_id', sa.String(length=32), nullable=True), - sa.ForeignKeyConstraint(['item_id'], ['item.id'], ), - sa.ForeignKeyConstraint(['list_id'], ['list.id'], ) - ) - ### end Alembic commands ### - - -def downgrade(): - ### commands auto generated by Alembic - please adjust! ### - op.drop_table('listitem') - op.drop_table('file') - op.drop_index(op.f('ix_sort_transferprogress'), table_name='sort') - op.drop_index(op.f('ix_sort_transferadded'), table_name='sort') - op.drop_index(op.f('ix_sort_title'), table_name='sort') - op.drop_index(op.f('ix_sort_timesaccessed'), table_name='sort') - op.drop_index(op.f('ix_sort_size'), table_name='sort') - op.drop_index(op.f('ix_sort_random'), table_name='sort') - op.drop_index(op.f('ix_sort_publisher'), table_name='sort') - op.drop_index(op.f('ix_sort_place'), table_name='sort') - op.drop_index(op.f('ix_sort_pages'), table_name='sort') - op.drop_index(op.f('ix_sort_olid'), table_name='sort') - op.drop_index(op.f('ix_sort_oclc'), table_name='sort') - op.drop_index(op.f('ix_sort_modified'), table_name='sort') - op.drop_index(op.f('ix_sort_mediastate'), table_name='sort') - op.drop_index(op.f('ix_sort_lccn'), table_name='sort') - op.drop_index(op.f('ix_sort_language'), table_name='sort') - op.drop_index(op.f('ix_sort_isbn'), table_name='sort') - op.drop_index(op.f('ix_sort_id'), table_name='sort') - op.drop_index(op.f('ix_sort_extension'), table_name='sort') - op.drop_index(op.f('ix_sort_date'), table_name='sort') - op.drop_index(op.f('ix_sort_created'), table_name='sort') - op.drop_index(op.f('ix_sort_country'), table_name='sort') - op.drop_index(op.f('ix_sort_classification'), table_name='sort') - op.drop_index(op.f('ix_sort_author'), table_name='sort') - op.drop_index(op.f('ix_sort_asin'), table_name='sort') - op.drop_index(op.f('ix_sort_added'), table_name='sort') - op.drop_index(op.f('ix_sort_accessed'), table_name='sort') - op.drop_table('sort') - op.drop_table('useritem') - op.drop_table('list') - op.drop_index(op.f('ix_find_key'), table_name='find') - op.drop_table('find') - op.drop_table('transfer') - op.drop_table('person') - op.drop_table('metadata') - op.drop_table('user') - op.drop_table('changelog') - op.drop_table('item') - ### end Alembic commands ### diff --git a/migrations/versions/4e27d03ac6f9_.py b/migrations/versions/4e27d03ac6f9_.py deleted file mode 100644 index 5a1f476..0000000 --- a/migrations/versions/4e27d03ac6f9_.py +++ /dev/null @@ -1,26 +0,0 @@ -"""empty message - -Revision ID: 4e27d03ac6f9 -Revises: 3c8686a285f5 -Create Date: 2014-05-27 01:37:54.288697 - -""" - -# revision identifiers, used by Alembic. -revision = '4e27d03ac6f9' -down_revision = '3c8686a285f5' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ### commands auto generated by Alembic - please adjust! ### - op.create_index(op.f('ix_find_findvalue'), 'find', ['findvalue'], unique=False) - ### end Alembic commands ### - - -def downgrade(): - ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f('ix_find_findvalue'), table_name='find') - ### end Alembic commands ###