MySQL will not allow us to revoke the possibility for the namespace_user column to be nullable.

This commit is contained in:
Jake Moshenko 2014-09-26 14:50:26 -04:00
parent 21d8c41320
commit ae9026ee91

View file

@ -18,10 +18,8 @@ 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')
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)
def downgrade(tables):
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'))