parent
8d05d40cf7
commit
762cd56e64
10 changed files with 155 additions and 112 deletions
|
@ -0,0 +1,39 @@
|
|||
"""Add new DerivedStorageForImage table
|
||||
|
||||
Revision ID: 5a2445ffe21b
|
||||
Revises: 1b2bb93ceb82
|
||||
Create Date: 2015-11-24 11:58:02.956687
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5a2445ffe21b'
|
||||
down_revision = '1b2bb93ceb82'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
def upgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('derivedstorageforimage',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('source_image_id', sa.Integer(), nullable=False),
|
||||
sa.Column('derivative_id', sa.Integer(), nullable=False),
|
||||
sa.Column('transformation_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['derivative_id'], ['imagestorage.id'], name=op.f('fk_derivedstorageforimage_derivative_id_imagestorage')),
|
||||
sa.ForeignKeyConstraint(['source_image_id'], ['image.id'], name=op.f('fk_derivedstorageforimage_source_image_id_image')),
|
||||
sa.ForeignKeyConstraint(['transformation_id'], ['imagestoragetransformation.id'], name=op.f('fk_derivedstorageforimage_transformation_constraint')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_derivedstorageforimage'))
|
||||
)
|
||||
op.create_index('derivedstorageforimage_derivative_id', 'derivedstorageforimage', ['derivative_id'], unique=False)
|
||||
op.create_index('derivedstorageforimage_source_image_id', 'derivedstorageforimage', ['source_image_id'], unique=False)
|
||||
op.create_index('derivedstorageforimage_source_image_id_transformation_id', 'derivedstorageforimage', ['source_image_id', 'transformation_id'], unique=True)
|
||||
op.create_index('derivedstorageforimage_transformation_id', 'derivedstorageforimage', ['transformation_id'], unique=False)
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('derivedstorageforimage')
|
||||
### end Alembic commands ###
|
Reference in a new issue