Add a uniqueness hash to derived image storage to break caching over tags

This allows converted ACIs and squashed images to be unique based on the specified tag.

Fixes #92
This commit is contained in:
Joseph Schorr 2016-06-06 15:38:29 -04:00
parent a33a70a419
commit a43b741f1b
7 changed files with 119 additions and 40 deletions

View file

@ -0,0 +1,29 @@
"""Add uniqueness hash column for derived image storage
Revision ID: 1093d8b212bb
Revises: 0f17d94d11eb
Create Date: 2016-06-06 15:27:21.735669
"""
# revision identifiers, used by Alembic.
revision = '1093d8b212bb'
down_revision = '0f17d94d11eb'
from alembic import op
import sqlalchemy as sa
def upgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.drop_index('derivedstorageforimage_source_image_id_transformation_id', table_name='derivedstorageforimage')
op.add_column('derivedstorageforimage', sa.Column('uniqueness_hash', sa.String(length=255), nullable=True))
op.create_index('uniqueness_index', 'derivedstorageforimage', ['source_image_id', 'transformation_id', 'uniqueness_hash'], unique=True)
### end Alembic commands ###
def downgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.drop_index('uniqueness_index', table_name='derivedstorageforimage')
op.drop_column('derivedstorageforimage', 'uniqueness_hash')
op.create_index('derivedstorageforimage_source_image_id_transformation_id', 'derivedstorageforimage', ['source_image_id', 'transformation_id'], unique=True)
### end Alembic commands ###