openmedialibrary/migrations/versions/348720abe06e_.py

215 lines
11 KiB
Python
Raw Normal View History

2014-05-04 17:26:43 +00:00
"""empty message
Revision ID: 348720abe06e
Revises: None
Create Date: 2014-05-11 12:24:57.346130
"""
# revision identifiers, used by Alembic.
revision = '348720abe06e'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
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('peered', sa.Boolean(), nullable=True),
sa.Column('online', sa.Boolean(), 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('work',
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('meta', sa.PickleType(), 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('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('list',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=True),
sa.Column('position', 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('edition',
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('meta', sa.PickleType(), nullable=True),
sa.Column('work_id', sa.String(length=32), nullable=True),
sa.ForeignKeyConstraint(['work_id'], ['work.id'], ),
sa.PrimaryKeyConstraint('id')
)
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.Column('transferadded', sa.DateTime(), nullable=True),
sa.Column('transferprogress', sa.Float(), nullable=True),
sa.Column('edition_id', sa.String(length=32), nullable=True),
sa.Column('work_id', sa.String(length=32), nullable=True),
sa.Column('sort_title', sa.String(length=1000), nullable=True),
sa.Column('sort_author', sa.String(length=1000), nullable=True),
sa.Column('sort_language', sa.String(length=1000), nullable=True),
sa.Column('sort_publisher', sa.String(length=1000), nullable=True),
sa.Column('sort_place', sa.String(length=1000), nullable=True),
sa.Column('sort_country', sa.String(length=1000), nullable=True),
sa.Column('sort_date', sa.String(length=1000), nullable=True),
sa.Column('sort_pages', sa.BigInteger(), nullable=True),
sa.Column('sort_classification', sa.String(length=1000), nullable=True),
sa.Column('sort_id', sa.String(length=1000), nullable=True),
sa.Column('sort_isbn10', sa.String(length=1000), nullable=True),
sa.Column('sort_isbn13', sa.String(length=1000), nullable=True),
sa.Column('sort_lccn', sa.String(length=1000), nullable=True),
sa.Column('sort_olid', sa.String(length=1000), nullable=True),
sa.Column('sort_oclc', sa.String(length=1000), nullable=True),
sa.Column('sort_extension', sa.String(length=1000), nullable=True),
sa.Column('sort_size', sa.BigInteger(), nullable=True),
sa.Column('sort_created', sa.DateTime(), nullable=True),
sa.Column('sort_added', sa.DateTime(), nullable=True),
sa.Column('sort_modified', sa.DateTime(), nullable=True),
sa.Column('sort_accessed', sa.DateTime(), nullable=True),
sa.Column('sort_timesaccessed', sa.BigInteger(), nullable=True),
sa.Column('sort_mediastate', sa.String(length=1000), nullable=True),
sa.Column('sort_transferadded', sa.DateTime(), nullable=True),
sa.Column('sort_transferprogress', sa.Float(), nullable=True),
sa.Column('sort_random', sa.BigInteger(), nullable=True),
sa.ForeignKeyConstraint(['edition_id'], ['edition.id'], ),
sa.ForeignKeyConstraint(['work_id'], ['work.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_item_sort_accessed'), 'item', ['sort_accessed'], unique=False)
op.create_index(op.f('ix_item_sort_added'), 'item', ['sort_added'], unique=False)
op.create_index(op.f('ix_item_sort_author'), 'item', ['sort_author'], unique=False)
op.create_index(op.f('ix_item_sort_classification'), 'item', ['sort_classification'], unique=False)
op.create_index(op.f('ix_item_sort_country'), 'item', ['sort_country'], unique=False)
op.create_index(op.f('ix_item_sort_created'), 'item', ['sort_created'], unique=False)
op.create_index(op.f('ix_item_sort_date'), 'item', ['sort_date'], unique=False)
op.create_index(op.f('ix_item_sort_extension'), 'item', ['sort_extension'], unique=False)
op.create_index(op.f('ix_item_sort_id'), 'item', ['sort_id'], unique=False)
op.create_index(op.f('ix_item_sort_isbn10'), 'item', ['sort_isbn10'], unique=False)
op.create_index(op.f('ix_item_sort_isbn13'), 'item', ['sort_isbn13'], unique=False)
op.create_index(op.f('ix_item_sort_language'), 'item', ['sort_language'], unique=False)
op.create_index(op.f('ix_item_sort_lccn'), 'item', ['sort_lccn'], unique=False)
op.create_index(op.f('ix_item_sort_mediastate'), 'item', ['sort_mediastate'], unique=False)
op.create_index(op.f('ix_item_sort_modified'), 'item', ['sort_modified'], unique=False)
op.create_index(op.f('ix_item_sort_oclc'), 'item', ['sort_oclc'], unique=False)
op.create_index(op.f('ix_item_sort_olid'), 'item', ['sort_olid'], unique=False)
op.create_index(op.f('ix_item_sort_pages'), 'item', ['sort_pages'], unique=False)
op.create_index(op.f('ix_item_sort_place'), 'item', ['sort_place'], unique=False)
op.create_index(op.f('ix_item_sort_publisher'), 'item', ['sort_publisher'], unique=False)
op.create_index(op.f('ix_item_sort_random'), 'item', ['sort_random'], unique=False)
op.create_index(op.f('ix_item_sort_size'), 'item', ['sort_size'], unique=False)
op.create_index(op.f('ix_item_sort_timesaccessed'), 'item', ['sort_timesaccessed'], unique=False)
op.create_index(op.f('ix_item_sort_title'), 'item', ['sort_title'], unique=False)
op.create_index(op.f('ix_item_sort_transferadded'), 'item', ['sort_transferadded'], unique=False)
op.create_index(op.f('ix_item_sort_transferprogress'), 'item', ['sort_transferprogress'], unique=False)
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('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.ForeignKeyConstraint(['item_id'], ['item.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_find_key'), 'find', ['key'], 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_find_key'), table_name='find')
op.drop_table('find')
op.drop_table('useritem')
op.drop_index(op.f('ix_item_sort_transferprogress'), table_name='item')
op.drop_index(op.f('ix_item_sort_transferadded'), table_name='item')
op.drop_index(op.f('ix_item_sort_title'), table_name='item')
op.drop_index(op.f('ix_item_sort_timesaccessed'), table_name='item')
op.drop_index(op.f('ix_item_sort_size'), table_name='item')
op.drop_index(op.f('ix_item_sort_random'), table_name='item')
op.drop_index(op.f('ix_item_sort_publisher'), table_name='item')
op.drop_index(op.f('ix_item_sort_place'), table_name='item')
op.drop_index(op.f('ix_item_sort_pages'), table_name='item')
op.drop_index(op.f('ix_item_sort_olid'), table_name='item')
op.drop_index(op.f('ix_item_sort_oclc'), table_name='item')
op.drop_index(op.f('ix_item_sort_modified'), table_name='item')
op.drop_index(op.f('ix_item_sort_mediastate'), table_name='item')
op.drop_index(op.f('ix_item_sort_lccn'), table_name='item')
op.drop_index(op.f('ix_item_sort_language'), table_name='item')
op.drop_index(op.f('ix_item_sort_isbn13'), table_name='item')
op.drop_index(op.f('ix_item_sort_isbn10'), table_name='item')
op.drop_index(op.f('ix_item_sort_id'), table_name='item')
op.drop_index(op.f('ix_item_sort_extension'), table_name='item')
op.drop_index(op.f('ix_item_sort_date'), table_name='item')
op.drop_index(op.f('ix_item_sort_created'), table_name='item')
op.drop_index(op.f('ix_item_sort_country'), table_name='item')
op.drop_index(op.f('ix_item_sort_classification'), table_name='item')
op.drop_index(op.f('ix_item_sort_author'), table_name='item')
op.drop_index(op.f('ix_item_sort_added'), table_name='item')
op.drop_index(op.f('ix_item_sort_accessed'), table_name='item')
op.drop_table('item')
op.drop_table('edition')
op.drop_table('list')
op.drop_table('changelog')
op.drop_table('work')
op.drop_table('person')
op.drop_table('user')
### end Alembic commands ###