Current location

narf Source control manager Git

summaryrefslogtreecommitdiff
blob: 0c40893a9ff09500a1f03f0475418a5dcbd387a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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')