Add schema2 media types
This commit is contained in:
parent
30f072aeff
commit
d77d383e46
1 changed files with 31 additions and 0 deletions
|
@ -0,0 +1,31 @@
|
|||
from image.docker.schema2 import DOCKER_SCHEMA2_CONTENT_TYPES
|
||||
|
||||
"""Add schema2 media types
|
||||
|
||||
Revision ID: c00a1f15968b
|
||||
Revises: 67f0abd172ae
|
||||
Create Date: 2018-11-13 09:20:21.968503
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c00a1f15968b'
|
||||
down_revision = '67f0abd172ae'
|
||||
|
||||
from alembic import op
|
||||
|
||||
def upgrade(tables, tester):
|
||||
for media_type in DOCKER_SCHEMA2_CONTENT_TYPES:
|
||||
op.bulk_insert(tables.mediatype,
|
||||
[
|
||||
{'name': media_type},
|
||||
])
|
||||
|
||||
|
||||
def downgrade(tables, tester):
|
||||
for media_type in DOCKER_SCHEMA2_CONTENT_TYPES:
|
||||
op.execute(tables
|
||||
.mediatype
|
||||
.delete()
|
||||
.where(tables.
|
||||
mediatype.c.name == op.inline_literal(media_type)))
|
Reference in a new issue