<reponame>schedutron/pagerank2
"""Add links table

Revision ID: de85d4fbd2a0
Revises: <PASSWORD>
Create Date: 2019-12-16 20:34:51.112701

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'de85d4fbd2a0'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('links',
    sa.Column('from_id', sa.Integer(), nullable=False),
    sa.Column('to_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['from_id'], ['pages.id'], ),
    sa.ForeignKeyConstraint(['to_id'], ['pages.id'], ),
    sa.PrimaryKeyConstraint('from_id', 'to_id')
    )
    op.alter_column('pages', 'url',
               existing_type=sa.TEXT(),
               nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('pages', 'url',
               existing_type=sa.TEXT(),
               nullable=True)
    op.drop_table('links')
    # ### end Alembic commands ###

"""Add links table

Revision ID: de85d4fbd2a0
Revises: <PASSWORD>
Create Date: 2019-12-16 20:34:51.112701

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'de85d4fbd2a0'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('links',
    sa.Column('from_id', sa.Integer(), nullable=False),
    sa.Column('to_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['from_id'], ['pages.id'], ),
    sa.ForeignKeyConstraint(['to_id'], ['pages.id'], ),
    sa.PrimaryKeyConstraint('from_id', 'to_id')
    )
    op.alter_column('pages', 'url',
               existing_type=sa.TEXT(),
               nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('pages', 'url',
               existing_type=sa.TEXT(),
               nullable=True)
    op.drop_table('links')
    # ### end Alembic commands ###
Add links table  Revision ID: de85d4fbd2a0 Revises: <PASSWORD> Create Date: 2019-12-16 20:34:51.112701 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###