Persona plugin initial migration.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 12 Mar 2016 23:35:38 +0000 (15:35 -0800)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 26 Mar 2016 18:39:07 +0000 (11:39 -0700)
* mediagoblin/plugins/persona/migrations/c7d4840a5592_persona_plugin_initial_migration.py:
  New file.

mediagoblin/plugins/persona/migrations/c7d4840a5592_persona_plugin_initial_migration.py [new file with mode: 0644]

diff --git a/mediagoblin/plugins/persona/migrations/c7d4840a5592_persona_plugin_initial_migration.py b/mediagoblin/plugins/persona/migrations/c7d4840a5592_persona_plugin_initial_migration.py
new file mode 100644 (file)
index 0000000..0c40893
--- /dev/null
@@ -0,0 +1,35 @@
+"""Persona plugin initial migration
+
+Revision ID: c7d4840a5592
+Revises: 52bf0ccbedc1
+Create Date: 2016-03-12 23:30:33.624390
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'c7d4840a5592'
+down_revision = '52bf0ccbedc1'
+branch_labels = ('persona_plugin',)
+depends_on = None
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+    if op.get_bind().engine.has_table('persona__user_emails'):
+        # Skip; this has already been instantiated
+        # (probably via sqlalchemy-migrate)
+        return
+
+    op.create_table(
+        'persona__user_emails',
+        sa.Column('id', sa.Integer(), nullable=False),
+        sa.Column('persona_email', sa.Unicode(), nullable=False),
+        sa.Column('user_id', sa.Integer(), nullable=False),
+        sa.ForeignKeyConstraint(['user_id'], ['core__users.id'], ),
+        sa.PrimaryKeyConstraint('id'))
+
+
+def downgrade():
+    op.drop_table('persona__user_emails')