This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/data/migrations/versions/33bd39ef5ed6_backport_v2_db_changes.py
2015-10-23 13:49:23 -04:00

43 lines
1.8 KiB
Python

"""Backport v2 db changes.
Revision ID: 33bd39ef5ed6
Revises: 127905a52fdd
Create Date: 2015-10-23 12:34:22.776542
"""
# revision identifiers, used by Alembic.
revision = '33bd39ef5ed6'
down_revision = '127905a52fdd'
from alembic import op
import sqlalchemy as sa
def upgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.create_table('blobupload',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('repository_id', sa.Integer(), nullable=False),
sa.Column('uuid', sa.String(length=255), nullable=False),
sa.Column('byte_count', sa.Integer(), nullable=False),
sa.Column('sha_state', sa.Text(), nullable=True),
sa.Column('location_id', sa.Integer(), nullable=False),
sa.Column('storage_metadata', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['location_id'], ['imagestoragelocation.id'], name=op.f('fk_blobupload_location_id_imagestoragelocation')),
sa.ForeignKeyConstraint(['repository_id'], ['repository.id'], name=op.f('fk_blobupload_repository_id_repository')),
sa.PrimaryKeyConstraint('id', name=op.f('pk_blobupload'))
)
op.create_index('blobupload_location_id', 'blobupload', ['location_id'], unique=False)
op.create_index('blobupload_repository_id', 'blobupload', ['repository_id'], unique=False)
op.create_index('blobupload_repository_id_uuid', 'blobupload', ['repository_id', 'uuid'], unique=True)
op.create_index('blobupload_uuid', 'blobupload', ['uuid'], unique=True)
op.add_column(u'imagestorage', sa.Column('cas_path', sa.Boolean(), nullable=False, server_default="0"))
### end Alembic commands ###
def downgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.drop_column(u'imagestorage', 'cas_path')
op.drop_table('blobupload')
### end Alembic commands ###