mirror of https://github.com/JohnHammond/CTFd.git
Only add team_captain_id foreign key if the db backend isn't SQLite (#1048)
* Only add `teams.team_captain_id` foreign key if the db backend isn't SQLite. SQLite does not support ALTER for the manipulation of columns/constraints. * Closes #1041selenium-screenshot-testing
parent
03058716a0
commit
8b3bb92c9d
|
@ -30,6 +30,10 @@ users_table = table('users',
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
op.add_column('teams', sa.Column('captain_id', sa.Integer(), nullable=True))
|
op.add_column('teams', sa.Column('captain_id', sa.Integer(), nullable=True))
|
||||||
|
|
||||||
|
bind = op.get_bind()
|
||||||
|
url = str(bind.engine.url)
|
||||||
|
if url.startswith('sqlite') is False:
|
||||||
op.create_foreign_key('team_captain_id', 'teams', 'users', ['captain_id'], ['id'])
|
op.create_foreign_key('team_captain_id', 'teams', 'users', ['captain_id'], ['id'])
|
||||||
|
|
||||||
connection = op.get_bind()
|
connection = op.get_bind()
|
||||||
|
|
Loading…
Reference in New Issue