From: Christopher Allan Webber Date: Sat, 12 Mar 2016 22:53:20 +0000 (-0800) Subject: Ascii media type initial migration. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=99a51bbde6816b7546170474584a2da499d3026b;p=mediagoblin.git Ascii media type initial migration. * mediagoblin/db/migrations/versions/72bd70f7eefd_ascii_media_type_initial_migration.py: New file. --- diff --git a/mediagoblin/media_types/ascii/migrations/72bd70f7eefd_ascii_media_type_initial_migration.py b/mediagoblin/media_types/ascii/migrations/72bd70f7eefd_ascii_media_type_initial_migration.py new file mode 100644 index 00000000..142abe6b --- /dev/null +++ b/mediagoblin/media_types/ascii/migrations/72bd70f7eefd_ascii_media_type_initial_migration.py @@ -0,0 +1,33 @@ +"""Ascii media type initial migration + +Revision ID: 72bd70f7eefd +Revises: 52bf0ccbedc1 +Create Date: 2016-03-12 22:50:58.382980 + +""" + +# revision identifiers, used by Alembic. +revision = '72bd70f7eefd' +down_revision = '52bf0ccbedc1' +branch_labels = ('ascii_media_type',) +depends_on = None + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + if op.get_bind().engine.has_table("ascii__mediadata"): + # Skip; this has already been instantiated + # (probably via sqlalchemy-migrate) + return + + op.create_table( + 'ascii__mediadata', + sa.Column('media_entry', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['media_entry'], ['core__media_entries.id'], ), + sa.PrimaryKeyConstraint('media_entry')) + + +def downgrade(): + op.drop_table('ascii__mediadata')