This commit is contained in:
Joseph Schorr 2014-09-27 14:55:36 -04:00
commit 77346ad047

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'))