def upgrade():
    op.create_table('discussions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('type', sa.Integer(), nullable=True), sa.Column('title', sa.String(length=100), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('identifier', sa.String(length=50), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('identifier'))
    op.create_index('disc_long_lat_idx', 'discussions', ['latitude', 'longitude'], unique=False)
    op.create_index(op.f('ix_discussions_created'), 'discussions', ['created'], unique=False)
    op.create_table('highlight_markers', sa.Column('id', sa.Integer(), nullable=False), sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('type', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id'))
    op.create_index('highlight_long_lat_idx', 'highlight_markers', ['latitude', 'longitude'], unique=False)
    op.create_table('markers', sa.Column('id', sa.Integer(), nullable=False), sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('type', sa.Integer(), nullable=True), sa.Column('title', sa.String(length=100), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('provider_code', sa.Integer(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('subtype', sa.Integer(), nullable=True), sa.Column('severity', sa.Integer(), nullable=True), sa.Column('address', sa.Text(), nullable=True), sa.Column('locationAccuracy', sa.Integer(), nullable=True), sa.Column('roadType', sa.Integer(), nullable=True), sa.Column('roadShape', sa.Integer(), nullable=True), sa.Column('dayType', sa.Integer(), nullable=True), sa.Column('unit', sa.Integer(), nullable=True), sa.Column('mainStreet', sa.Text(), nullable=True), sa.Column('secondaryStreet', sa.Text(), nullable=True), sa.Column('junction', sa.Text(), nullable=True), sa.Column('one_lane', sa.Integer(), nullable=True), sa.Column('multi_lane', sa.Integer(), nullable=True), sa.Column('speed_limit', sa.Integer(), nullable=True), sa.Column('intactness', sa.Integer(), nullable=True), sa.Column('road_width', sa.Integer(), nullable=True), sa.Column('road_sign', sa.Integer(), nullable=True), sa.Column('road_light', sa.Integer(), nullable=True), sa.Column('road_control', sa.Integer(), nullable=True), sa.Column('weather', sa.Integer(), nullable=True), sa.Column('road_surface', sa.Integer(), nullable=True), sa.Column('road_object', sa.Integer(), nullable=True), sa.Column('object_distance', sa.Integer(), nullable=True), sa.Column('didnt_cross', sa.Integer(), nullable=True), sa.Column('cross_mode', sa.Integer(), nullable=True), sa.Column('cross_location', sa.Integer(), nullable=True), sa.Column('cross_direction', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id', 'provider_code'))
    op.create_index('acc_long_lat_idx', 'markers', ['latitude', 'longitude'], unique=False)
    op.create_index(op.f('ix_markers_created'), 'markers', ['created'], unique=False)
    op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=80), nullable=True), sa.Column('description', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_table('users', sa.Column('id', sa.Integer(), nullable=False), sa.Column('email', sa.String(length=120), nullable=True), sa.Column('first_name', sa.String(length=50), nullable=True), sa.Column('last_name', sa.String(length=50), nullable=True), sa.Column('access_token', sa.String(length=100), nullable=True), sa.Column('username', sa.String(length=50), nullable=True), sa.Column('facebook_id', sa.String(length=50), nullable=True), sa.Column('facebook_url', sa.String(length=100), nullable=True), sa.Column('is_admin', sa.Boolean(), nullable=True), sa.Column('new_features_subscription', sa.Boolean(), nullable=True), sa.Column('password', sa.String(length=256), nullable=True), sa.Column('active', sa.Boolean(), nullable=True), sa.Column('confirmed_at', sa.DateTime(), nullable=True), sa.Column('social_id', sa.String(length=64), nullable=True), sa.Column('nickname', sa.String(length=64), nullable=True), sa.Column('provider', sa.String(length=64), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'), sa.UniqueConstraint('social_id'), sa.UniqueConstraint('username'))
    op.create_table('general_preferences', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('minimum_displayed_severity', sa.Integer(), nullable=True), sa.Column('resource_type', sa.String(length=64), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id']), sa.PrimaryKeyConstraint('user_id'))
    op.create_table('involved', sa.Column('id', sa.Integer(), nullable=False), sa.Column('provider_code', sa.Integer(), nullable=True), sa.Column('accident_id', sa.Integer(), nullable=True), sa.Column('involved_type', sa.Integer(), nullable=True), sa.Column('license_acquiring_date', sa.Integer(), nullable=True), sa.Column('age_group', sa.Integer(), nullable=True), sa.Column('sex', sa.Integer(), nullable=True), sa.Column('car_type', sa.Integer(), nullable=True), sa.Column('safety_measures', sa.Integer(), nullable=True), sa.Column('home_city', sa.Integer(), nullable=True), sa.Column('injury_severity', sa.Integer(), nullable=True), sa.Column('injured_type', sa.Integer(), nullable=True), sa.Column('injured_position', sa.Integer(), nullable=True), sa.Column('population_type', sa.Integer(), nullable=True), sa.Column('home_district', sa.Integer(), nullable=True), sa.Column('home_nafa', sa.Integer(), nullable=True), sa.Column('home_area', sa.Integer(), nullable=True), sa.Column('home_municipal_status', sa.Integer(), nullable=True), sa.Column('home_residence_type', sa.Integer(), nullable=True), sa.Column('hospital_time', sa.Integer(), nullable=True), sa.Column('medical_type', sa.Integer(), nullable=True), sa.Column('release_dest', sa.Integer(), nullable=True), sa.Column('safety_measures_use', sa.Integer(), nullable=True), sa.Column('late_deceased', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['accident_id', 'provider_code'], [u'markers.id', u'markers.provider_code'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'))
    op.create_table('report_preferences', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('line_number', sa.Integer(), nullable=False), sa.Column('historical_report', sa.Boolean(), nullable=True), sa.Column('how_many_months_back', sa.Integer(), nullable=True), sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('radius', sa.Float(), nullable=True), sa.Column('minimum_severity', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id']), sa.PrimaryKeyConstraint('user_id', 'line_number'))
    op.create_table('roles_users', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['role_id'], ['roles.id']), sa.ForeignKeyConstraint(['user_id'], ['users.id']))
    op.create_table('vehicles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('provider_code', sa.Integer(), nullable=True), sa.Column('accident_id', sa.Integer(), nullable=True), sa.Column('engine_volume', sa.Integer(), nullable=True), sa.Column('manufacturing_year', sa.Integer(), nullable=True), sa.Column('driving_directions', sa.Integer(), nullable=True), sa.Column('vehicle_status', sa.Integer(), nullable=True), sa.Column('vehicle_attribution', sa.Integer(), nullable=True), sa.Column('vehicle_type', sa.Integer(), nullable=True), sa.Column('seats', sa.Integer(), nullable=True), sa.Column('total_weight', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['accident_id', 'provider_code'], [u'markers.id', u'markers.provider_code'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'))
def upgrade():
    op.create_table('discussions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('type', sa.Integer(), nullable=True), sa.Column('title', sa.String(length=100), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('identifier', sa.String(length=50), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('identifier'))
    op.create_index('disc_long_lat_idx', 'discussions', ['latitude', 'longitude'], unique=False)
    op.create_index(op.f('ix_discussions_created'), 'discussions', ['created'], unique=False)
    op.create_table('highlight_markers', sa.Column('id', sa.Integer(), nullable=False), sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('type', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id'))
    op.create_index('highlight_long_lat_idx', 'highlight_markers', ['latitude', 'longitude'], unique=False)
    op.create_table('markers', sa.Column('id', sa.Integer(), nullable=False), sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('type', sa.Integer(), nullable=True), sa.Column('title', sa.String(length=100), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('provider_code', sa.Integer(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('subtype', sa.Integer(), nullable=True), sa.Column('severity', sa.Integer(), nullable=True), sa.Column('address', sa.Text(), nullable=True), sa.Column('locationAccuracy', sa.Integer(), nullable=True), sa.Column('roadType', sa.Integer(), nullable=True), sa.Column('roadShape', sa.Integer(), nullable=True), sa.Column('dayType', sa.Integer(), nullable=True), sa.Column('unit', sa.Integer(), nullable=True), sa.Column('mainStreet', sa.Text(), nullable=True), sa.Column('secondaryStreet', sa.Text(), nullable=True), sa.Column('junction', sa.Text(), nullable=True), sa.Column('one_lane', sa.Integer(), nullable=True), sa.Column('multi_lane', sa.Integer(), nullable=True), sa.Column('speed_limit', sa.Integer(), nullable=True), sa.Column('intactness', sa.Integer(), nullable=True), sa.Column('road_width', sa.Integer(), nullable=True), sa.Column('road_sign', sa.Integer(), nullable=True), sa.Column('road_light', sa.Integer(), nullable=True), sa.Column('road_control', sa.Integer(), nullable=True), sa.Column('weather', sa.Integer(), nullable=True), sa.Column('road_surface', sa.Integer(), nullable=True), sa.Column('road_object', sa.Integer(), nullable=True), sa.Column('object_distance', sa.Integer(), nullable=True), sa.Column('didnt_cross', sa.Integer(), nullable=True), sa.Column('cross_mode', sa.Integer(), nullable=True), sa.Column('cross_location', sa.Integer(), nullable=True), sa.Column('cross_direction', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id', 'provider_code'))
    op.create_index('acc_long_lat_idx', 'markers', ['latitude', 'longitude'], unique=False)
    op.create_index(op.f('ix_markers_created'), 'markers', ['created'], unique=False)
    op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=80), nullable=True), sa.Column('description', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_table('users', sa.Column('id', sa.Integer(), nullable=False), sa.Column('email', sa.String(length=120), nullable=True), sa.Column('first_name', sa.String(length=50), nullable=True), sa.Column('last_name', sa.String(length=50), nullable=True), sa.Column('access_token', sa.String(length=100), nullable=True), sa.Column('username', sa.String(length=50), nullable=True), sa.Column('facebook_id', sa.String(length=50), nullable=True), sa.Column('facebook_url', sa.String(length=100), nullable=True), sa.Column('is_admin', sa.Boolean(), nullable=True), sa.Column('new_features_subscription', sa.Boolean(), nullable=True), sa.Column('password', sa.String(length=256), nullable=True), sa.Column('active', sa.Boolean(), nullable=True), sa.Column('confirmed_at', sa.DateTime(), nullable=True), sa.Column('social_id', sa.String(length=64), nullable=True), sa.Column('nickname', sa.String(length=64), nullable=True), sa.Column('provider', sa.String(length=64), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'), sa.UniqueConstraint('social_id'), sa.UniqueConstraint('username'))
    op.create_table('general_preferences', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('minimum_displayed_severity', sa.Integer(), nullable=True), sa.Column('resource_type', sa.String(length=64), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id']), sa.PrimaryKeyConstraint('user_id'))
    op.create_table('involved', sa.Column('id', sa.Integer(), nullable=False), sa.Column('provider_code', sa.Integer(), nullable=True), sa.Column('accident_id', sa.Integer(), nullable=True), sa.Column('involved_type', sa.Integer(), nullable=True), sa.Column('license_acquiring_date', sa.Integer(), nullable=True), sa.Column('age_group', sa.Integer(), nullable=True), sa.Column('sex', sa.Integer(), nullable=True), sa.Column('car_type', sa.Integer(), nullable=True), sa.Column('safety_measures', sa.Integer(), nullable=True), sa.Column('home_city', sa.Integer(), nullable=True), sa.Column('injury_severity', sa.Integer(), nullable=True), sa.Column('injured_type', sa.Integer(), nullable=True), sa.Column('injured_position', sa.Integer(), nullable=True), sa.Column('population_type', sa.Integer(), nullable=True), sa.Column('home_district', sa.Integer(), nullable=True), sa.Column('home_nafa', sa.Integer(), nullable=True), sa.Column('home_area', sa.Integer(), nullable=True), sa.Column('home_municipal_status', sa.Integer(), nullable=True), sa.Column('home_residence_type', sa.Integer(), nullable=True), sa.Column('hospital_time', sa.Integer(), nullable=True), sa.Column('medical_type', sa.Integer(), nullable=True), sa.Column('release_dest', sa.Integer(), nullable=True), sa.Column('safety_measures_use', sa.Integer(), nullable=True), sa.Column('late_deceased', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['accident_id', 'provider_code'], [u'markers.id', u'markers.provider_code'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'))
    op.create_table('report_preferences', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('line_number', sa.Integer(), nullable=False), sa.Column('historical_report', sa.Boolean(), nullable=True), sa.Column('how_many_months_back', sa.Integer(), nullable=True), sa.Column('latitude', sa.Float(), nullable=True), sa.Column('longitude', sa.Float(), nullable=True), sa.Column('radius', sa.Float(), nullable=True), sa.Column('minimum_severity', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id']), sa.PrimaryKeyConstraint('user_id', 'line_number'))
    op.create_table('roles_users', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['role_id'], ['roles.id']), sa.ForeignKeyConstraint(['user_id'], ['users.id']))
    op.create_table('vehicles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('provider_code', sa.Integer(), nullable=True), sa.Column('accident_id', sa.Integer(), nullable=True), sa.Column('engine_volume', sa.Integer(), nullable=True), sa.Column('manufacturing_year', sa.Integer(), nullable=True), sa.Column('driving_directions', sa.Integer(), nullable=True), sa.Column('vehicle_status', sa.Integer(), nullable=True), sa.Column('vehicle_attribution', sa.Integer(), nullable=True), sa.Column('vehicle_type', sa.Integer(), nullable=True), sa.Column('seats', sa.Integer(), nullable=True), sa.Column('total_weight', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['accident_id', 'provider_code'], [u'markers.id', u'markers.provider_code'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'))