Add database migration for TeamSync
This commit is contained in:
parent
04225f2d25
commit
df603462b8
2 changed files with 40 additions and 1 deletions
|
@ -527,7 +527,7 @@ class LoginService(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class TeamSync(BaseModel):
|
class TeamSync(BaseModel):
|
||||||
team = ForeignKeyField(Team)
|
team = ForeignKeyField(Team, unique=True)
|
||||||
|
|
||||||
transaction_id = CharField()
|
transaction_id = CharField()
|
||||||
last_updated = DateTimeField(null=True, index=True)
|
last_updated = DateTimeField(null=True, index=True)
|
||||||
|
|
39
data/migrations/versions/be8d1c402ce0_add_teamsync_table.py
Normal file
39
data/migrations/versions/be8d1c402ce0_add_teamsync_table.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
"""Add TeamSync table
|
||||||
|
|
||||||
|
Revision ID: be8d1c402ce0
|
||||||
|
Revises: e2894a3a3c19
|
||||||
|
Create Date: 2017-02-23 13:34:52.356812
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'be8d1c402ce0'
|
||||||
|
down_revision = 'e2894a3a3c19'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import mysql
|
||||||
|
|
||||||
|
def upgrade(tables):
|
||||||
|
### 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),
|
||||||
|
sa.Column('config', sa.Text(), nullable=False),
|
||||||
|
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 ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade(tables):
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_table('teamsync')
|
||||||
|
### end Alembic commands ###
|
Reference in a new issue