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,7 +30,11 @@ users_table = table('users',
|
|||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('teams', sa.Column('captain_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key('team_captain_id', 'teams', 'users', ['captain_id'], ['id'])
|
||||
|
||||
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'])
|
||||
|
||||
connection = op.get_bind()
|
||||
for team in connection.execute(teams_table.select()):
|
||||
|
|
Loading…
Reference in New Issue