Fix all of the upgrades and downgrades to work on both mysql and postgres.
This commit is contained in:
parent
9d898bca65
commit
c4266140e2
4 changed files with 15 additions and 16 deletions
|
@ -16,8 +16,8 @@ import sqlalchemy as sa
|
|||
|
||||
def upgrade(tables):
|
||||
conn = op.get_bind()
|
||||
conn.execute('update repository set namespace_user_id = (select id from user where user.username = repository.namespace) where namespace_user_id is NULL')
|
||||
|
||||
user_table_name_escaped = conn.dialect.identifier_preparer.format_table(tables['user'])
|
||||
conn.execute('update repository set namespace_user_id = (select id from {0} where {0}.username = repository.namespace) where namespace_user_id is NULL'.format(user_table_name_escaped))
|
||||
op.create_index('repository_namespace_user_id_name', 'repository', ['namespace_user_id', 'name'], unique=True)
|
||||
|
||||
|
||||
|
|
Reference in a new issue