"""second commit

Revision ID: d32d2b101480
Revises: 2b6a15fee905
Create Date: 2020-10-08 16:18:12.825633

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = 'd32d2b101480'
down_revision = '2b6a15fee905'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cep_diff_in_time_leadGen_seconds',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('diff_in_time_leadGen_seconds', sa.Float(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_cep_diff_in_time_leadGen_seconds_client_id'), 'cep_diff_in_time_leadGen_seconds', ['client_id'], unique=False)
    op.create_table('cep_leads_generated_per_session',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('visit_number', mysql.INTEGER(), nullable=True),
    sa.Column('lead_generated_count', mysql.INTEGER(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_cep_leads_generated_per_session_client_id'), 'cep_leads_generated_per_session', ['client_id'], unique=False)
    op.create_table('cep_listing_engagement_score',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('listing_id', sa.String(length=255), nullable=True),
    sa.Column('ratings', sa.Float(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_cep_listing_engagement_score_client_id'), 'cep_listing_engagement_score', ['client_id'], unique=False)
    op.create_table('cep_time_on_visit',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('visit_number', mysql.INTEGER(), nullable=True),
    sa.Column('total_time_on_site_second', sa.Float(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_cep_time_on_visit_client_id'), 'cep_time_on_visit', ['client_id'], unique=False)
    op.create_table('consumer_profile_master',
    sa.Column('login_id', sa.String(length=255), nullable=True),
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('date', sa.Date(), nullable=True),
    sa.Column('cluster_col__market', sa.String(length=255), nullable=True),
    sa.Column('cid_user_login_type', sa.String(length=255), nullable=True),
    sa.Column('cid_user_login_status', sa.Boolean(), nullable=True),
    sa.Column('cid_user_language', sa.String(length=255), nullable=True),
    sa.Column('cid_repeat_user', sa.Boolean(), nullable=True),
    sa.Column('cid_logged_in_type', sa.String(length=255), nullable=True),
    sa.Column('acq_age_with_rea', sa.Integer(), nullable=True),
    sa.Column('acq_days_since_last_visit', sa.Integer(), nullable=True),
    sa.Column('acq_first_visit_timestamp', sa.Date(), nullable=True),
    sa.Column('acq_latest_visit_timestamp', sa.Date(), nullable=True),
    sa.Column('cbs_propensity_score', sa.String(length=255), nullable=True),
    sa.Column('cbs_leads_generated_count', sa.String(length=255), nullable=True),
    sa.Column('cbs_Recommended_properties', sa.String(length=255), nullable=True),
    sa.Column('cbs_journey_segment', sa.String(length=255), nullable=True),
    sa.Column('cbs_price_sensitive_score', sa.String(length=255), nullable=True),
    sa.Column('cep_first_lead_timestamp', sa.TIMESTAMP(), nullable=True),
    sa.Column('cep_hours_to_first_lead', sa.Integer(), nullable=True),
    sa.Column('cep_days_to_first_lead', sa.Integer(), nullable=True),
    sa.Column('cep_whatsapp_lead', sa.Integer(), nullable=True),
    sa.Column('cep_phone_lead', sa.Integer(), nullable=True),
    sa.Column('cep_email_lead', sa.Integer(), nullable=True),
    sa.Column('cep_total_leads', sa.Integer(), nullable=True),
    sa.Column('cep_min_leads_time_diff_seconds', sa.Float(), nullable=True),
    sa.Column('cep_max_leads_time_diff_seconds', sa.Float(), nullable=True),
    sa.Column('cep_avg_leads_time_diff_seconds', sa.Float(), nullable=True),
    sa.Column('cep_median_leads_time_diff_seconds', sa.Float(), nullable=True),
    sa.Column('cep_percentile90_leads_time_diff_seconds', sa.Float(), nullable=True),
    sa.Column('cep_average_time_per_session_second', sa.Float(), nullable=True),
    sa.Column('cep_max_per_session_second', sa.Float(), nullable=True),
    sa.Column('cep_min_per_session_second', sa.Float(), nullable=True),
    sa.Column('cep_median_per_session_second', sa.Float(), nullable=True),
    sa.Column('cep_percentile_90_per_session_second', sa.Float(), nullable=True),
    sa.Column('pdp_looking_to_type', sa.String(length=255), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_consumer_profile_master_client_id'), 'consumer_profile_master', ['client_id'], unique=True)
    op.create_table('financial_loancare',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('request_age', sa.String(length=255), nullable=True),
    sa.Column('employment_status', sa.String(length=255), nullable=True),
    sa.Column('salary_type', sa.String(length=255), nullable=True),
    sa.Column('basic_salary', sa.String(length=255), nullable=True),
    sa.Column('fixed_allowance', sa.String(length=255), nullable=True),
    sa.Column('monthly_pcb', sa.String(length=255), nullable=True),
    sa.Column('commission', sa.String(length=255), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_financial_loancare_client_id'), 'financial_loancare', ['client_id'], unique=False)
    op.create_table('interaction_stats',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('interaction_type', sa.String(length=255), nullable=True),
    sa.Column('interaction_name', sa.String(length=255), nullable=True),
    sa.Column('stats_type', sa.String(length=255), nullable=True),
    sa.Column('stats_value', sa.Float(), nullable=True),
    sa.Column('preferred', sa.Boolean(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_interaction_stats_client_id'), 'interaction_stats', ['client_id'], unique=False)
    op.create_table('lifestyle_profile',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('visit_start_time', sa.String(length=255), nullable=True),
    sa.Column('article_id', sa.String(length=255), nullable=True),
    sa.Column('article_title', sa.String(length=255), nullable=True),
    sa.Column('article_section', sa.String(length=255), nullable=True),
    sa.Column('article_tag', sa.String(length=255), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_lifestyle_profile_client_id'), 'lifestyle_profile', ['client_id'], unique=False)
    op.create_table('login_client_id',
    sa.Column('login_id', sa.String(length=255), nullable=True),
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_login_client_id_client_id'), 'login_client_id', ['client_id'], unique=False)
    op.create_table('pdp_listing_title',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('listing_id', sa.String(length=255), nullable=True),
    sa.Column('title', sa.String(length=255), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_pdp_listing_title_client_id'), 'pdp_listing_title', ['client_id'], unique=False)
    op.create_table('pdp_property_view',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('property_type', sa.String(length=255), nullable=True),
    sa.Column('tier', sa.String(length=255), nullable=True),
    sa.Column('visit_start_time', sa.Float(), nullable=True),
    sa.Column('visit_number', mysql.INTEGER(), nullable=True),
    sa.Column('listing_id', sa.String(length=255), nullable=True),
    sa.Column('listing_channel', sa.String(length=255), nullable=True),
    sa.Column('price', sa.Float(), nullable=True),
    sa.Column('location1', sa.String(length=255), nullable=True),
    sa.Column('location2', sa.String(length=255), nullable=True),
    sa.Column('location3', sa.String(length=255), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_pdp_property_view_client_id'), 'pdp_property_view', ['client_id'], unique=False)
    op.create_table('pdp_property_view_count',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('listing_id', sa.String(length=255), nullable=True),
    sa.Column('count', mysql.INTEGER(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_pdp_property_view_count_client_id'), 'pdp_property_view_count', ['client_id'], unique=False)
    op.create_table('popular_location',
    sa.Column('location_1_id', sa.Integer(), nullable=True),
    sa.Column('location_1_name', sa.String(length=255), nullable=True),
    sa.Column('location_2_id', sa.Integer(), nullable=True),
    sa.Column('location_2_name', sa.String(length=255), nullable=True),
    sa.Column('channel', sa.String(length=64), nullable=True),
    sa.Column('market', sa.String(length=64), nullable=True),
    sa.Column('location_target', sa.String(length=255), nullable=False),
    sa.Column('rank', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('location_target', 'rank')
    )
    op.create_index(op.f('ix_popular_location_location_target'), 'popular_location', ['location_target'], unique=False)
    op.create_index(op.f('ix_popular_location_rank'), 'popular_location', ['rank'], unique=False)
    op.create_table('popular_property',
    sa.Column('id', sa.String(length=128), nullable=False),
    sa.Column('channel', sa.String(length=64), nullable=True),
    sa.Column('market', sa.String(length=64), nullable=True),
    sa.Column('userCity', sa.String(length=128), nullable=True),
    sa.Column('rank', sa.Integer(), nullable=True),
    sa.Column('buildingId', sa.String(length=128), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_popular_property_id'), 'popular_property', ['id'], unique=False)
    op.create_table('session_profile',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('channel', sa.String(length=64), nullable=False),
    sa.Column('market', sa.String(length=64), nullable=False),
    sa.Column('device', sa.String(length=64), nullable=False),
    sa.Column('data', sa.Text(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id', 'channel', 'market', 'device')
    )
    op.create_index(op.f('ix_session_profile_channel'), 'session_profile', ['channel'], unique=False)
    op.create_index(op.f('ix_session_profile_client_id'), 'session_profile', ['client_id'], unique=False)
    op.create_index(op.f('ix_session_profile_device'), 'session_profile', ['device'], unique=False)
    op.create_index(op.f('ix_session_profile_market'), 'session_profile', ['market'], unique=False)
    op.create_table('similar_property',
    sa.Column('buildingId', sa.String(length=128), nullable=False),
    sa.Column('channel', sa.String(length=64), nullable=False),
    sa.Column('market', sa.String(length=64), nullable=False),
    sa.Column('buildingIdRecommended', sa.Text(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('buildingId', 'channel', 'market')
    )
    op.create_index(op.f('ix_similar_property_buildingId'), 'similar_property', ['buildingId'], unique=False)
    op.create_index(op.f('ix_similar_property_channel'), 'similar_property', ['channel'], unique=False)
    op.create_index(op.f('ix_similar_property_market'), 'similar_property', ['market'], unique=False)
    op.create_table('srp_user_device',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('browser', sa.String(length=255), nullable=True),
    sa.Column('browser_version', sa.String(length=255), nullable=True),
    sa.Column('browser_size', sa.String(length=255), nullable=True),
    sa.Column('operating_system', sa.String(length=255), nullable=True),
    sa.Column('operating_system_version', sa.String(length=255), nullable=True),
    sa.Column('is_mobile', sa.Boolean(), nullable=True),
    sa.Column('mobile_device_branding', sa.String(length=255), nullable=True),
    sa.Column('mobile_device_model', sa.String(length=255), nullable=True),
    sa.Column('mobile_device_info', sa.String(length=255), nullable=True),
    sa.Column('language', sa.String(length=255), nullable=True),
    sa.Column('screen_resolution', sa.String(length=255), nullable=True),
    sa.Column('device_category', sa.String(length=255), nullable=True),
    sa.Column('app_id', sa.String(length=255), nullable=True),
    sa.Column('app_installer_id', sa.String(length=255), nullable=True),
    sa.Column('app_name', sa.String(length=255), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_srp_user_device_client_id'), 'srp_user_device', ['client_id'], unique=False)
    op.create_table('srp_user_location',
    sa.Column('client_id', sa.String(length=255), nullable=False),
    sa.Column('continent', sa.String(length=255), nullable=True),
    sa.Column('sub_continent', sa.String(length=255), nullable=True),
    sa.Column('country', sa.String(length=255), nullable=True),
    sa.Column('region', sa.String(length=255), nullable=True),
    sa.Column('metro', sa.String(length=255), nullable=True),
    sa.Column('city', sa.String(length=255), nullable=True),
    sa.Column('latitude', sa.Float(), nullable=True),
    sa.Column('longitude', sa.Float(), nullable=True),
    sa.Column('network_location', sa.String(length=255), nullable=True),
    sa.Column('market', sa.String(length=255), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(op.f('ix_srp_user_location_client_id'), 'srp_user_location', ['client_id'], unique=False)
    op.create_table('user_popular_location',
    sa.Column('clientId', sa.String(length=255), nullable=False),
    sa.Column('location_1_id', sa.Integer(), nullable=False),
    sa.Column('location_1_name', sa.String(length=255), nullable=True),
    sa.Column('channel', sa.String(length=64), nullable=False),
    sa.Column('popular_nearby', sa.Text(), nullable=True),
    sa.Column('market', sa.String(length=64), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('clientId', 'location_1_id', 'channel')
    )
    op.create_index(op.f('ix_user_popular_location_channel'), 'user_popular_location', ['channel'], unique=False)
    op.create_index(op.f('ix_user_popular_location_clientId'), 'user_popular_location', ['clientId'], unique=False)
    op.create_index(op.f('ix_user_popular_location_location_1_id'), 'user_popular_location', ['location_1_id'], unique=False)
    op.create_table('user_recommended_property',
    sa.Column('clientId', sa.String(length=255), nullable=False),
    sa.Column('channel', sa.String(length=64), nullable=False),
    sa.Column('market', sa.String(length=64), nullable=False),
    sa.Column('buildingIdKnown', sa.Text(), nullable=True),
    sa.Column('buildingIdRecommended', sa.Text(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('clientId', 'channel', 'market')
    )
    op.create_index(op.f('ix_user_recommended_property_channel'), 'user_recommended_property', ['channel'], unique=False)
    op.create_index(op.f('ix_user_recommended_property_clientId'), 'user_recommended_property', ['clientId'], unique=False)
    op.create_index(op.f('ix_user_recommended_property_market'), 'user_recommended_property', ['market'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_user_recommended_property_market'), table_name='user_recommended_property')
    op.drop_index(op.f('ix_user_recommended_property_clientId'), table_name='user_recommended_property')
    op.drop_index(op.f('ix_user_recommended_property_channel'), table_name='user_recommended_property')
    op.drop_table('user_recommended_property')
    op.drop_index(op.f('ix_user_popular_location_location_1_id'), table_name='user_popular_location')
    op.drop_index(op.f('ix_user_popular_location_clientId'), table_name='user_popular_location')
    op.drop_index(op.f('ix_user_popular_location_channel'), table_name='user_popular_location')
    op.drop_table('user_popular_location')
    op.drop_index(op.f('ix_srp_user_location_client_id'), table_name='srp_user_location')
    op.drop_table('srp_user_location')
    op.drop_index(op.f('ix_srp_user_device_client_id'), table_name='srp_user_device')
    op.drop_table('srp_user_device')
    op.drop_index(op.f('ix_similar_property_market'), table_name='similar_property')
    op.drop_index(op.f('ix_similar_property_channel'), table_name='similar_property')
    op.drop_index(op.f('ix_similar_property_buildingId'), table_name='similar_property')
    op.drop_table('similar_property')
    op.drop_index(op.f('ix_session_profile_market'), table_name='session_profile')
    op.drop_index(op.f('ix_session_profile_device'), table_name='session_profile')
    op.drop_index(op.f('ix_session_profile_client_id'), table_name='session_profile')
    op.drop_index(op.f('ix_session_profile_channel'), table_name='session_profile')
    op.drop_table('session_profile')
    op.drop_index(op.f('ix_popular_property_id'), table_name='popular_property')
    op.drop_table('popular_property')
    op.drop_index(op.f('ix_popular_location_rank'), table_name='popular_location')
    op.drop_index(op.f('ix_popular_location_location_target'), table_name='popular_location')
    op.drop_table('popular_location')
    op.drop_index(op.f('ix_pdp_property_view_count_client_id'), table_name='pdp_property_view_count')
    op.drop_table('pdp_property_view_count')
    op.drop_index(op.f('ix_pdp_property_view_client_id'), table_name='pdp_property_view')
    op.drop_table('pdp_property_view')
    op.drop_index(op.f('ix_pdp_listing_title_client_id'), table_name='pdp_listing_title')
    op.drop_table('pdp_listing_title')
    op.drop_index(op.f('ix_login_client_id_client_id'), table_name='login_client_id')
    op.drop_table('login_client_id')
    op.drop_index(op.f('ix_lifestyle_profile_client_id'), table_name='lifestyle_profile')
    op.drop_table('lifestyle_profile')
    op.drop_index(op.f('ix_interaction_stats_client_id'), table_name='interaction_stats')
    op.drop_table('interaction_stats')
    op.drop_index(op.f('ix_financial_loancare_client_id'), table_name='financial_loancare')
    op.drop_table('financial_loancare')
    op.drop_index(op.f('ix_consumer_profile_master_client_id'), table_name='consumer_profile_master')
    op.drop_table('consumer_profile_master')
    op.drop_index(op.f('ix_cep_time_on_visit_client_id'), table_name='cep_time_on_visit')
    op.drop_table('cep_time_on_visit')
    op.drop_index(op.f('ix_cep_listing_engagement_score_client_id'), table_name='cep_listing_engagement_score')
    op.drop_table('cep_listing_engagement_score')
    op.drop_index(op.f('ix_cep_leads_generated_per_session_client_id'), table_name='cep_leads_generated_per_session')
    op.drop_table('cep_leads_generated_per_session')
    op.drop_index(op.f('ix_cep_diff_in_time_leadGen_seconds_client_id'), table_name='cep_diff_in_time_leadGen_seconds')
    op.drop_table('cep_diff_in_time_leadGen_seconds')
    # ### end Alembic commands ###
