Image media type initial migration.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 12 Mar 2016 22:36:23 +0000 (14:36 -0800)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 26 Mar 2016 18:39:07 +0000 (11:39 -0700)
* mediagoblin/media_types/image/migrations/a98c1a320e88_image_media_type_initial.py:
  New file.

mediagoblin/media_types/image/migrations/a98c1a320e88_image_media_type_initial.py [new file with mode: 0644]

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 (file)
index 0000000..1ba73a2
--- /dev/null
@@ -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')