"""Added created_timestamp column to namespace_request

Revision ID: 771ef7c868de
Revises: 6fc1d0cf350c
Create Date: 2018-10-08 23:06:50.252729

"""

# revision identifiers, used by Alembic.
revision = '771ef7c868de'
down_revision = '6fc1d0cf350c'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa

from time import time

def now_timestamp():
    return int(time() * 1000)

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('rb_namespace_request', sa.Column('created_timestamp', sa.BigInteger(), nullable=False, server_default=str(now_timestamp())))
    op.create_index(op.f('ix_rb_namespace_request_created_timestamp'), 'rb_namespace_request', ['created_timestamp'], unique=False)


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('rb_namespace_request', 'created_timestamp')
