"""uuid

Revision: 0048
Revision ID: 3e7436bcd512
Revises: 3457fda0cf2a
Create Date: 2016-02-25 17:15:01.125712

"""

# revision identifiers, used by Alembic.
revision = '3e7436bcd512'
down_revision = '3457fda0cf2a'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.execute("""CREATE FUNCTION generate_cache_id(id text) RETURNS text
        AS 'SELECT id || current_timestamp::text;' LANGUAGE SQL;""")
    op.execute("""CREATE FUNCTION generate_cache_id(id int) RETURNS text
        AS 'SELECT generate_cache_id(id::text);' LANGUAGE SQL;""")


def downgrade():
    op.execute("""DROP FUNCTION generate_cache_id(id int)""")
    op.execute("""DROP FUNCTION generate_cache_id(id text)""")
