2017-02-23 18:37:47 +00:00
|
|
|
"""Add TeamSync table
|
|
|
|
|
|
|
|
Revision ID: be8d1c402ce0
|
2017-03-15 22:32:40 +00:00
|
|
|
Revises: a6c463dfb9fe
|
2017-02-23 18:37:47 +00:00
|
|
|
Create Date: 2017-02-23 13:34:52.356812
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
revision = 'be8d1c402ce0'
|
2017-03-15 22:32:40 +00:00
|
|
|
down_revision = 'a6c463dfb9fe'
|
2017-02-23 18:37:47 +00:00
|
|
|
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
2017-04-03 18:16:29 +00:00
|
|
|
from util.migrate import UTF8LongText
|
2017-02-23 18:37:47 +00:00
|
|
|
|
2018-05-07 13:45:57 +00:00
|
|
|
def upgrade(tables, tester):
|
2017-02-23 18:37:47 +00:00
|
|
|
### commands auto generated by Alembic - please adjust! ###
|
|
|
|
op.create_table('teamsync',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('team_id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('transaction_id', sa.String(length=255), nullable=False),
|
|
|
|
sa.Column('last_updated', sa.DateTime(), nullable=True),
|
|
|
|
sa.Column('service_id', sa.Integer(), nullable=False),
|
2017-04-03 18:16:29 +00:00
|
|
|
sa.Column('config', UTF8LongText(), nullable=False),
|
2017-02-23 18:37:47 +00:00
|
|
|
sa.ForeignKeyConstraint(['service_id'], ['loginservice.id'], name=op.f('fk_teamsync_service_id_loginservice')),
|
|
|
|
sa.ForeignKeyConstraint(['team_id'], ['team.id'], name=op.f('fk_teamsync_team_id_team')),
|
|
|
|
sa.PrimaryKeyConstraint('id', name=op.f('pk_teamsync'))
|
|
|
|
)
|
|
|
|
op.create_index('teamsync_last_updated', 'teamsync', ['last_updated'], unique=False)
|
|
|
|
op.create_index('teamsync_service_id', 'teamsync', ['service_id'], unique=False)
|
|
|
|
op.create_index('teamsync_team_id', 'teamsync', ['team_id'], unique=True)
|
|
|
|
### end Alembic commands ###
|
|
|
|
|
2018-05-07 13:45:57 +00:00
|
|
|
# ### population of test data ### #
|
|
|
|
tester.populate_table('teamsync', [
|
|
|
|
('team_id', tester.TestDataType.Foreign('team')),
|
|
|
|
('transaction_id', tester.TestDataType.String),
|
|
|
|
('last_updated', tester.TestDataType.DateTime),
|
|
|
|
('service_id', tester.TestDataType.Foreign('loginservice')),
|
|
|
|
('config', tester.TestDataType.JSON),
|
|
|
|
])
|
|
|
|
# ### end population of test data ### #
|
2017-02-23 18:37:47 +00:00
|
|
|
|
2018-05-07 13:45:57 +00:00
|
|
|
|
|
|
|
def downgrade(tables, tester):
|
2017-02-23 18:37:47 +00:00
|
|
|
### commands auto generated by Alembic - please adjust! ###
|
|
|
|
op.drop_table('teamsync')
|
|
|
|
### end Alembic commands ###
|