# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_04_17_132557) do

  create_table "arch_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "image_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean "delta"
    t.integer "operation_label_id"
    t.index ["image_id"], name: "index_arch_stats_on_image_id"
    t.index ["user_id"], name: "index_arch_stats_on_user_id"
  end

  create_table "authorizations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "permission_label_id"
    t.integer "title_provider_group_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["permission_label_id", "title_provider_group_id"], name: "index_unique_provider_group_authorization", unique: true
  end

  create_table "authorized_countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "provider_id"
    t.integer "country_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "billing_informations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.string "billing_company"
    t.string "billing_address"
    t.string "billing_zip_code"
    t.string "billing_city"
    t.integer "billing_country_id"
    t.string "billing_email"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.string "siret"
  end

  create_table "communication_in_jobs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "job_source"
    t.integer "job_source_job_id"
    t.string "type"
    t.text "params"
    t.integer "done"
    t.string "result"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "communication_out_jobs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "type"
    t.text "params"
    t.integer "done"
    t.string "result"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "delayed_jobs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "priority", default: 0
    t.integer "attempts", default: 0
    t.text "handler"
    t.text "last_error"
    t.datetime "run_at"
    t.datetime "locked_at"
    t.datetime "failed_at"
    t.string "locked_by"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "queue"
  end

  create_table "images", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "title", limit: 192
    t.string "subject_code", limit: 708
    t.text "subject"
    t.string "instructions", limit: 768
    t.string "creator", limit: 96
    t.string "city", limit: 96
    t.string "location", limit: 96
    t.string "state", limit: 96
    t.string "country", limit: 192
    t.string "headline", limit: 768
    t.string "credit", limit: 96
    t.string "source", limit: 96
    t.text "description"
    t.string "reportage", limit: 96
    t.string "normalized_credit", limit: 192
    t.integer "max_avail_width"
    t.integer "max_avail_height"
    t.string "original_filename"
    t.text "provider_comment"
    t.datetime "date_created"
    t.datetime "reception_date"
    t.string "thumb_location"
    t.string "medium_location"
    t.string "hires_location", limit: 1000
    t.string "restrictions", limit: 512, default: "ANY"
    t.integer "provider_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "rights", limit: 384
    t.string "category", limit: 9
    t.string "supplemental_category", limit: 96
    t.integer "urgency", limit: 3
    t.string "authors_position", limit: 96
    t.string "transmission_reference", limit: 96
    t.string "caption_writer", limit: 96
    t.boolean "delta", default: true, null: false
    t.float "ratio"
    t.boolean "erasable", default: false
    t.string "ms_picture_id"
    t.string "ms_id"
    t.boolean "private_image", default: false
    t.string "file_name"
    t.boolean "content_error", default: false, null: false
    t.integer "ms_image_id", default: 0
    t.integer "fonds", default: 0
    t.integer "hr_size", default: 0
    t.integer "black_and_white", limit: 1, default: 0
    t.integer "flow", limit: 1, default: 0
    t.string "id20min"
    t.integer "right_owner_id"
    t.index ["black_and_white"], name: "black_and_white"
    t.index ["content_error"], name: "index_images_on_content_error"
    t.index ["created_at"], name: "index_images_on_created_at"
    t.index ["date_created"], name: "index_images_on_date_created"
    t.index ["delta"], name: "index_images_on_delta"
    t.index ["file_name"], name: "index_images_on_file_name"
    t.index ["flow"], name: "index_images_on_flow"
    t.index ["ms_id", "ms_picture_id"], name: "ms_id_i"
    t.index ["ms_image_id"], name: "index_images_on_ms_image_id", unique: true
    t.index ["original_filename", "provider_id"], name: "index_images_on_original_filename_and_provider_id", unique: true
    t.index ["private_image"], name: "index_images_on_private_image"
    t.index ["provider_id"], name: "index_images_on_provider_id"
    t.index ["ratio"], name: "index_images_on_ratio"
    t.index ["reception_date"], name: "index_images_on_reception_date"
    t.index ["reportage"], name: "index_images_on_reportage"
    t.index ["right_owner_id"], name: "index_images_on_right_owner_id"
    t.index ["updated_at"], name: "index_images_on_updated_at"
  end

  create_table "inv_billing_companies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "billing_company"
    t.string "billing_address"
    t.string "billing_zip_code"
    t.string "billing_city"
    t.integer "billing_country_id"
    t.string "billing_email"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.string "billing_phone"
    t.string "billing_complement"
    t.integer "discount"
    t.integer "vat_id"
    t.string "vat_number"
    t.boolean "distributor", default: false, null: false
    t.string "bank_account"
    t.integer "payment_type_id"
    t.integer "time_limit"
    t.boolean "end_of_month", default: false, null: false
    t.string "siret"
    t.text "comment"
  end

  create_table "inv_billing_lines", id: :integer, unsigned: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "billing_id", null: false
    t.integer "product_type_id", null: false
    t.integer "image_id"
    t.text "description"
    t.integer "right_owner_id"
    t.integer "photographer_rate"
    t.integer "quantity", default: 1, null: false
    t.decimal "price", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "vat", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "discount", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ht", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ttc", precision: 10, scale: 3, default: "0.0", null: false
    t.boolean "retribution", default: false, null: false, unsigned: true
    t.text "usage"
  end

  create_table "inv_billing_settings", id: :integer, unsigned: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "type", default: "", null: false
    t.string "code"
    t.string "name", default: "", null: false
    t.integer "ordering", default: 0, null: false
    t.decimal "amount", precision: 10, scale: 3
    t.boolean "retribution"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "ttv_id"
    t.integer "ctv_id"
    t.date "application_date"
    t.boolean "photo"
    t.index ["type"], name: "type"
  end

  create_table "inv_billing_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", null: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "inv_billings", id: :integer, unsigned: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "billing_type_id", null: false
    t.string "number"
    t.string "sub_number"
    t.integer "billing_company_id"
    t.date "date"
    t.date "deadline"
    t.decimal "paid", precision: 10, scale: 3, default: "0.0", null: false
    t.integer "discount_type_id", null: false
    t.text "conditions"
    t.decimal "total_before_discount", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "discount", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "general_discount", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ht_final", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "vat", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ttc", precision: 10, scale: 3, default: "0.0", null: false
    t.text "state", null: false
    t.text "heading"
    t.integer "logo_id"
    t.integer "credit_note_id"
    t.integer "price_type_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean "synced_to_4d", default: false, null: false
  end

  create_table "inv_closing_amounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "closing_id", null: false
    t.decimal "vat_rate", precision: 10, scale: 3, null: false
    t.decimal "grand_vat_total", precision: 10, scale: 3, null: false
    t.decimal "perpetual_vat_total", precision: 10, scale: 3, null: false
    t.string "hash_string"
    t.string "previous_hash_string"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["closing_id"], name: "index_inv_closing_amounts_on_closing_id"
  end

  create_table "inv_closings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.datetime "closing_date", null: false
    t.decimal "cumulative_total", precision: 10, scale: 3, null: false
    t.decimal "perpetual_total", precision: 10, scale: 3, null: false
    t.decimal "grand_vat_total", precision: 10, scale: 3, null: false
    t.decimal "perpetual_vat_total", precision: 10, scale: 3, null: false
    t.string "hash_string"
    t.string "previous_hash_string"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "inv_discount_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", null: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "inv_payment_amounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "payment_id", null: false
    t.decimal "vat_rate", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "vat", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ht", precision: 10, scale: 3, default: "0.0", null: false
    t.text "hash_string"
    t.text "previous_hash_string"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["payment_id"], name: "index_inv_payment_amounts_on_payment_id"
  end

  create_table "inv_payment_lines", id: :integer, unsigned: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "payment_id", null: false
    t.integer "billing_id", null: false
    t.decimal "amount", precision: 10, scale: 3, default: "0.0", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "hash_string"
    t.string "previous_hash_string"
  end

  create_table "inv_payments", id: :integer, unsigned: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "billing_company_id"
    t.integer "payment_type_id", null: false
    t.date "payment_date", null: false
    t.decimal "total", precision: 10, scale: 3, default: "0.0", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "cancel_payment_id"
    t.index ["cancel_payment_id"], name: "index_inv_payments_on_cancel_payment_id"
  end

  create_table "inv_photographer_billing_companies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.string "billing_company"
    t.string "billing_address"
    t.string "billing_zip_code"
    t.string "billing_city"
    t.integer "billing_country_id"
    t.string "billing_email"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.string "billing_phone"
    t.string "billing_complement"
    t.integer "discount"
    t.integer "vat_id"
    t.string "vat_number"
    t.boolean "distributor", default: false, null: false
    t.string "bank_account"
    t.integer "payment_type_id"
    t.integer "time_limit"
    t.boolean "end_of_month", default: false, null: false
    t.string "siret"
    t.text "comment"
    t.index ["user_id"], name: "index_inv_photographer_billing_companies_on_user_id"
  end

  create_table "inv_photographer_billing_lines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "photographer_billing_id", null: false
    t.integer "product_type_id", null: false
    t.integer "image_id"
    t.text "description"
    t.integer "quantity", default: 1, null: false
    t.decimal "price", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "vat", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "discount", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ht", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ttc", precision: 10, scale: 3, default: "0.0", null: false
    t.boolean "retribution", default: false, null: false, unsigned: true
    t.text "usage"
    t.index ["photographer_billing_id"], name: "index_inv_photographer_billing_lines_on_photographer_billing_id"
  end

  create_table "inv_photographer_billing_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "logo"
    t.text "company_details"
    t.text "bottom_text"
    t.index ["user_id"], name: "index_inv_photographer_billing_settings_on_user_id"
  end

  create_table "inv_photographer_billings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.integer "billing_type_id", null: false
    t.string "number"
    t.string "sub_number"
    t.integer "photographer_billing_company_id"
    t.date "date"
    t.date "deadline"
    t.decimal "paid", precision: 10, scale: 3, default: "0.0", null: false
    t.integer "discount_type_id", null: false
    t.text "conditions"
    t.decimal "total_before_discount", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "discount", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "general_discount", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ht_final", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "vat", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ttc", precision: 10, scale: 3, default: "0.0", null: false
    t.text "state", null: false
    t.text "heading"
    t.integer "credit_note_id"
    t.integer "price_type_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["photographer_billing_company_id"], name: "index_photographer_billing_company_id"
    t.index ["user_id"], name: "index_inv_photographer_billings_on_user_id"
  end

  create_table "inv_photographer_closing_amounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "photographer_closing_id", null: false
    t.decimal "vat_rate", precision: 10, scale: 3, null: false
    t.decimal "grand_vat_total", precision: 10, scale: 3, null: false
    t.decimal "perpetual_vat_total", precision: 10, scale: 3, null: false
    t.string "hash_string"
    t.string "previous_hash_string"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["photographer_closing_id"], name: "index_photographer_closing_id"
  end

  create_table "inv_photographer_closings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.datetime "closing_date", null: false
    t.decimal "cumulative_total", precision: 10, scale: 3, null: false
    t.decimal "perpetual_total", precision: 10, scale: 3, null: false
    t.decimal "grand_vat_total", precision: 10, scale: 3, null: false
    t.decimal "perpetual_vat_total", precision: 10, scale: 3, null: false
    t.string "hash_string"
    t.string "previous_hash_string"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "inv_photographer_payment_amounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "photographer_payment_id", null: false
    t.decimal "vat_rate", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "vat", precision: 10, scale: 3, default: "0.0", null: false
    t.decimal "total_ht", precision: 10, scale: 3, default: "0.0", null: false
    t.text "hash_string"
    t.text "previous_hash_string"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["photographer_payment_id"], name: "index_photographer_payment_id"
  end

  create_table "inv_photographer_payment_lines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "photographer_payment_id", null: false
    t.integer "photographer_billing_id", null: false
    t.decimal "amount", precision: 10, scale: 3, default: "0.0", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "hash_string"
    t.string "previous_hash_string"
    t.index ["photographer_billing_id"], name: "index_inv_photographer_payment_lines_on_photographer_billing_id"
    t.index ["photographer_payment_id"], name: "index_inv_photographer_payment_lines_on_photographer_payment_id"
  end

  create_table "inv_photographer_payments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.integer "photographer_billing_company_id", null: false
    t.integer "payment_type_id", null: false
    t.date "payment_date", null: false
    t.decimal "total", precision: 10, scale: 3, default: "0.0", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "cancel_payment_id"
    t.index ["cancel_payment_id"], name: "index_inv_photographer_payments_on_cancel_payment_id"
    t.index ["photographer_billing_company_id"], name: "index_photographer_billing_company_id"
    t.index ["user_id"], name: "index_inv_photographer_payments_on_user_id"
  end

  create_table "inv_price_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "inv_right_owners", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "first_name"
    t.string "last_name"
    t.string "complement"
    t.string "address"
    t.string "zip_code"
    t.string "city"
    t.integer "country_id"
    t.string "phone"
    t.string "mobile"
    t.string "email"
    t.integer "language_id"
    t.integer "right_owner_type_id"
    t.integer "provider_id"
    t.integer "currency_id"
    t.integer "france_rate", default: 0, null: false
    t.integer "foreign_rate", default: 0, null: false
    t.boolean "avp", default: false, null: false
    t.boolean "csg", default: false, null: false
    t.integer "vat_id"
    t.integer "withholding_tax_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.string "creator_label"
    t.string "author_code"
    t.string "social_security_number"
    t.string "account_number"
    t.boolean "dispense_precompte", default: false, null: false
    t.string "vat_number"
    t.string "siret"
    t.string "agessa_number"
  end

  create_table "inv_simulations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "params"
    t.string "status", default: "unprocessed"
    t.text "error"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "inv_statement_lines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "statement_id", null: false
    t.integer "resource_line_id"
    t.integer "billing_line_id", null: false
    t.decimal "base", precision: 10, scale: 3, null: false
    t.decimal "rate", precision: 10, scale: 3, null: false
    t.decimal "amount", precision: 10, scale: 3, null: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "inv_statements", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.date "date"
    t.integer "right_owner_id"
    t.string "number"
    t.string "status", default: "pending"
    t.decimal "total_fees", precision: 10, scale: 3
    t.decimal "total_rights", precision: 10, scale: 3
    t.decimal "total_sales", precision: 10, scale: 3
    t.decimal "total_paid", precision: 10, scale: 3
    t.decimal "total", precision: 10, scale: 3
    t.decimal "avp_rate", precision: 10, scale: 3
    t.decimal "avp_amount", precision: 10, scale: 3
    t.decimal "base_fee_rate", precision: 10, scale: 3
    t.decimal "base_fee_amount", precision: 10, scale: 3
    t.decimal "csg_rate", precision: 10, scale: 3
    t.decimal "csg_amount", precision: 10, scale: 3
    t.decimal "rds_rate", precision: 10, scale: 3
    t.decimal "rds_amount", precision: 10, scale: 3
    t.decimal "ret_rate", precision: 10, scale: 3
    t.decimal "ret_amount", precision: 10, scale: 3
    t.decimal "vat_rate", precision: 10, scale: 3
    t.decimal "vat_amount", precision: 10, scale: 3
    t.integer "payment_type_id"
    t.date "payment_date"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.string "fees_description"
    t.decimal "fees_amount", precision: 10, scale: 3
    t.boolean "fees_addition", default: false, null: false
  end

  create_table "iptc_countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "code"
    t.string "en"
    t.string "fr"
  end

  create_table "jwt_blacklist", id: :integer, unsigned: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "jti"
    t.datetime "exp"
    t.index ["jti"], name: "jti"
  end

  create_table "light_box_images", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "annotation"
    t.integer "light_box_id"
    t.integer "image_id"
    t.integer "position"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["image_id"], name: "index_light_box_images_on_image_id"
    t.index ["light_box_id"], name: "index_light_box_images_on_light_box_id"
  end

  create_table "light_boxes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.boolean "order_by_agency", default: false
    t.string "name"
    t.integer "user_id"
    t.integer "title_id"
    t.string "hash_code"
    t.integer "items_count", default: 0
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "permission", limit: 1, default: 0
    t.index ["name"], name: "index_light_boxes_on_name"
    t.index ["user_id"], name: "index_light_boxes_on_user_id"
  end

  create_table "locales", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "key", null: false, collation: "latin1_swedish_ci"
    t.text "text_en", collation: "latin1_swedish_ci"
    t.text "text_fr", collation: "latin1_swedish_ci"
    t.index ["key"], name: "index_locales_on_key", unique: true
  end

  create_table "metadata_conversions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "image"
    t.string "iptc"
    t.string "eightbim"
    t.string "xmp"
  end

  create_table "net_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "message", null: false
    t.text "answer"
    t.datetime "answered_at"
    t.boolean "skipable", default: false, null: false
    t.integer "server_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "operation_labels", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "label"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "paniers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "reportage_id", null: false
    t.integer "user_id", null: false
    t.index ["reportage_id"], name: "index_paniers_on_reportage_id"
    t.index ["user_id"], name: "index_paniers_on_user_id"
  end

  create_table "parameters", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "key", null: false, collation: "latin1_swedish_ci"
    t.string "value", collation: "latin1_swedish_ci"
    t.index ["key"], name: "index_parameters_on_key", unique: true
  end

  create_table "permission_labels", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "label"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "photos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "photo"
    t.integer "user_id"
    t.string "description"
    t.string "credit"
    t.string "city"
    t.date "date_photo"
    t.string "reportage"
    t.string "keywords"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "up_country", default: ""
    t.string "source", default: ""
    t.index ["user_id"], name: "index_photos_on_user_id"
  end

  create_table "pixtech_params", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
    t.string "name"
    t.text "value"
    t.integer "pixtech_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["pixtech_id"], name: "index_pixtech_params_on_pixtech_id"
  end

  create_table "pixteches", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["name"], name: "index_pixteches_on_name", unique: true
  end

  create_table "prov_to_apis", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "login"
    t.string "mot_passe"
    t.string "string_key"
    t.string "email"
    t.index ["email"], name: "index_prov_to_apis_on_email"
    t.index ["login"], name: "index_prov_to_apis_on_login"
    t.index ["string_key"], name: "index_prov_to_apis_on_string_key"
  end

  create_table "provider_contacts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.boolean "main"
    t.string "first_name"
    t.string "last_name"
    t.string "email", limit: 100
    t.string "fax"
    t.string "phone"
    t.boolean "receive_requests"
    t.integer "provider_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "portable"
    t.boolean "receive_stat"
    t.boolean "receive_errors", default: false
    t.boolean "receive_demand", default: false
    t.integer "receive_alert", limit: 1, default: 0
  end

  create_table "provider_for_search_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "search_stat_id", default: 0
    t.integer "provider_id", default: 0
    t.integer "result", default: 0
    t.text "provs"
    t.index ["provider_id"], name: "index_provider_for_search_stats_on_provider_id"
    t.index ["search_stat_id"], name: "index_provider_for_search_stats_on_search_stat_id"
  end

  create_table "provider_response_to_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "request_to_provider_id"
    t.integer "image_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["request_to_provider_id"], name: "index_provider_response_to_requests_on_request_to_provider_id"
  end

  create_table "provider_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
    t.string "name"
  end

  create_table "providers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "logo"
    t.string "description", limit: 750
    t.string "site"
    t.string "address"
    t.boolean "local", default: false
    t.string "copyright_rule"
    t.string "string_key"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "days_keep"
    t.boolean "days_keep_per_picture", default: false
    t.boolean "form_per_session", default: false
    t.string "provider_conditions"
    t.string "input_dir"
    t.string "city"
    t.string "country"
    t.string "zip_code"
    t.string "text_prices_url"
    t.boolean "actif", default: true
    t.integer "toomany_limit", default: 0
    t.boolean "in_pixtrakk", default: true
    t.string "pp_name"
    t.string "pdf"
    t.string "formu"
    t.string "name_order"
    t.string "cgv", default: ""
    t.boolean "exhaustivity", default: false
    t.integer "provider_type_id", default: 1
    t.string "pp_string_key"
    t.integer "pixtech_id"
    t.integer "days_keep_alert"
    t.integer "toomany_limit_alert", default: 0
    t.boolean "visible", default: true, null: false
    t.string "copyright_symbol"
    t.index ["pixtech_id"], name: "index_providers_on_pixtech_id"
    t.index ["pp_name"], name: "index_providers_on_pp_name"
  end

  create_table "refresh_providers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "provider_id"
    t.integer "total_update", default: 0
    t.integer "nb_updated", default: 0
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["provider_id"], name: "index_refresh_providers_on_provider_id"
  end

  create_table "reportage_photos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "reportage_id"
    t.bigint "photo_ms_id"
    t.integer "rang", default: 0
    t.index ["photo_ms_id"], name: "index_reportage_photos_on_photo_ms_id"
    t.index ["reportage_id"], name: "index_reportage_photos_on_reportage_id"
  end

  create_table "reportages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "no_reportage"
    t.string "string_key", limit: 70
    t.integer "nb_photos", default: 0
    t.bigint "prem_photo", null: false
    t.string "rep_titre", limit: 192
    t.text "rep_texte"
    t.date "rep_date"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "signatur", limit: 192
    t.boolean "offre", default: false
    t.index ["nb_photos"], name: "index_reportages_on_nb_photos"
    t.index ["no_reportage"], name: "index_reportages_on_no_reportage"
    t.index ["offre"], name: "index_reportages_on_offre"
    t.index ["rep_date"], name: "index_reportages_on_rep_date"
    t.index ["rep_titre"], name: "index_reportages_on_rep_titre"
    t.index ["signatur"], name: "index_reportages_on_signatur"
    t.index ["string_key"], name: "index_reportages_on_string_key"
  end

  create_table "reqphotos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "reqphoto_file_name", limit: 100
    t.string "reqphoto_content_type", limit: 20
    t.integer "reqphoto_file_size"
    t.datetime "reqphoto_updated_at"
    t.integer "request_to_provider_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "copied_to_ms", default: 0
    t.index ["request_to_provider_id"], name: "index_reqphotos_on_request_to_provider_id"
  end

  create_table "request_to_providers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "text"
    t.date "view_date"
    t.string "status"
    t.string "subject"
    t.integer "responses_count", default: 0
    t.integer "user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "serial"
    t.index ["user_id"], name: "index_request_to_providers_on_user_id"
  end

  create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "permissions"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "saved_searches", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "name"
    t.datetime "date"
    t.datetime "date_last_search"
    t.integer "photos_count"
    t.text "criteria"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "search_image_fields", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "search_stat_id", default: 0
    t.string "field_name", limit: 50
    t.string "field_content", limit: 100
    t.text "iptc"
    t.index ["search_stat_id"], name: "index_search_image_fields_on_search_stat_id"
  end

  create_table "search_provider_group_names", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", null: false
    t.integer "user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["name", "user_id"], name: "index_search_provider_group_names_on_name_and_user_id", unique: true
  end

  create_table "search_provider_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "provider_id"
    t.integer "search_provider_group_name_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "search_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "keyword"
    t.string "since", limit: 50
    t.string "tri", limit: 50
    t.date "date_pp_from"
    t.date "date_pp_to"
    t.date "date_photo_from"
    t.date "date_photo_to"
    t.integer "format"
    t.integer "result", default: 0
    t.integer "user_id"
    t.datetime "created_at"
    t.string "serv_name", limit: 100
    t.integer "cs_stat_id", default: 0
    t.datetime "cs_created"
    t.index ["result"], name: "index_search_stats_on_result"
    t.index ["user_id"], name: "index_search_stats_on_user_id"
  end

  create_table "selected_providers_for_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "request_to_provider_id"
    t.integer "provider_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "servers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "status"
    t.string "host"
    t.string "name"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "which_type"
    t.boolean "is_self", default: false, null: false
    t.string "api_key"
    t.string "api_port", default: "5671", null: false
    t.string "public_url"
    t.string "internal_url"
    t.string "backoffice_url"
  end

  create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
    t.string "session_id", null: false
    t.text "data"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["session_id"], name: "index_sessions_on_session_id", unique: true
    t.index ["updated_at"], name: "index_sessions_on_updated_at"
  end

  create_table "settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "language"
    t.text "preferential_corpus"
    t.text "display_params"
    t.text "border_color_provider"
    t.integer "user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "time_zone"
    t.integer "default_per_page", default: 0, null: false
    t.string "default_since", default: "all", null: false
    t.string "default_sort", default: "reception_date", null: false
    t.integer "reload_pref", default: 0
    t.string "default_media", default: "all"
    t.boolean "pagination", default: true
    t.string "under_my_thumb", default: "normalized_credit"
    t.index ["user_id"], name: "index_settings_on_user_id"
  end

  create_table "statistics", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "image_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean "delta", default: true
    t.integer "operation_label_id"
    t.index ["image_id"], name: "index_statistics_on_image_id"
    t.index ["user_id"], name: "index_statistics_on_user_id"
  end

  create_table "sync_logs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "status"
    t.string "server_type"
    t.string "server_name"
    t.string "data_type"
    t.integer "internal_id"
    t.integer "external_id"
    t.text "record_data"
    t.text "sync_data"
    t.text "error"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["data_type"], name: "index_sync_logs_on_data_type"
    t.index ["server_type"], name: "index_sync_logs_on_server_type"
    t.index ["status"], name: "index_sync_logs_on_status"
  end

  create_table "title_provider_group_names", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "country_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["name", "country_id"], name: "index_title_provider_group_names_on_name_and_country_id", unique: true
  end

  create_table "title_provider_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "title_provider_group_name_id"
    t.integer "provider_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["title_provider_group_name_id"], name: "index_title_provider_groups_on_title_provider_group_name_id"
  end

  create_table "titles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.boolean "hide_unauthorized_providers", default: true
    t.integer "dpi", default: 75
    t.string "flow_path"
    t.integer "title_provider_group_name_id"
    t.integer "server_id"
    t.integer "country_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "first_name", limit: 100, default: ""
    t.string "last_name", limit: 100, default: ""
    t.string "address", limit: 150, default: ""
    t.string "zip_code", limit: 10, default: ""
    t.string "city", limit: 150, default: ""
    t.string "phone", limit: 20, default: ""
    t.string "email", limit: 100, default: ""
    t.string "comment", limit: 500, default: ""
    t.integer "visible", default: 0
    t.string "group", limit: 100, default: ""
    t.string "title_type", limit: 100, default: ""
    t.string "visible_name", limit: 100, default: ""
    t.string "ojd_link", limit: 150, default: ""
    t.string "status", default: "active", null: false
    t.integer "billing_company_id"
    t.index ["billing_company_id"], name: "index_titles_on_billing_company_id"
    t.index ["title_provider_group_name_id"], name: "index_on_title_provider_group_name_id"
  end

  create_table "updated_list_providers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "refresh_provider_id"
    t.integer "nb_photos", default: 0
    t.datetime "action_date"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "visionneuse", default: ""
    t.index ["refresh_provider_id"], name: "index_updated_list_providers_on_refresh_provider_id"
  end

  create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "login"
    t.string "first_name", limit: 100, default: ""
    t.string "last_name", limit: 100, default: ""
    t.string "email", limit: 100
    t.string "crypted_password", limit: 128, default: "", null: false
    t.string "salt", limit: 128, default: "", null: false
    t.datetime "remember_token_expires_at"
    t.datetime "activated_at"
    t.string "phone"
    t.string "fax"
    t.integer "numero_tva", default: 0, unsigned: true
    t.string "company", limit: 40
    t.string "job", limit: 40
    t.string "activity_sector", limit: 60
    t.string "service", limit: 40
    t.string "billing_address"
    t.string "billing_company"
    t.string "city"
    t.string "password_reset_code"
    t.string "zip_code", limit: 20
    t.text "permissions"
    t.integer "title_id"
    t.integer "role_id"
    t.integer "country_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "login_key"
    t.string "persistence_token", null: false
    t.string "perishable_token", null: false
    t.integer "login_count"
    t.integer "failed_login_count"
    t.datetime "last_request_at"
    t.datetime "current_login_at"
    t.datetime "last_login_at"
    t.string "current_login_ip"
    t.string "last_login_ip"
    t.date "deactivation_at"
    t.date "password_updated_at"
    t.integer "roles_mask", default: 4
    t.string "address"
    t.string "status", default: "active", null: false
    t.integer "max_daily_downloads", default: 0, null: false
    t.string "civility"
    t.string "job_title"
    t.string "industry"
    t.string "position"
    t.string "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.index ["login"], name: "index_users_on_login", unique: true
    t.index ["login_key"], name: "index_users_on_login_key", unique: true
    t.index ["roles_mask"], name: "index_users_on_roles_mask"
  end

  create_table "versions", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "item_type", limit: 191, null: false
    t.bigint "item_id", null: false
    t.string "event", null: false
    t.string "whodunnit"
    t.text "object", size: :long
    t.datetime "created_at"
    t.text "object_changes", size: :long
    t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
  end

  add_foreign_key "pixtech_params", "pixteches"
end
