From: Christopher Allan Webber Date: Sat, 12 Mar 2016 22:36:23 +0000 (-0800) Subject: Image media type initial migration. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2d8b42aab39d78ff93d228be9a94e7f5596ad482;p=mediagoblin.git Image media type initial migration. * mediagoblin/media_types/image/migrations/a98c1a320e88_image_media_type_initial.py: New file. --- diff --git a/mediagoblin/media_types/image/migrations/a98c1a320e88_image_media_type_initial.py b/mediagoblin/media_types/image/migrations/a98c1a320e88_image_media_type_initial.py new file mode 100644 index 00000000..1ba73a28 --- /dev/null +++ b/mediagoblin/media_types/image/migrations/a98c1a320e88_image_media_type_initial.py @@ -0,0 +1,36 @@ +"""Image media type initial migration + +Revision ID: a98c1a320e88 +Revises: 52bf0ccbedc1 +Create Date: 2016-03-12 21:10:10.155623 +""" + +# revision identifiers, used by Alembic. +revision = 'a98c1a320e88' +down_revision = '52bf0ccbedc1' +branch_labels = ('image_media_type',) +depends_on = None + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + if op.get_bind().engine.has_table("image__mediadata"): + # Skip; this has already been instantiated + # (probably via sqlalchemy-migrate) + return + + op.create_table( + 'image__mediadata', + sa.Column('media_entry', sa.Integer(), nullable=False), + sa.Column('width', sa.Integer(), nullable=True), + sa.Column('height', sa.Integer(), nullable=True), + sa.Column('exif_all', sa.UnicodeText(), nullable=True), + sa.ForeignKeyConstraint(['media_entry'], ['core__media_entries.id'], ), + sa.PrimaryKeyConstraint('media_entry')) + + +def downgrade(): + # @@: Is this safe? + op.drop_table('image__mediadata')