MySQL will not allow us to revoke the possibility for the namespace_user column to be nullable.
This commit is contained in:
parent
21d8c41320
commit
ae9026ee91
1 changed files with 0 additions and 2 deletions
|
@ -18,10 +18,8 @@ def upgrade(tables):
|
||||||
conn = op.get_bind()
|
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')
|
conn.execute('update repository set namespace_user_id = (select id from user where user.username = repository.namespace) where namespace_user_id is NULL')
|
||||||
|
|
||||||
op.alter_column('repository', 'namespace_user_id', nullable=False, existing_type=sa.Integer)
|
|
||||||
op.create_index('repository_namespace_user_id_name', 'repository', ['namespace_user_id', 'name'], unique=True)
|
op.create_index('repository_namespace_user_id_name', 'repository', ['namespace_user_id', 'name'], unique=True)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(tables):
|
def downgrade(tables):
|
||||||
op.drop_index('repository_namespace_user_id_name', table_name='repository')
|
op.drop_index('repository_namespace_user_id_name', table_name='repository')
|
||||||
op.alter_column('repository', 'namespace_user_id', nullable=True, existing_type=sa.Integer, server_default=sa.text('NULL'))
|
|
||||||
|
|
Reference in a new issue