"""Change last_ip to inet.

Revision ID: 1fbbb727e1dc
Revises: 2dd8b091742b
Create Date: 2015-08-31 20:54:43.824788

"""

# revision identifiers, used by Alembic.
revision = '1fbbb727e1dc'
down_revision = '2dd8b091742b'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.execute(u'alter table users alter column last_ip type inet using last_ip::inet;')
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###

"""Change last_ip to inet.

Revision ID: 1fbbb727e1dc
Revises: 2dd8b091742b
Create Date: 2015-08-31 20:54:43.824788

"""

# revision identifiers, used by Alembic.
revision = '1fbbb727e1dc'
down_revision = '2dd8b091742b'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    # Default needs to be dropped because the old default of an empty string cannot be casted to an IP.
    op.execute(u'alter table users alter column last_ip drop default;')
    op.execute(u'alter table users alter column last_ip type inet using last_ip::inet;')


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###

Fix migrations from text to inet.
Fix migrations from text to inet.
