"""Migrate registry namespaces to reference a user.

Revision ID: 13da56878560
Revises: 51d04d0e7e6f
Create Date: 2014-09-18 13:56:45.130455

"""

# revision identifiers, used by Alembic.
revision = '13da56878560'
down_revision = '51d04d0e7e6f'

from alembic import op
import sqlalchemy as sa

from data.database import Repository, User

def upgrade(tables):
    # Add the namespace_user column, allowing it to be nullable
    op.add_column('repository', sa.Column('namespace_user_id', sa.Integer(), sa.ForeignKey('user.id')))


def downgrade(tables):
    op.drop_column('repository', 'namespace_user_id')
