# 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: 2020_03_17_223341) do

  create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.boolean "enabled", default: true
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "admin_admin_roles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "admin_id"
    t.bigint "admin_role_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["admin_id"], name: "index_admin_admin_roles_on_admin_id"
    t.index ["admin_role_id"], name: "index_admin_admin_roles_on_admin_role_id"
  end

  create_table "admin_permission_admin_roles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "admin_permission_id"
    t.bigint "admin_role_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["admin_permission_id"], name: "index_admin_permission_admin_roles_on_admin_permission_id"
    t.index ["admin_role_id"], name: "index_admin_permission_admin_roles_on_admin_role_id"
  end

  create_table "admin_permissions", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.string "code"
    t.string "slug"
    t.integer "parent_id"
    t.integer "position"
  end

  create_table "admin_preferences", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "admin_id"
    t.string "key"
    t.text "value"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["admin_id"], name: "index_admin_preferences_on_admin_id"
  end

  create_table "admin_roles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", 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 "admins", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "firstname"
    t.string "avatar"
    t.string "username", default: ""
    t.string "email", default: ""
    t.string "password_digest", default: ""
    t.string "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer "sign_in_count", default: 0
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string "current_sign_in_ip"
    t.string "last_sign_in_ip"
    t.string "remember_token"
    t.integer "p_commercial_id"
    t.boolean "super_admin", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "albums", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.boolean "super_admin", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "block_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "style"
    t.integer "nbr_columns"
    t.integer "row1"
    t.integer "row2"
    t.integer "row3"
    t.integer "row4"
    t.bigint "image_file_id"
    t.integer "margin_top"
    t.integer "margin_bottom"
    t.integer "margin_left"
    t.integer "margin_right"
    t.integer "padding_top"
    t.integer "padding_bottom"
    t.integer "padding_left"
    t.integer "padding_right"
    t.boolean "parallax", default: false
    t.boolean "center", default: false
    t.integer "center_width"
    t.string "background_color"
    t.string "gradient_start"
    t.string "gradient_stop"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["image_file_id"], name: "index_block_contents_on_image_file_id"
  end

  create_table "blocks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "lang_site_id"
    t.string "block_name"
    t.string "blockable_type"
    t.bigint "blockable_id"
    t.text "content"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["blockable_id"], name: "index_blocks_on_blockable_id"
    t.index ["lang_site_id"], name: "index_blocks_on_lang_site_id"
  end

  create_table "break_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.boolean "line", default: false
    t.integer "height"
    t.string "style"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "categories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "slug"
    t.boolean "enabled", default: false
    t.text "description"
    t.integer "image_file_id"
    t.integer "position"
    t.bigint "parent_id"
    t.string "permalink"
    t.boolean "front_page", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["parent_id"], name: "index_categories_on_parent_id"
  end

  create_table "category_categoryables", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "category_id"
    t.string "categoryable_type"
    t.integer "categoryable_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["category_id"], name: "index_category_categoryables_on_category_id"
  end

  create_table "category_langs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "slug"
    t.text "description"
    t.integer "image_file_id"
    t.bigint "lang_site_id"
    t.bigint "category_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["category_id"], name: "index_category_langs_on_category_id"
    t.index ["lang_site_id"], name: "index_category_langs_on_lang_site_id"
  end

  create_table "cel_tables", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "position"
    t.integer "style"
    t.bigint "table_row_id"
    t.integer "table_content_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["table_row_id"], name: "index_cel_tables_on_table_row_id"
  end

  create_table "comments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "pseudo", default: ""
    t.string "email", default: ""
    t.string "website", default: ""
    t.boolean "enabled", default: false
    t.text "comment"
    t.string "commentable_type"
    t.bigint "commentable_id"
    t.integer "user_id"
    t.bigint "parent_id"
    t.boolean "notified", default: false
    t.datetime "notified_at"
    t.bigint "lang_site_id", default: 1
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["commentable_id"], name: "index_comments_on_commentable_id"
    t.index ["lang_site_id"], name: "index_comments_on_lang_site_id"
    t.index ["parent_id"], name: "index_comments_on_parent_id"
  end

  create_table "contacts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "civilite"
    t.string "firstname"
    t.string "name"
    t.string "address"
    t.string "address2"
    t.string "cp"
    t.string "city"
    t.string "country"
    t.string "phone"
    t.string "token"
    t.string "email"
    t.string "website"
    t.integer "raison_id"
    t.text "message"
    t.text "notes"
    t.integer "survey_set_id"
    t.string "raison_text"
    t.text "objet"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "data_file_categories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "slug"
    t.integer "parent_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "data_file_passwords", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "data_file_id"
    t.string "token"
    t.text "description"
    t.integer "nbr_downloads"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["data_file_id"], name: "index_data_file_passwords_on_data_file_id"
  end

  create_table "data_files", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "file"
    t.string "name"
    t.string "slug"
    t.string "token"
    t.string "description"
    t.bigint "file_folder_id"
    t.string "title"
    t.text "long_desc"
    t.boolean "boutique", default: false
    t.bigint "data_file_category_id"
    t.bigint "image_file_id"
    t.text "yumpu_content"
    t.boolean "show_yumpu", default: false
    t.bigint "square_image_file_id"
    t.boolean "order_link", default: false
    t.boolean "download_link", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["data_file_category_id"], name: "index_data_files_on_data_file_category_id"
    t.index ["file_folder_id"], name: "index_data_files_on_file_folder_id"
    t.index ["image_file_id"], name: "index_data_files_on_image_file_id"
    t.index ["square_image_file_id"], name: "index_data_files_on_square_image_file_id"
  end

  create_table "download_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "title"
    t.string "style"
    t.text "description"
    t.bigint "data_file_id"
    t.boolean "boutique", default: false
    t.boolean "show_yumpu", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["data_file_id"], name: "index_download_contents_on_data_file_id"
  end

  create_table "dynamic_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", 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 "edit_watchers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "element_type"
    t.integer "element_id"
    t.string "key"
    t.bigint "admin_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["admin_id"], name: "index_edit_watchers_on_admin_id"
  end

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

  create_table "external_links", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "title"
    t.text "description"
    t.string "url"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "file_folders", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.boolean "super_admin", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "gallery_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "style"
    t.integer "nbr_img"
    t.boolean "with_legend", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "gallery_images", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "title"
    t.text "description"
    t.string "tags"
    t.integer "position"
    t.bigint "image_file_id"
    t.bigint "gallery_content_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["gallery_content_id"], name: "index_gallery_images_on_gallery_content_id"
    t.index ["image_file_id"], name: "index_gallery_images_on_image_file_id"
  end

  create_table "hashtaggings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "hashtag_id"
    t.string "hashtaggable_type"
    t.bigint "hashtaggable_id"
    t.integer "lang_site_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["hashtag_id"], name: "index_hashtaggings_on_hashtag_id"
    t.index ["hashtaggable_id"], name: "index_hashtaggings_on_hashtaggable_id"
  end

  create_table "hashtags", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.boolean "enabled", default: false
    t.integer "lang_site_id"
    t.string "slug"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "html_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.text "content"
    t.string "style"
    t.string "content_type"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "i_task_projects", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "slug"
    t.bigint "admin_id"
    t.text "description"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["admin_id"], name: "index_i_task_projects_on_admin_id"
  end

  create_table "i_tasks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "i_task_project_id"
    t.string "name"
    t.text "descritpion"
    t.date "end_at"
    t.integer "image_file_id"
    t.boolean "done", default: false
    t.integer "minutes"
    t.bigint "admin_id"
    t.date "done_at"
    t.boolean "urgent", default: false
    t.integer "i_previ_id"
    t.integer "i_task_type_id"
    t.boolean "from_customer", default: false
    t.integer "i_task_bill_state_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["admin_id"], name: "index_i_tasks_on_admin_id"
    t.index ["i_task_project_id"], name: "index_i_tasks_on_i_task_project_id"
  end

  create_table "image_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "image_file_id"
    t.integer "width"
    t.integer "height"
    t.string "alignement"
    t.boolean "expandable", default: false
    t.string "style"
    t.string "alt"
    t.bigint "cible_id"
    t.string "cible_type"
    t.boolean "with_cible", default: false
    t.boolean "popup", default: false
    t.integer "margin_top"
    t.integer "margin_left"
    t.integer "margin_right"
    t.integer "margin_bottom"
    t.boolean "with_legend", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["cible_id"], name: "index_image_contents_on_cible_id"
    t.index ["image_file_id"], name: "index_image_contents_on_image_file_id"
  end

  create_table "image_files", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "file"
    t.string "name"
    t.string "slug"
    t.text "description"
    t.string "tags"
    t.integer "album_id"
    t.string "photograph"
    t.string "cible_type"
    t.integer "cible_id"
    t.string "origin_name"
    t.string "token_s"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "lang_articles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.datetime "published_at"
    t.string "title"
    t.string "slug"
    t.text "description"
    t.text "keywords"
    t.boolean "enabled", default: false
    t.bigint "image_file_id"
    t.boolean "title_cached", default: false
    t.string "tags_cache"
    t.string "tags_cache_slug"
    t.bigint "lang_site_id"
    t.bigint "article_id"
    t.string "html_title"
    t.string "fb_title"
    t.string "twitter_title"
    t.text "twitter_description"
    t.integer "without_text_image_file_id"
    t.bigint "slider_image_file_id"
    t.text "chapeau"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["article_id"], name: "index_lang_articles_on_article_id"
    t.index ["image_file_id"], name: "index_lang_articles_on_image_file_id"
    t.index ["lang_site_id"], name: "index_lang_articles_on_lang_site_id"
    t.index ["slider_image_file_id"], name: "index_lang_articles_on_slider_image_file_id"
  end

  create_table "lang_pages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "lang_site_id"
    t.bigint "page_id"
    t.text "title"
    t.text "description"
    t.text "keywords"
    t.string "twitter_title"
    t.text "twitter_description"
    t.bigint "without_text_image_file_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["lang_site_id"], name: "index_lang_pages_on_lang_site_id"
    t.index ["page_id"], name: "index_lang_pages_on_page_id"
    t.index ["without_text_image_file_id"], name: "index_lang_pages_on_without_text_image_file_id"
  end

  create_table "lang_sites", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "slug"
    t.boolean "enabled", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "link_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "type"
    t.string "name"
    t.string "title"
    t.boolean "popup", default: false
    t.string "url"
    t.string "style"
    t.bigint "cible_id"
    t.string "cible_type"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["cible_id"], name: "index_link_contents_on_cible_id"
  end

  create_table "mail_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "lang_site_id"
    t.bigint "mail_type_id"
    t.string "subject"
    t.text "message"
    t.boolean "enabled", default: false
    t.string "content_type"
    t.text "tags"
    t.bigint "mail_template_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["lang_site_id"], name: "index_mail_contents_on_lang_site_id"
    t.index ["mail_template_id"], name: "index_mail_contents_on_mail_template_id"
    t.index ["mail_type_id"], name: "index_mail_contents_on_mail_type_id"
  end

  create_table "mail_profiles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "civilite"
    t.string "firstname"
    t.string "name"
    t.string "address"
    t.string "address2"
    t.string "cp"
    t.string "city"
    t.string "country"
    t.string "email"
    t.string "phone"
    t.string "token"
    t.string "provider"
    t.string "uid"
    t.string "facebook_token"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "mail_templates", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "title"
    t.text "template_html"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "mail_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "slug"
    t.string "default_title"
    t.text "default_message"
    t.bigint "mail_type_reference_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["mail_type_reference_id"], name: "index_mail_types_on_mail_type_reference_id"
  end

  create_table "map_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "address"
    t.string "name"
    t.integer "view"
    t.boolean "info_bule", default: false
    t.integer "zoom"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "market_discounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.decimal "min", precision: 10
    t.decimal "max", precision: 10
    t.decimal "percent", precision: 10
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.integer "p_customer_cat_id", default: 1
  end

  create_table "menu_aliases", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "menu_item_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["menu_item_id"], name: "index_menu_aliases_on_menu_item_id"
  end

  create_table "menu_item_articles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "menu_item_id"
    t.bigint "article_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["article_id"], name: "index_menu_item_articles_on_article_id"
    t.index ["menu_item_id"], name: "index_menu_item_articles_on_menu_item_id"
  end

  create_table "menu_item_categories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "menu_item_id"
    t.bigint "category_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["category_id"], name: "index_menu_item_categories_on_category_id"
    t.index ["menu_item_id"], name: "index_menu_item_categories_on_menu_item_id"
  end

  create_table "menu_item_langs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "lang_site_id"
    t.string "name"
    t.string "slug"
    t.string "permalink"
    t.boolean "enabled", default: false
    t.boolean "visible", default: false
    t.bigint "menu_item_id"
    t.bigint "image_file_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["image_file_id"], name: "index_menu_item_langs_on_image_file_id"
    t.index ["lang_site_id"], name: "index_menu_item_langs_on_lang_site_id"
    t.index ["menu_item_id"], name: "index_menu_item_langs_on_menu_item_id"
  end

  create_table "menu_item_link_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "menu_item_id"
    t.bigint "image_file_id"
    t.string "title"
    t.text "description"
    t.string "url"
    t.boolean "popup", default: false
    t.string "style"
    t.string "block_type"
    t.bigint "cible_id"
    t.string "cible_type"
    t.decimal "proportion", precision: 14, scale: 2
    t.integer "level"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["cible_id"], name: "index_menu_item_link_contents_on_cible_id"
    t.index ["image_file_id"], name: "index_menu_item_link_contents_on_image_file_id"
    t.index ["menu_item_id"], name: "index_menu_item_link_contents_on_menu_item_id"
  end

  create_table "menu_item_slug_histories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "permalink"
    t.string "locale"
    t.integer "menu_item_id"
    t.bigint "menu_item_lang_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["menu_item_lang_id"], name: "index_menu_item_slug_histories_on_menu_item_lang_id"
  end

  create_table "menu_item_tags", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "menu_item_id"
    t.bigint "tag_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["menu_item_id"], name: "index_menu_item_tags_on_menu_item_id"
    t.index ["tag_id"], name: "index_menu_item_tags_on_tag_id"
  end

  create_table "menu_items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "slug"
    t.string "permalink"
    t.bigint "image_file_id"
    t.string "section_name"
    t.integer "section_id"
    t.string "repertoire_name"
    t.integer "repertoire_id"
    t.bigint "parent_id"
    t.integer "position"
    t.boolean "super_admin", default: false
    t.boolean "enabled", default: false
    t.boolean "visible", default: false
    t.boolean "deleted", default: false
    t.bigint "menu_id"
    t.bigint "menu_content_id"
    t.string "menu_content_type"
    t.integer "archive_id"
    t.boolean "archived", default: false
    t.datetime "archived_at"
    t.boolean "password", default: false
    t.boolean "comment", default: false
    t.boolean "sidebar", default: false
    t.boolean "title_image", default: false
    t.string "title_image_style"
    t.boolean "title_cached", default: false
    t.bigint "icon_image_file_id"
    t.bigint "icon_b_image_file_id"
    t.text "primary_description"
    t.bigint "icon_v_image_file_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["icon_b_image_file_id"], name: "index_menu_items_on_icon_b_image_file_id"
    t.index ["icon_image_file_id"], name: "index_menu_items_on_icon_image_file_id"
    t.index ["icon_v_image_file_id"], name: "index_menu_items_on_icon_v_image_file_id"
    t.index ["image_file_id"], name: "index_menu_items_on_image_file_id"
    t.index ["menu_content_id"], name: "index_menu_items_on_menu_content_id"
    t.index ["menu_id"], name: "index_menu_items_on_menu_id"
    t.index ["parent_id"], name: "index_menu_items_on_parent_id"
  end

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

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

  create_table "open_range_elements", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "open_range_id"
    t.string "element_type"
    t.integer "element_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

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

  create_table "p_bank_accounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_bank_id"
    t.string "iban"
    t.string "bic"
    t.string "compta_cpt"
    t.string "compta_journ"
    t.string "compta_aux"
    t.bigint "p_fournisseur_id"
    t.bigint "p_customer_id"
    t.boolean "owner", default: false
    t.bigint "data_file_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["data_file_id"], name: "index_p_bank_accounts_on_data_file_id"
    t.index ["p_bank_id"], name: "index_p_bank_accounts_on_p_bank_id"
    t.index ["p_customer_id"], name: "index_p_bank_accounts_on_p_customer_id"
    t.index ["p_fournisseur_id"], name: "index_p_bank_accounts_on_p_fournisseur_id"
  end

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

  create_table "p_brut_products", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.decimal "price", precision: 14, scale: 2
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

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

  create_table "p_commercials", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.boolean "enabled", default: true
    t.string "code"
    t.string "organisation"
    t.string "civilite"
    t.string "name"
    t.string "firstname"
    t.string "address_number"
    t.string "address_1"
    t.string "address_2"
    t.string "address_3"
    t.string "cp"
    t.string "city"
    t.string "country"
    t.string "phone"
    t.string "email"
    t.string "token"
    t.integer "p_commercial_cat_id"
    t.string "ac_display_name"
    t.string "cc_display_name"
    t.date "start_at"
    t.date "stop_at"
    t.text "secteur"
    t.boolean "avenant"
    t.date "birth"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_compta_elements", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "element_type"
    t.bigint "element_id"
    t.bigint "p_customer_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.date "cc_element_date"
    t.date "ac_element_date"
    t.boolean "cc_solde"
    t.boolean "ac_solde"
    t.decimal "ac_amount", precision: 14, scale: 2
    t.decimal "cc_amount", precision: 14, scale: 2
    t.index ["element_id"], name: "index_p_compta_elements_on_element_id"
    t.index ["p_customer_id"], name: "index_p_compta_elements_on_p_customer_id"
  end

  create_table "p_compta_exports", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.date "start_at"
    t.date "end_at"
    t.text "comment"
    t.boolean "validated", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_contact_contact_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_contact_id"
    t.bigint "p_contact_type_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_contact_id"], name: "index_p_contact_contact_types_on_p_contact_id"
    t.index ["p_contact_type_id"], name: "index_p_contact_contact_types_on_p_contact_type_id"
  end

  create_table "p_contact_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", 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 "p_contacts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.text "comment"
    t.string "tel"
    t.string "email"
    t.boolean "bc", default: false
    t.boolean "boolean", default: false
    t.bigint "contactable_id"
    t.string "contactable_type"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["contactable_id"], name: "index_p_contacts_on_contactable_id"
  end

  create_table "p_customer_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "code"
    t.integer "payment_days"
    t.decimal "encourt_max", precision: 14, scale: 2
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_customer_ribs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "nbr_use"
    t.string "iban"
    t.string "bic"
    t.string "bank"
    t.string "num_compte"
    t.string "intitule"
    t.string "address1"
    t.string "cp"
    t.string "city"
    t.string "country"
    t.string "rum"
    t.boolean "import", default: false
    t.boolean "archived", default: false
    t.integer "price_document_id"
    t.integer "p_mandat_id"
    t.date "sign_date"
    t.boolean "pres_sepa", default: false
    t.bigint "p_customer_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_customer_id"], name: "index_p_customer_ribs_on_p_customer_id"
  end

  create_table "p_customer_sheets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "state"
    t.string "comments"
    t.bigint "p_customer_id"
    t.integer "p_commercial_id"
    t.integer "particular_bill_id"
    t.integer "particular_send_id"
    t.integer "ref_particular_bill_id"
    t.integer "ref_particular_send_id"
    t.integer "ac_accounting_zone_id"
    t.integer "cc_accounting_zone_id"
    t.string "ac_accounting_zone_name"
    t.string "cc_accounting_zone_name"
    t.decimal "ac_tot_amount_ht", precision: 14, scale: 2
    t.decimal "cc_tot_amount_ht", precision: 14, scale: 2
    t.decimal "ac_tot_amount_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_amount_ttc", precision: 14, scale: 2
    t.decimal "ac_tot_amount_tva", precision: 14, scale: 2
    t.decimal "cc_tot_amount_tva", precision: 14, scale: 2
    t.string "token"
    t.integer "p_payment_type_id"
    t.boolean "ac_payment_comptant"
    t.boolean "cc_payment_comptant"
    t.integer "ac_payment_delais"
    t.integer "cc_payment_delais"
    t.boolean "ac_payment_month_end"
    t.boolean "cc_payment_month_end"
    t.date "ac_payment_end_at"
    t.date "cc_payment_end_at"
    t.integer "ac_payment_days"
    t.integer "cc_payment_days"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.boolean "archived"
    t.string "demande_type"
    t.integer "com_counter_index"
    t.string "cc_com_counter"
    t.string "ac_com_counter"
    t.index ["p_customer_id"], name: "index_p_customer_sheets_on_p_customer_id"
  end

  create_table "p_customer_sites", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_customer_id"
    t.string "name"
    t.bigint "particular_id"
    t.string "comments"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_customer_id"], name: "index_p_customer_sites_on_p_customer_id"
    t.index ["particular_id"], name: "index_p_customer_sites_on_particular_id"
  end

  create_table "p_customers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.decimal "encourt_max", precision: 14, scale: 2
    t.bigint "p_customer_cat_id"
    t.bigint "particular_id"
    t.string "name"
    t.string "code"
    t.boolean "fav", default: false
    t.boolean "facture_email", default: false
    t.boolean "risque", default: false
    t.integer "admin_id"
    t.decimal "cache_ca", precision: 14, scale: 2
    t.decimal "cache_encours", precision: 14, scale: 2
    t.integer "cache_moyenne_paiement"
    t.integer "payment_days"
    t.integer "parent_id"
    t.string "mlm_token"
    t.string "parent_code"
    t.boolean "parent_at_create", default: false
    t.boolean "imported", default: false
    t.boolean "facture_mail", default: false
    t.boolean "comptant", default: true
    t.boolean "acompte", default: false
    t.decimal "acompte_percent", precision: 14, scale: 2
    t.integer "payment_delais"
    t.boolean "payment_fin_de_mois", default: false
    t.decimal "cache_encours_th", precision: 14, scale: 2
    t.decimal "cache_payments_th", precision: 14, scale: 2
    t.decimal "cache_payments", precision: 14, scale: 2
    t.decimal "cache_payments_tot", precision: 14, scale: 2
    t.integer "p_payment_type_id"
    t.string "i_actif"
    t.boolean "i_cat", default: false
    t.decimal "cache_ca_ttc", precision: 14, scale: 2
    t.integer "p_commercial_id"
    t.integer "accounting_zone_id"
    t.bigint "market_discount_id"
    t.string "siret"
    t.string "tva_intra"
    t.text "closed_day"
    t.boolean "discount_enrobage", default: false
    t.boolean "discount_comptant", default: false
    t.boolean "discount_ecole", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.boolean "enabled", default: true
    t.text "disabled_raison"
    t.string "siren"
    t.datetime "import_created_at"
    t.string "website"
    t.string "soumis_tva"
    t.text "p_customer_sheet_note"
    t.index ["market_discount_id"], name: "index_p_customers_on_market_discount_id"
    t.index ["p_customer_cat_id"], name: "index_p_customers_on_p_customer_cat_id"
    t.index ["particular_id"], name: "index_p_customers_on_particular_id"
  end

  create_table "p_document_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "prefix"
    t.string "label"
    t.string "affix"
    t.text "header"
    t.text "footer"
    t.integer "image_file_id"
    t.bigint "data_file_id"
    t.string "class_type"
    t.string "sub_type"
    t.string "name"
    t.boolean "enabled", default: false
    t.integer "position"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["data_file_id"], name: "index_p_document_types_on_data_file_id"
  end

  create_table "p_documents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "element_type"
    t.bigint "element_id"
    t.bigint "p_document_type_id"
    t.bigint "particular_bill_id"
    t.bigint "particular_send_id"
    t.string "name"
    t.string "d_number"
    t.integer "d_index"
    t.integer "d_year"
    t.string "d_prefix"
    t.string "label"
    t.text "header"
    t.text "footer"
    t.integer "image_file_id"
    t.integer "data_file_id"
    t.string "token"
    t.bigint "p_sheet_line_id"
    t.string "bl_type"
    t.decimal "cache_total_ht", precision: 14, scale: 2
    t.decimal "cache_total_ttc", precision: 14, scale: 2
    t.decimal "cache_tva", precision: 14, scale: 2
    t.integer "payment_days"
    t.datetime "cache_exp_date"
    t.bigint "p_customer_id"
    t.boolean "theo_paid", default: false
    t.datetime "theo_paid_at"
    t.boolean "paid", default: false
    t.datetime "paid_at"
    t.decimal "acompte_percent", precision: 14, scale: 2
    t.decimal "acompte_value", precision: 14, scale: 2
    t.boolean "imported", default: false
    t.decimal "cache_to_paid", precision: 14, scale: 2
    t.decimal "cache_to_th_paid", precision: 14, scale: 2
    t.decimal "cache_total_tva", precision: 14, scale: 2
    t.boolean "comptant", default: true
    t.boolean "acompte", default: false
    t.integer "payment_delais"
    t.boolean "payment_fin_de_mois", default: false
    t.bigint "p_payment_type_id"
    t.bigint "p_ship_tour_truck_id"
    t.boolean "canceled", default: false
    t.boolean "i_archive", default: false
    t.string "cust_ref"
    t.integer "doc_ref_id"
    t.date "echeance_date"
    t.text "avoir_text"
    t.string "doc_ref_number"
    t.boolean "i_ajust", default: false
    t.boolean "i_ajust_result", default: false
    t.integer "p_commercial_id"
    t.integer "p_compta_export_id"
    t.boolean "compta_locked", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["element_id"], name: "index_p_documents_on_element_id"
    t.index ["p_customer_id"], name: "index_p_documents_on_p_customer_id"
    t.index ["p_document_type_id"], name: "index_p_documents_on_p_document_type_id"
    t.index ["p_payment_type_id"], name: "index_p_documents_on_p_payment_type_id"
    t.index ["p_sheet_line_id"], name: "index_p_documents_on_p_sheet_line_id"
    t.index ["p_ship_tour_truck_id"], name: "index_p_documents_on_p_ship_tour_truck_id"
    t.index ["particular_bill_id"], name: "index_p_documents_on_particular_bill_id"
    t.index ["particular_send_id"], name: "index_p_documents_on_particular_send_id"
  end

  create_table "p_fournisseur_orders", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "ref"
    t.decimal "amount", precision: 14, scale: 2
    t.datetime "enter_date"
    t.bigint "p_fournisseur_id"
    t.decimal "a_ok_total_ttc", precision: 14, scale: 2
    t.decimal "a_ok_total_ht", precision: 14, scale: 2
    t.decimal "a_ok_tva", precision: 14, scale: 2
    t.decimal "a_total_ttc", precision: 14, scale: 2
    t.decimal "a_total_ht", precision: 14, scale: 2
    t.decimal "a_tva", precision: 14, scale: 2
    t.integer "p_compta_export_id"
    t.boolean "compta_locked", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_fournisseur_id"], name: "index_p_fournisseur_orders_on_p_fournisseur_id"
  end

  create_table "p_fournisseurs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "code"
    t.string "address1"
    t.string "address2"
    t.string "cp"
    t.string "city"
    t.string "country"
    t.string "email"
    t.string "tel"
    t.string "compta_account"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_payment_documents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_payment_id"
    t.bigint "p_document_id"
    t.decimal "amount", precision: 14, scale: 2
    t.boolean "paid", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.integer "price_document_id"
    t.index ["p_document_id"], name: "index_p_payment_documents_on_p_document_id"
    t.index ["p_payment_id"], name: "index_p_payment_documents_on_p_payment_id"
  end

  create_table "p_payment_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "code"
    t.boolean "enabled", default: false
    t.boolean "comptant", default: false
    t.integer "signe"
    t.bigint "p_bank_account_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_bank_account_id"], name: "index_p_payment_types_on_p_bank_account_id"
  end

  create_table "p_payments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.datetime "paid_at"
    t.datetime "theo_date"
    t.bigint "p_payment_type_id"
    t.decimal "amount", precision: 14, scale: 2
    t.string "number"
    t.bigint "p_customer_id"
    t.boolean "paid", default: false
    t.boolean "canceled", default: false
    t.boolean "affected", default: false
    t.bigint "p_ship_tour_truck_sheet_line_id"
    t.bigint "p_sheet_line_id"
    t.boolean "imported", default: false
    t.string "label"
    t.string "piece"
    t.boolean "i_archive", default: false
    t.boolean "remise", default: false
    t.bigint "p_remise_id"
    t.boolean "i_ajust", default: false
    t.boolean "i_ajust_result", default: false
    t.date "received_at"
    t.date "past_paid_at"
    t.date "past_theo_date"
    t.boolean "past_diff", default: false
    t.bigint "p_bank_account_id"
    t.integer "p_compta_export_id"
    t.boolean "compta_locked", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.decimal "cc_total_affected", precision: 14, scale: 2
    t.decimal "ac_total_affected", precision: 14, scale: 2
    t.decimal "cc_reste_to_affect", precision: 14, scale: 2
    t.decimal "ac_reste_to_affect", precision: 14, scale: 2
    t.boolean "cc_affected", default: false
    t.boolean "ac_affected", default: false
    t.integer "price_document_id"
    t.index ["p_bank_account_id"], name: "index_p_payments_on_p_bank_account_id"
    t.index ["p_customer_id"], name: "index_p_payments_on_p_customer_id"
    t.index ["p_payment_type_id"], name: "index_p_payments_on_p_payment_type_id"
    t.index ["p_remise_id"], name: "index_p_payments_on_p_remise_id"
    t.index ["p_sheet_line_id"], name: "index_p_payments_on_p_sheet_line_id"
    t.index ["p_ship_tour_truck_sheet_line_id"], name: "index_p_payments_on_p_ship_tour_truck_sheet_line_id"
  end

  create_table "p_price_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.boolean "enabled", default: true
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_product_brut_products", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_brut_product_id"
    t.bigint "p_product_id"
    t.decimal "qte", precision: 14, scale: 2
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_brut_product_id"], name: "index_p_product_brut_products_on_p_brut_product_id"
    t.index ["p_product_id"], name: "index_p_product_brut_products_on_p_product_id"
  end

  create_table "p_product_brut_stocks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_brut_product_id"
    t.bigint "p_fournisseur_order_id"
    t.bigint "p_tank_id"
    t.decimal "qte", precision: 14, scale: 2
    t.decimal "price", precision: 14, scale: 2
    t.datetime "ok_at"
    t.decimal "ok_qte", precision: 14, scale: 2
    t.decimal "ok_price", precision: 14, scale: 2
    t.decimal "ok_price_abs", precision: 14, scale: 2
    t.decimal "price_abs", precision: 14, scale: 2
    t.boolean "ok", default: false
    t.decimal "qte_restant", precision: 14, scale: 2, default: "0.0"
    t.boolean "lock", default: false
    t.string "stock_type"
    t.boolean "externe", default: false
    t.boolean "comptabilised", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_brut_product_id"], name: "index_p_product_brut_stocks_on_p_brut_product_id"
    t.index ["p_fournisseur_order_id"], name: "index_p_product_brut_stocks_on_p_fournisseur_order_id"
    t.index ["p_tank_id"], name: "index_p_product_brut_stocks_on_p_tank_id"
  end

  create_table "p_product_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "code"
    t.string "purchase_account"
    t.string "sale_account"
    t.integer "parent_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_product_feature_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.boolean "enabled"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_product_features", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "p_product_feature_cat_id"
    t.string "ac_name"
    t.string "cc_name"
    t.string "value"
    t.integer "p_product_ref_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_product_p_customer_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_product_id"
    t.bigint "p_customer_cat_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_customer_cat_id"], name: "index_p_product_p_customer_cats_on_p_customer_cat_id"
    t.index ["p_product_id"], name: "index_p_product_p_customer_cats_on_p_product_id"
  end

  create_table "p_product_p_normes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_product_id"
    t.bigint "p_product_spec_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_product_id"], name: "index_p_product_p_normes_on_p_product_id"
    t.index ["p_product_spec_id"], name: "index_p_product_p_normes_on_p_product_spec_id"
  end

  create_table "p_product_p_product_sub_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_product_id"
    t.bigint "p_product_sub_cat_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_product_id"], name: "index_p_product_p_product_sub_cats_on_p_product_id"
    t.index ["p_product_sub_cat_id"], name: "index_p_product_p_product_sub_cats_on_p_product_sub_cat_id"
  end

  create_table "p_product_prices", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.boolean "enabled", default: true
    t.bigint "p_product_ref_id"
    t.bigint "p_price_cat_id"
    t.integer "min"
    t.integer "max"
    t.decimal "ct_price_ht", precision: 14, scale: 2
    t.integer "past_p_product_price"
    t.datetime "remove_at"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_price_cat_id"], name: "index_p_product_prices_on_p_price_cat_id"
    t.index ["p_product_ref_id"], name: "index_p_product_prices_on_p_product_ref_id"
  end

  create_table "p_product_ref_price_histories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_product_ref_id"
    t.decimal "price", precision: 14, scale: 2
    t.bigint "admin_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["admin_id"], name: "index_p_product_ref_price_histories_on_admin_id"
    t.index ["p_product_ref_id"], name: "index_p_product_ref_price_histories_on_p_product_ref_id"
  end

  create_table "p_product_refs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "ref"
    t.integer "p_product_id"
    t.decimal "ct_price_ht", precision: 14, scale: 2
    t.string "cc_name"
    t.string "ac_name"
    t.decimal "weight", precision: 14, scale: 2
    t.string "ct_sub_name"
    t.integer "cc_p_product_cat_id"
    t.integer "ac_p_product_cat_id"
    t.string "uv"
    t.string "capacite"
    t.string "cc_sub_cat_names"
    t.string "ac_sub_cat_names"
    t.string "cc_cat_name"
    t.string "ac_cat_name"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.boolean "no_remise", default: false
  end

  create_table "p_product_specs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_product_id"
    t.string "code"
    t.text "description"
    t.boolean "un", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_product_id"], name: "index_p_product_specs_on_p_product_id"
  end

  create_table "p_product_sub_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "parent_id"
    t.string "code"
    t.string "name"
    t.integer "position"
    t.boolean "enabled"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "p_products", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.decimal "ct_price_ht", precision: 14, scale: 2
    t.decimal "ct_purchase_price_ht", precision: 14, scale: 2
    t.bigint "p_product_cat_id"
    t.string "code"
    t.string "sub_code"
    t.string "conditionnement"
    t.string "uv"
    t.boolean "tgap", default: false
    t.boolean "fisc", default: false
    t.string "un"
    t.decimal "capacite", precision: 14, scale: 2
    t.boolean "enabled", default: true
    t.bigint "s_brand_id"
    t.boolean "discount_enrobage", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.integer "p_customer_id"
    t.boolean "imported", default: false
    t.text "note"
    t.integer "a_code_tva"
    t.string "price_calc", default: "Kg"
    t.string "country"
    t.string "sub_country"
    t.string "domaine"
    t.index ["p_product_cat_id"], name: "index_p_products_on_p_product_cat_id"
    t.index ["s_brand_id"], name: "index_p_products_on_s_brand_id"
  end

  create_table "p_remises", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.date "date"
    t.boolean "validated", default: false
    t.bigint "p_payment_type_id"
    t.bigint "p_bank_account_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_bank_account_id"], name: "index_p_remises_on_p_bank_account_id"
    t.index ["p_payment_type_id"], name: "index_p_remises_on_p_payment_type_id"
  end

  create_table "p_sheet_line_stocks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_sheet_line_id"
    t.bigint "p_brut_product_id"
    t.bigint "p_product_brut_stock_id"
    t.boolean "ok", default: false
    t.datetime "ok_at"
    t.decimal "qte", precision: 14, scale: 2
    t.decimal "qte_ok", precision: 14, scale: 2
    t.decimal "price", precision: 14, scale: 2
    t.decimal "price_ok", precision: 14, scale: 2
    t.boolean "lock", default: false
    t.boolean "decr", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_brut_product_id"], name: "index_p_sheet_line_stocks_on_p_brut_product_id"
    t.index ["p_product_brut_stock_id"], name: "index_p_sheet_line_stocks_on_p_product_brut_stock_id"
    t.index ["p_sheet_line_id"], name: "index_p_sheet_line_stocks_on_p_sheet_line_id"
  end

  create_table "p_sheet_lines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_customer_sheet_id"
    t.bigint "p_product_id"
    t.bigint "p_tank_id"
    t.decimal "qte", precision: 14, scale: 2
    t.decimal "price", precision: 14, scale: 2
    t.datetime "ok_at"
    t.decimal "ok_qte", precision: 14, scale: 2
    t.decimal "ok_price", precision: 14, scale: 2
    t.decimal "ok_price_abs", precision: 14, scale: 2
    t.boolean "ok", default: false
    t.boolean "lock", default: false
    t.boolean "externe", default: false
    t.integer "externe_stock_id"
    t.bigint "p_document_id"
    t.boolean "shiped", default: false
    t.boolean "bl", default: false
    t.boolean "ship", default: false
    t.integer "p_ship_tour_truck_sheet_line_id"
    t.boolean "stock_done", default: false
    t.decimal "a_total_cost_ok", precision: 14, scale: 2
    t.string "ref"
    t.decimal "price_tot", precision: 14, scale: 2
    t.decimal "price_tot_ttc", precision: 14, scale: 2
    t.decimal "ok_price_tot", precision: 14, scale: 2
    t.decimal "ok_price_tot_ttc", precision: 14, scale: 2
    t.boolean "imported", default: false
    t.string "piece"
    t.boolean "arrondi", default: false
    t.boolean "decr", default: false
    t.string "custom_title"
    t.text "custom_desc"
    t.boolean "no_stock", default: false
    t.boolean "custom", default: false
    t.string "element_label"
    t.boolean "cancel", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_customer_sheet_id"], name: "index_p_sheet_lines_on_p_customer_sheet_id"
    t.index ["p_document_id"], name: "index_p_sheet_lines_on_p_document_id"
    t.index ["p_product_id"], name: "index_p_sheet_lines_on_p_product_id"
    t.index ["p_tank_id"], name: "index_p_sheet_lines_on_p_tank_id"
  end

  create_table "p_ship_bill_lines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_ship_bill_id"
    t.string "name"
    t.text "description"
    t.decimal "qte", precision: 14, scale: 2
    t.decimal "price", precision: 14, scale: 2
    t.decimal "a_ok_total", precision: 14, scale: 2
    t.boolean "paid", default: false
    t.date "paid_at"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_ship_bill_id"], name: "index_p_ship_bill_lines_on_p_ship_bill_id"
  end

  create_table "p_ship_bills", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.date "count_date"
    t.date "bill_at"
    t.string "ref"
    t.bigint "p_fournisseur_id"
    t.text "comment"
    t.decimal "a_ok_total", precision: 14, scale: 2
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_fournisseur_id"], name: "index_p_ship_bills_on_p_fournisseur_id"
  end

  create_table "p_tank_stocks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.datetime "ok_at"
    t.boolean "enabled", default: false
    t.bigint "p_brut_product_id"
    t.decimal "volume", precision: 14, scale: 2
    t.decimal "price", precision: 14, scale: 2
    t.bigint "p_tank_id"
    t.string "stock_type"
    t.decimal "volume_abs", precision: 14, scale: 2
    t.decimal "volume_restant", precision: 14, scale: 2
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_brut_product_id"], name: "index_p_tank_stocks_on_p_brut_product_id"
    t.index ["p_tank_id"], name: "index_p_tank_stocks_on_p_tank_id"
  end

  create_table "p_tanks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.decimal "volume", precision: 14, scale: 2
    t.bigint "p_brut_product_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_brut_product_id"], name: "index_p_tanks_on_p_brut_product_id"
  end

  create_table "p_truck_spaces", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.decimal "volume", precision: 14, scale: 2
    t.bigint "p_truck_id"
    t.integer "default_p_tank_id"
    t.string "code"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["p_truck_id"], name: "index_p_truck_spaces_on_p_truck_id"
  end

  create_table "pages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.text "title"
    t.text "description"
    t.text "keywords"
    t.integer "lang_site_id"
    t.integer "page_type_id", default: 1
    t.boolean "clikable", default: true
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "particulars", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.boolean "pro", default: false
    t.string "organisation"
    t.string "name"
    t.string "firstname"
    t.string "address_1"
    t.string "address_2"
    t.string "address_3"
    t.string "address_4"
    t.string "address_5"
    t.string "cp"
    t.string "city"
    t.string "country"
    t.string "tel"
    t.string "email"
    t.string "tel2"
    t.string "tel3"
    t.string "fax"
    t.string "owner_type"
    t.bigint "owner_id"
    t.string "particular_type"
    t.boolean "skip_validation", default: false
    t.string "civilite"
    t.boolean "archived", default: false
    t.integer "particular_ref_id"
    t.boolean "price_in_bl", default: true
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.string "com_name"
    t.index ["owner_id"], name: "index_particulars_on_owner_id"
  end

  create_table "portlets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "block_id"
    t.bigint "content_id"
    t.string "content_type"
    t.integer "position"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["block_id"], name: "index_portlets_on_block_id"
    t.index ["content_id"], name: "index_portlets_on_content_id"
  end

  create_table "price_document_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "prefix"
    t.string "label"
    t.string "affix"
    t.text "header"
    t.text "footer"
    t.integer "image_file_id"
    t.integer "data_file_id"
    t.string "class_type"
    t.string "sub_type"
    t.boolean "enabled", default: true
    t.string "movement_type", default: "cred"
    t.boolean "accounting", default: false
    t.integer "poisition"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "price_documents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.boolean "archived"
    t.bigint "p_customer_id"
    t.integer "p_commercial_id"
    t.string "movement_type"
    t.boolean "accounting", default: false
    t.boolean "soldable", default: false
    t.datetime "date"
    t.integer "ac_accounting_zone_id"
    t.integer "cc_accounting_zone_id"
    t.string "ac_accounting_zone_name"
    t.string "cc_accounting_zone_name"
    t.decimal "ac_tot_amount_ht", precision: 14, scale: 2
    t.decimal "cc_tot_amount_ht", precision: 14, scale: 2
    t.decimal "ac_tot_amount_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_amount_ttc", precision: 14, scale: 2
    t.decimal "ac_tot_amount_tva", precision: 14, scale: 2
    t.decimal "cc_tot_amount_tva", precision: 14, scale: 2
    t.string "d_number"
    t.integer "d_index"
    t.integer "d_year"
    t.integer "d_month"
    t.integer "d_day"
    t.string "d_prefix"
    t.boolean "solded", default: false
    t.boolean "imported", default: false
    t.string "ref_element_type"
    t.integer "ref_element_id"
    t.integer "price_document_type_id"
    t.string "ac_label"
    t.string "cc_label"
    t.string "token"
    t.text "ct_header"
    t.text "ac_header"
    t.text "cc_header"
    t.text "ct_footer"
    t.text "ac_footer"
    t.text "cc_footer"
    t.integer "ac_payment_days"
    t.integer "cc_payment_days"
    t.datetime "paid_at"
    t.integer "ct_payment_delais"
    t.integer "ac_payment_delais"
    t.integer "cc_payment_delais"
    t.boolean "ct_payment_month_end"
    t.boolean "ac_payment_month_end"
    t.boolean "cc_payment_month_end"
    t.date "ac_payment_end_at"
    t.date "cc_payment_end_at"
    t.integer "doc_ref_id"
    t.boolean "accounting_locked", default: false
    t.integer "particular_bill_id"
    t.integer "particular_send_id"
    t.integer "ac_particular_bill_id"
    t.integer "ac_particular_send_id"
    t.decimal "ac_to_paid_ht", precision: 14, scale: 2
    t.decimal "cc_to_paid_ht", precision: 14, scale: 2
    t.decimal "ac_to_paid_ttc", precision: 14, scale: 2
    t.decimal "cc_to_paid_ttc", precision: 14, scale: 2
    t.decimal "ac_to_paid_tva", precision: 14, scale: 2
    t.decimal "cc_to_paid_tva", precision: 14, scale: 2
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.boolean "cc_solded"
    t.boolean "ac_solded"
    t.integer "p_payment_type_id"
    t.index ["p_customer_id"], name: "index_price_documents_on_p_customer_id"
  end

  create_table "price_line_blocks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "p_customer_id"
    t.integer "p_commercial_id"
    t.integer "ac_p_customer_cat_id"
    t.integer "cc_p_customer_cat_id"
    t.integer "particular_bill_id"
    t.integer "particular_send_id"
    t.integer "ref_particular_bill_id"
    t.integer "ref_particular_send_id"
    t.boolean "archived"
    t.string "movement_type", default: "cred"
    t.boolean "accounting", default: false
    t.integer "price_lineable_id"
    t.string "price_lineable_type"
    t.date "ct_creation_date"
    t.date "cc_creation_date"
    t.date "ac_creation_date"
    t.date "wish_date"
    t.date "estimate_date"
    t.boolean "cc_remise_enrobage_ok"
    t.boolean "cc_remise_ecole_ok"
    t.boolean "ac_remise_enrobage_ok"
    t.boolean "ac_remise_ecole_ok"
    t.string "customer_ref"
    t.integer "ct_nbr_ship"
    t.integer "ac_nbr_ship"
    t.integer "cc_nbr_ship"
    t.integer "ac_accounting_zone_id"
    t.integer "cc_accounting_zone_id"
    t.string "ac_accounting_zone_name"
    t.string "cc_accounting_zone_name"
    t.decimal "ac_tot_lines_ht", precision: 14, scale: 2
    t.decimal "cc_tot_lines_ht", precision: 14, scale: 2
    t.decimal "ac_tot_lines_tva", precision: 14, scale: 2
    t.decimal "cc_tot_lines_tva", precision: 14, scale: 2
    t.decimal "ac_tot_lines_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_lines_ttc", precision: 14, scale: 2
    t.decimal "ct_tot_discount_percent", precision: 5, scale: 2
    t.decimal "ct_tot_discount_value", precision: 14, scale: 2
    t.decimal "ac_tot_discount_ht", precision: 14, scale: 2
    t.decimal "cc_tot_discount_ht", precision: 14, scale: 2
    t.decimal "ac_tot_discount_tva", precision: 14, scale: 2
    t.decimal "cc_tot_discount_tva", precision: 14, scale: 2
    t.decimal "ac_tot_discount_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_discount_ttc", precision: 14, scale: 2
    t.decimal "ac_fdp_tva_rate", precision: 14, scale: 2
    t.decimal "cc_fdp_tva_rate", precision: 14, scale: 2
    t.decimal "ct_tot_fdp_ht", precision: 14, scale: 2
    t.decimal "ac_tot_fdp_ht", precision: 14, scale: 2
    t.decimal "cc_tot_fdp_ht", precision: 14, scale: 2
    t.decimal "ac_tot_fdp_tva", precision: 14, scale: 2
    t.decimal "cc_tot_fdp_tva", precision: 14, scale: 2
    t.decimal "ac_tot_fdp_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_fdp_ttc", precision: 14, scale: 2
    t.decimal "ac_tot_amount_af_discount_ht", precision: 14, scale: 2
    t.decimal "cc_tot_amount_af_discount_ht", precision: 14, scale: 2
    t.decimal "ac_tot_amount_af_discount_tva", precision: 14, scale: 2
    t.decimal "cc_tot_amount_af_discount_tva", precision: 14, scale: 2
    t.decimal "ac_tot_amount_af_discount_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_amount_af_discount_ttc", precision: 14, scale: 2
    t.decimal "ct_gen_discount_percent", precision: 5, scale: 2
    t.decimal "ct_gen_discount_value", precision: 14, scale: 2
    t.decimal "ac_gen_discount_percent", precision: 5, scale: 2
    t.decimal "cc_gen_discount_percent", precision: 14, scale: 2
    t.decimal "ac_tot_gen_discount_ht", precision: 14, scale: 2
    t.decimal "cc_tot_gen_discount_ht", precision: 14, scale: 2
    t.decimal "ac_tot_gen_discount_tva", precision: 14, scale: 2
    t.decimal "cc_tot_gen_discount_tva", precision: 14, scale: 2
    t.decimal "ac_tot_gen_discount_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_gen_discount_ttc", precision: 14, scale: 2
    t.decimal "ac_tot_amount_ht", precision: 14, scale: 2
    t.decimal "cc_tot_amount_ht", precision: 14, scale: 2
    t.decimal "ac_tot_amount_tva", precision: 14, scale: 2
    t.decimal "cc_tot_amount_tva", precision: 14, scale: 2
    t.decimal "ac_tot_amount_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_amount_ttc", precision: 14, scale: 2
    t.decimal "ac_weight_tot", precision: 14, scale: 2
    t.decimal "cc_weight_tot", precision: 14, scale: 2
    t.integer "p_payment_type_id"
    t.boolean "ct_payment_comptant"
    t.boolean "ac_payment_comptant"
    t.boolean "cc_payment_comptant"
    t.integer "ct_payment_delais"
    t.integer "ac_payment_delais"
    t.integer "cc_payment_delais"
    t.boolean "ct_payment_month_end"
    t.boolean "ac_payment_month_end"
    t.boolean "cc_payment_month_end"
    t.date "ac_payment_end_at"
    t.date "cc_payment_end_at"
    t.boolean "ct_acompte"
    t.boolean "ac_acompte"
    t.boolean "cc_acompte"
    t.decimal "ct_acompte_percent", precision: 14, scale: 2
    t.decimal "ac_acompte_percent", precision: 14, scale: 2
    t.decimal "cc_acompte_percent", precision: 14, scale: 2
    t.integer "ac_payment_days"
    t.integer "cc_payment_days"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.text "bl_comment"
    t.text "f_comment"
    t.text "bc_comment"
    t.text "d_comment"
    t.text "a_comment"
    t.boolean "ac_remise_pre_order_ok"
    t.boolean "ac_remise_qte_ok"
    t.boolean "cc_remise_pre_order_ok"
    t.boolean "cc_remise_qte_ok"
    t.index ["p_customer_id"], name: "index_price_line_blocks_on_p_customer_id"
  end

  create_table "price_lines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.boolean "archived"
    t.integer "price_line_block_id"
    t.integer "position"
    t.string "line_type"
    t.integer "ac_accounting_zone_id"
    t.integer "cc_accounting_zone_id"
    t.string "ac_accounting_zone_name"
    t.string "cc_accounting_zone_name"
    t.integer "ac_tva_account_id"
    t.integer "cc_tva_account_id"
    t.decimal "ac_tva_account_value", precision: 5, scale: 2
    t.decimal "cc_tva_account_value", precision: 5, scale: 2
    t.integer "p_product_id"
    t.integer "p_product_variante_id"
    t.integer "p_product_alt_id"
    t.integer "p_product_alt_variante_id"
    t.integer "p_product_ref_id"
    t.integer "p_product_ref_variante_id"
    t.string "ct_ref"
    t.string "ac_ref"
    t.string "cc_ref"
    t.string "ct_title"
    t.string "ac_title"
    t.string "cc_title"
    t.boolean "ac_product_remise_enrobage_ok"
    t.boolean "cc_product_remise_enrobage_ok"
    t.string "ac_uv"
    t.string "cc_uv"
    t.text "ct_description"
    t.text "ac_description"
    t.text "cc_description"
    t.decimal "ct_u_price_ht", precision: 14, scale: 2
    t.decimal "ac_price_u_ht", precision: 14, scale: 2
    t.decimal "cc_price_u_ht", precision: 14, scale: 2
    t.decimal "ac_price_u_tva", precision: 14, scale: 2
    t.decimal "cc_price_u_tva", precision: 14, scale: 2
    t.decimal "ac_price_u_ttc", precision: 14, scale: 2
    t.decimal "cc_price_u_ttc", precision: 14, scale: 2
    t.integer "qte"
    t.decimal "ac_tot_line_ht", precision: 14, scale: 2
    t.decimal "cc_tot_line_ht", precision: 14, scale: 2
    t.decimal "ac_tot_line_tva", precision: 14, scale: 2
    t.decimal "cc_tot_line_tva", precision: 14, scale: 2
    t.decimal "ac_tot_line_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_line_ttc", precision: 14, scale: 2
    t.decimal "ac_discount_market_percent", precision: 14, scale: 2
    t.decimal "cc_discount_market_percent", precision: 14, scale: 2
    t.decimal "ac_discount_market_ht", precision: 14, scale: 2
    t.decimal "cc_discount_market_ht", precision: 14, scale: 2
    t.decimal "ac_discount_qte_percent", precision: 14, scale: 2
    t.decimal "cc_discount_qte_percent", precision: 14, scale: 2
    t.decimal "ac_discount_qte_ht", precision: 14, scale: 2
    t.decimal "cc_discount_qte_ht", precision: 14, scale: 2
    t.decimal "ac_discount_delay_percent", precision: 14, scale: 2
    t.decimal "cc_discount_delay_percent", precision: 14, scale: 2
    t.decimal "ac_discount_delay_ht", precision: 14, scale: 2
    t.decimal "cc_discount_delay_ht", precision: 14, scale: 2
    t.decimal "ac_discount_enrobage_percent", precision: 14, scale: 2
    t.decimal "cc_discount_enrobage_percent", precision: 14, scale: 2
    t.decimal "ac_discount_enrobage_ht", precision: 14, scale: 2
    t.decimal "cc_discount_enrobage_ht", precision: 14, scale: 2
    t.decimal "ac_discount_ecole_percent", precision: 14, scale: 2
    t.decimal "cc_discount_ecole_percent", precision: 14, scale: 2
    t.decimal "ac_discount_ecole_ht", precision: 14, scale: 2
    t.decimal "cc_discount_ecole_ht", precision: 14, scale: 2
    t.decimal "ac_discount_comptant_percent", precision: 14, scale: 2
    t.decimal "cc_discount_comptant_percent", precision: 14, scale: 2
    t.decimal "ac_discount_comptant_ht", precision: 14, scale: 2
    t.decimal "cc_discount_comptant_ht", precision: 14, scale: 2
    t.decimal "ac_tot_discount_ht", precision: 14, scale: 2
    t.decimal "cc_tot_discount_ht", precision: 14, scale: 2
    t.decimal "ac_tot_discount_tva", precision: 14, scale: 2
    t.decimal "cc_tot_discount_tva", precision: 14, scale: 2
    t.decimal "ac_tot_discount_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_discount_ttc", precision: 14, scale: 2
    t.decimal "ac_tot_amount_ht", precision: 14, scale: 2
    t.decimal "cc_tot_amount_ht", precision: 14, scale: 2
    t.decimal "ac_tot_amount_tva", precision: 14, scale: 2
    t.decimal "cc_tot_amount_tva", precision: 14, scale: 2
    t.decimal "ac_tot_amount_ttc", precision: 14, scale: 2
    t.decimal "cc_tot_amount_ttc", precision: 14, scale: 2
    t.integer "p_cter_id"
    t.decimal "ct_weight_u", precision: 14, scale: 2
    t.decimal "ac_weight_u", precision: 14, scale: 2
    t.decimal "cc_weight_u", precision: 14, scale: 2
    t.decimal "ac_weight_tot", precision: 14, scale: 2
    t.decimal "cc_weight_tot", precision: 14, scale: 2
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.integer "cc_p_product_specific_customer_id"
    t.integer "ac_p_product_specific_customer_id"
    t.string "ac_price_calc"
    t.string "cc_price_calc"
    t.boolean "cc_product_no_remise", default: false
    t.boolean "ac_product_no_remise"
  end

  create_table "quote_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.text "quote"
    t.string "author"
    t.string "color"
    t.string "background"
    t.string "style"
    t.bigint "image_file_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["image_file_id"], name: "index_quote_contents_on_image_file_id"
  end

  create_table "s_brands", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.boolean "enabled", default: true
    t.string "code"
    t.string "name"
    t.text "description"
    t.string "url"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "s_compta_accounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "code"
    t.string "name"
    t.string "i_account"
    t.string "i_sale_account"
    t.string "i_account_ps"
    t.string "zone"
    t.string "purchase_account"
    t.string "sale_account"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

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

  create_table "s_modules", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "serial_nbr"
    t.string "cache_long_serial_number"
    t.bigint "s_modules_state_id"
    t.date "order_date"
    t.date "production_start_date"
    t.date "production_end_date"
    t.bigint "s_module_configuration_id"
    t.bigint "s_site_id"
    t.string "name"
    t.text "description"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["s_module_configuration_id"], name: "index_s_modules_on_s_module_configuration_id"
    t.index ["s_modules_state_id"], name: "index_s_modules_on_s_modules_state_id"
    t.index ["s_site_id"], name: "index_s_modules_on_s_site_id"
  end

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

  create_table "s_organisations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "address1"
    t.string "address2"
    t.string "address3"
    t.string "tel"
    t.string "fax"
    t.string "email"
    t.string "website"
    t.string "siret"
    t.string "siren"
    t.string "rcs"
    t.string "ape"
    t.string "capital"
    t.string "forme"
    t.text "description"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

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

  create_table "s_sites", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.boolean "externe"
    t.bigint "s_site_type_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["s_site_type_id"], name: "index_s_sites_on_s_site_type_id"
  end

  create_table "share_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "url"
    t.string "facebook_url"
    t.boolean "facebook", default: false
    t.string "twitter_url"
    t.string "twitter_title"
    t.boolean "twitter", default: false
    t.string "mail_subject"
    t.string "mail_url"
    t.text "mail_content"
    t.boolean "mail", default: false
    t.string "print_url"
    t.boolean "print", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "specific_preferences", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "key"
    t.string "value"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "table_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "style"
    t.integer "nbr_rows"
    t.integer "nbr_cols"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "table_rows", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "position"
    t.integer "style"
    t.bigint "table_content_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["table_content_id"], name: "index_table_rows_on_table_content_id"
  end

  create_table "tag_taggables", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "taggable_type"
    t.bigint "taggable_id"
    t.bigint "tag_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["tag_id"], name: "index_tag_taggables_on_tag_id"
    t.index ["taggable_id"], name: "index_tag_taggables_on_taggable_id"
  end

  create_table "tags", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "slug"
    t.integer "parent_id"
    t.boolean "public", default: false
    t.string "taggable_type"
    t.bigint "taggable_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["taggable_id"], name: "index_tags_on_taggable_id"
  end

  create_table "text_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "style"
    t.text "content"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "timer_watchers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "element_type"
    t.integer "element_id"
    t.string "key"
    t.bigint "admin_id"
    t.bigint "p_customer_id"
    t.string "admin_space"
    t.datetime "end_at"
    t.integer "time_ok"
    t.boolean "write_action"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["admin_id"], name: "index_timer_watchers_on_admin_id"
    t.index ["p_customer_id"], name: "index_timer_watchers_on_p_customer_id"
  end

  create_table "tiny_urls", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "url"
    t.string "slug"
    t.text "description"
    t.datetime "start_at"
    t.datetime "stop_at"
    t.integer "nbr_views"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "title_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.text "content"
    t.integer "level"
    t.string "style"
    t.string "alignement"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "translations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "locale"
    t.string "key"
    t.text "value"
    t.text "interpolations"
    t.boolean "is_proc", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "tva_rates", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.bigint "accounting_zone_id"
    t.boolean "enabled", default: true
    t.decimal "rate", precision: 5, scale: 2
    t.string "purchase_account"
    t.string "sale_account"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["accounting_zone_id"], name: "index_tva_rates_on_accounting_zone_id"
  end

  create_table "tvable_tva_rates", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.integer "tvable_id"
    t.string "tvable_type"
    t.integer "tva_rate_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "video_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.bigint "video_file_id"
    t.string "title"
    t.boolean "download", default: false
    t.boolean "autoplay", default: false
    t.boolean "fullscreen", default: false
    t.boolean "controls", default: false
    t.string "legend"
    t.string "style"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["video_file_id"], name: "index_video_contents_on_video_file_id"
  end

  create_table "video_file_langs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "title"
    t.text "description"
    t.string "slug"
    t.bigint "video_file_id"
    t.bigint "lang_site_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["lang_site_id"], name: "index_video_file_langs_on_lang_site_id"
    t.index ["video_file_id"], name: "index_video_file_langs_on_video_file_id"
  end

  create_table "video_files", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "title"
    t.text "description"
    t.string "token"
    t.string "poster"
    t.string "mpg"
    t.string "ogg"
    t.string "webm"
    t.string "youtube_link"
    t.string "youtube_code"
    t.bigint "video_folder_id"
    t.string "slug"
    t.bigint "image_file_id"
    t.string "vimeo_code"
    t.boolean "public", default: false
    t.datetime "published_at"
    t.integer "position"
    t.boolean "fr", default: true
    t.boolean "en", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["image_file_id"], name: "index_video_files_on_image_file_id"
    t.index ["video_folder_id"], name: "index_video_files_on_video_folder_id"
  end

  create_table "video_folders", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
    t.string "name"
    t.boolean "super_admin", default: false
    t.text "description"
    t.boolean "public", default: false
    t.integer "position"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  add_foreign_key "admin_preferences", "admins"
  add_foreign_key "i_task_projects", "admins"
  add_foreign_key "i_tasks", "admins"
  add_foreign_key "i_tasks", "i_task_projects"
  add_foreign_key "p_contact_contact_types", "p_contact_types"
  add_foreign_key "p_contact_contact_types", "p_contacts"
  add_foreign_key "p_customer_ribs", "p_customers"
  add_foreign_key "p_product_p_customer_cats", "p_customer_cats"
  add_foreign_key "p_product_p_customer_cats", "p_products"
  add_foreign_key "p_product_p_product_sub_cats", "p_product_sub_cats"
  add_foreign_key "p_product_p_product_sub_cats", "p_products"
  add_foreign_key "p_product_prices", "p_price_cats"
  add_foreign_key "p_product_prices", "p_product_refs"
  add_foreign_key "p_product_ref_price_histories", "p_product_refs"
  add_foreign_key "s_modules", "s_modules_states"
  add_foreign_key "timer_watchers", "admins"
  add_foreign_key "tva_rates", "accounting_zones"
end
