# encoding: UTF-8
# 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.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180827155325) do

  create_table "abonnements", force: :cascade do |t|
    t.integer  "abonnement_type_id", limit: 4
    t.string   "slug",               limit: 255
    t.datetime "start_at"
    t.datetime "end_at"
    t.boolean  "paid"
    t.boolean  "enabled"
    t.decimal  "price",                          precision: 10, scale: 2
    t.integer  "customer_id",        limit: 4
    t.datetime "created_at",                                              null: false
    t.datetime "updated_at",                                              null: false
    t.integer  "reseaux_id",         limit: 4
  end

  create_table "accepted_offers", force: :cascade do |t|
    t.datetime "created_at",                                                     null: false
    t.datetime "updated_at",                                                     null: false
    t.integer  "offer_id",    limit: 4
    t.integer  "customer_id", limit: 4
    t.string   "devis",       limit: 255
    t.string   "state",       limit: 255
    t.string   "string",      limit: 255
    t.decimal  "qte",                     precision: 10, scale: 2, default: 1.0
  end

  add_index "accepted_offers", ["customer_id"], name: "index_accepted_offers_on_customer_id", using: :btree
  add_index "accepted_offers", ["offer_id"], name: "index_accepted_offers_on_offer_id", using: :btree

  create_table "admins", force: :cascade do |t|
    t.string   "name",                   limit: 255
    t.string   "firstname",              limit: 255
    t.string   "avatar",                 limit: 255
    t.string   "username",               limit: 255, default: "", null: false
    t.string   "email",                  limit: 255, default: "", null: false
    t.string   "password_digest",        limit: 255, default: "", null: false
    t.string   "reset_password_token",   limit: 255
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          limit: 4,   default: 0
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip",     limit: 255
    t.string   "last_sign_in_ip",        limit: 255
    t.string   "remember_token",         limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "albums", force: :cascade do |t|
    t.string   "name",        limit: 255
    t.boolean  "super_admin"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "archive_newsletters", force: :cascade do |t|
    t.integer  "newsletter_id", limit: 4
    t.string   "title",         limit: 255
    t.text     "content",       limit: 65535
    t.string   "email_from",    limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "archive_newsletters", ["newsletter_id"], name: "index_archive_newsletters_on_newsletter_id", using: :btree

  create_table "articles", force: :cascade do |t|
    t.datetime "published_at"
    t.string   "title",           limit: 255
    t.string   "slug",            limit: 255
    t.string   "tag",             limit: 255
    t.text     "description",     limit: 65535
    t.text     "keywords",        limit: 65535
    t.boolean  "enabled"
    t.integer  "image_file_id",   limit: 4
    t.boolean  "title_cached"
    t.string   "tags_cache",      limit: 255
    t.string   "tags_cache_slug", limit: 255
    t.integer  "category_id",     limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "block_contents", force: :cascade do |t|
    t.integer  "style",       limit: 4
    t.integer  "nbr_columns", limit: 4
    t.integer  "row1",        limit: 4
    t.integer  "row2",        limit: 4
    t.integer  "row3",        limit: 4
    t.integer  "row4",        limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "blocks", force: :cascade do |t|
    t.string   "block_name",     limit: 255
    t.string   "blockable_type", limit: 255
    t.integer  "blockable_id",   limit: 4
    t.text     "content",        limit: 65535
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "break_contents", force: :cascade do |t|
    t.boolean  "line"
    t.integer  "height",     limit: 4
    t.string   "style",      limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "categories", force: :cascade do |t|
    t.string   "name",          limit: 255
    t.string   "slug",          limit: 255
    t.boolean  "enabled"
    t.text     "description",   limit: 65535
    t.integer  "image_file_id", limit: 4
    t.integer  "position",      limit: 4
    t.integer  "parent_id",     limit: 4
    t.string   "permalink",     limit: 255
    t.boolean  "front_page"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "cel_tables", force: :cascade do |t|
    t.integer  "position",         limit: 4
    t.integer  "style",            limit: 4
    t.integer  "table_row_id",     limit: 4
    t.integer  "table_content_id", limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "comments", force: :cascade do |t|
    t.string   "pseudo",           limit: 255,   default: ""
    t.string   "email",            limit: 255,   default: ""
    t.string   "website",          limit: 255,   default: ""
    t.boolean  "enabled"
    t.text     "comment",          limit: 65535
    t.integer  "commentable_id",   limit: 4
    t.string   "commentable_type", limit: 255
    t.integer  "user_id",          limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "contact_messages", force: :cascade do |t|
    t.integer  "customer_id",      limit: 4
    t.integer  "admin_id",         limit: 4
    t.integer  "contact_id",       limit: 4
    t.datetime "deleted_at"
    t.boolean  "read_by_admin",                  default: false
    t.boolean  "read_by_customer",               default: false
    t.text     "content",          limit: 65535
    t.datetime "created_at",                                     null: false
    t.datetime "updated_at",                                     null: false
  end

  create_table "conversations", force: :cascade do |t|
    t.boolean  "oneone"
    t.integer  "first_customer_id",  limit: 4
    t.string   "second_customer_id", limit: 255
    t.datetime "created_at",                     null: false
    t.datetime "updated_at",                     null: false
  end

  create_table "customer_messages", force: :cascade do |t|
    t.string   "title",             limit: 255
    t.text     "message",           limit: 65535
    t.string   "tel",               limit: 255
    t.integer  "expediteur_id",     limit: 4
    t.string   "expediteur_mail",   limit: 255
    t.string   "destinataire_mail", limit: 255
    t.integer  "destinataire_id",   limit: 4
    t.integer  "parent_id",         limit: 4
    t.datetime "last_message_at"
    t.string   "remote_ip",         limit: 255
    t.boolean  "enabled"
    t.boolean  "readed"
    t.datetime "created_at",                      null: false
    t.datetime "updated_at",                      null: false
    t.integer  "conversation_id",   limit: 4
  end

  add_index "customer_messages", ["conversation_id"], name: "index_customer_messages_on_conversation_id", using: :btree

  create_table "customer_newsgroups", force: :cascade do |t|
    t.integer  "customer_id",  limit: 4
    t.integer  "newsgroup_id", limit: 4
    t.datetime "created_at",             null: false
    t.datetime "updated_at",             null: false
  end

  add_index "customer_newsgroups", ["customer_id"], name: "index_customer_newsgroups_on_customer_id", using: :btree
  add_index "customer_newsgroups", ["newsgroup_id"], name: "index_customer_newsgroups_on_newsgroup_id", using: :btree

  create_table "customers", force: :cascade do |t|
    t.integer  "parent_id",              limit: 4
    t.string   "parent_code",            limit: 255
    t.string   "parent_at_create",       limit: 255
    t.boolean  "archived"
    t.boolean  "enabled"
    t.string   "username",               limit: 255
    t.string   "name",                   limit: 255
    t.string   "firstname",              limit: 255
    t.string   "organisation",           limit: 255
    t.string   "siret",                  limit: 255
    t.string   "tva_number",             limit: 255
    t.text     "bio",                    limit: 65535
    t.string   "avatar",                 limit: 255
    t.string   "localisation",           limit: 255
    t.boolean  "pro",                                  default: false
    t.string   "token",                  limit: 255
    t.string   "mlm_token",              limit: 255
    t.string   "address",                limit: 255
    t.string   "address2",               limit: 255
    t.string   "cp",                     limit: 255
    t.string   "city",                   limit: 255
    t.string   "country",                limit: 255
    t.string   "phone",                  limit: 255
    t.text     "attentes",               limit: 65535
    t.text     "suggests",               limit: 65535
    t.text     "need_1",                 limit: 65535
    t.text     "need_2",                 limit: 65535
    t.text     "need_3",                 limit: 65535
    t.integer  "conseil_techniques",     limit: 4
    t.integer  "conseil_juridiques",     limit: 4
    t.integer  "conseil_gestion",        limit: 4
    t.integer  "courtage_gros",          limit: 4
    t.integer  "courtage_energie",       limit: 4
    t.integer  "courtage_info",          limit: 4
    t.integer  "courtage_pret",          limit: 4
    t.integer  "courtage_presta",        limit: 4
    t.integer  "courtage_autres",        limit: 4
    t.string   "email",                  limit: 255,   default: "",    null: false
    t.string   "password_digest",        limit: 255,   default: "",    null: false
    t.string   "reset_password_token",   limit: 255
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          limit: 4,     default: 0
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip",     limit: 255
    t.string   "last_sign_in_ip",        limit: 255
    t.boolean  "lock"
    t.datetime "locked_at"
    t.datetime "created_at",                                           null: false
    t.datetime "updated_at",                                           null: false
    t.boolean  "account_validated"
    t.datetime "account_validated_at"
    t.float    "latitude",               limit: 24
    t.float    "longitude",              limit: 24
    t.datetime "last_activity"
    t.text     "particulars_text",       limit: 65535
    t.float    "capital",                limit: 24
    t.string   "role_signataire",        limit: 255
    t.boolean  "referent",                             default: false
    t.boolean  "chef_reseau",                          default: false
    t.string   "reseaux_token",          limit: 255
    t.boolean  "particular_idem"
    t.integer  "particular_send_id",     limit: 4
    t.integer  "particular_bill_id",     limit: 4
  end

  create_table "data_files", force: :cascade do |t|
    t.string   "file",           limit: 255
    t.string   "name",           limit: 255
    t.string   "slug",           limit: 255
    t.string   "token",          limit: 255
    t.string   "description",    limit: 255
    t.integer  "file_folder_id", limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "documents", force: :cascade do |t|
    t.integer  "accepted_offer_id", limit: 4
    t.datetime "deleted_at"
    t.string   "title",             limit: 255
    t.string   "state",             limit: 255
    t.string   "document",          limit: 255
    t.string   "returned_document", limit: 255
    t.datetime "created_at",                    null: false
    t.datetime "updated_at",                    null: false
    t.boolean  "particulars"
    t.string   "download_token",    limit: 255
  end

  create_table "domain_customers", force: :cascade do |t|
    t.integer  "domain_id",   limit: 4
    t.integer  "customer_id", limit: 4
    t.datetime "created_at",            null: false
    t.datetime "updated_at",            null: false
  end

  add_index "domain_customers", ["customer_id"], name: "index_domain_customers_on_customer_id", using: :btree
  add_index "domain_customers", ["domain_id"], name: "index_domain_customers_on_domain_id", using: :btree

  create_table "domain_need_categories", force: :cascade do |t|
    t.integer  "domain_id",        limit: 4
    t.integer  "need_category_id", limit: 4
    t.datetime "created_at",                 null: false
    t.datetime "updated_at",                 null: false
  end

  add_index "domain_need_categories", ["domain_id"], name: "index_domain_need_categories_on_domain_id", using: :btree
  add_index "domain_need_categories", ["need_category_id"], name: "index_domain_need_categories_on_need_category_id", using: :btree

  create_table "domain_needs", force: :cascade do |t|
    t.integer  "domain_id",  limit: 4
    t.integer  "need_id",    limit: 4
    t.datetime "created_at",           null: false
    t.datetime "updated_at",           null: false
  end

  add_index "domain_needs", ["domain_id"], name: "index_domain_needs_on_domain_id", using: :btree
  add_index "domain_needs", ["need_id"], name: "index_domain_needs_on_need_id", using: :btree

  create_table "domains", force: :cascade do |t|
    t.string   "name",        limit: 255
    t.string   "slug",        limit: 255
    t.boolean  "superadmin"
    t.boolean  "enabled"
    t.text     "description", limit: 65535
    t.datetime "created_at",                null: false
    t.datetime "updated_at",                null: false
  end

  create_table "download_contents", force: :cascade do |t|
    t.string   "title",        limit: 255
    t.string   "style",        limit: 255
    t.text     "description",  limit: 65535
    t.integer  "data_file_id", limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "dynamic_contents", force: :cascade do |t|
    t.string   "name",       limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "external_links", force: :cascade do |t|
    t.string   "title",       limit: 255
    t.text     "description", limit: 65535
    t.string   "url",         limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "file_folders", force: :cascade do |t|
    t.string   "name",        limit: 255
    t.boolean  "super_admin"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "fournisseurs", force: :cascade do |t|
    t.string   "name",        limit: 255
    t.text     "description", limit: 65535
    t.string   "iban",        limit: 255
    t.string   "bic",         limit: 255
    t.datetime "created_at",                null: false
    t.datetime "updated_at",                null: false
    t.string   "email",       limit: 255
    t.boolean  "send_email"
  end

  create_table "gallery_contents", force: :cascade do |t|
    t.string   "name",        limit: 255
    t.text     "description", limit: 65535
    t.integer  "style",       limit: 4
    t.integer  "nbr_img",     limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "gallery_images", force: :cascade do |t|
    t.string   "title",              limit: 255
    t.text     "description",        limit: 65535
    t.string   "tags",               limit: 255
    t.integer  "position",           limit: 4
    t.integer  "image_file_id",      limit: 4
    t.integer  "gallery_content_id", limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "html_contents", force: :cascade do |t|
    t.text     "content",      limit: 65535
    t.string   "style",        limit: 255
    t.string   "content_type", limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "image_contents", force: :cascade do |t|
    t.integer  "image_file_id", limit: 4
    t.integer  "width",         limit: 4
    t.integer  "height",        limit: 4
    t.string   "alignement",    limit: 255
    t.boolean  "expandable"
    t.string   "style",         limit: 255
    t.string   "alt",           limit: 255
    t.integer  "cible_id",      limit: 4
    t.string   "cible_type",    limit: 255
    t.boolean  "with_cible"
    t.boolean  "popup"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "image_files", force: :cascade do |t|
    t.string   "file",        limit: 255
    t.string   "name",        limit: 255
    t.string   "slug",        limit: 255
    t.text     "description", limit: 65535
    t.string   "tags",        limit: 255
    t.integer  "album_id",    limit: 4
    t.string   "photograph",  limit: 255
    t.string   "cible_type",  limit: 255
    t.integer  "cible_id",    limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "lang_sites", force: :cascade do |t|
    t.string   "name",       limit: 255
    t.string   "slug",       limit: 255
    t.boolean  "enabled"
    t.datetime "created_at",             null: false
    t.datetime "updated_at",             null: false
  end

  create_table "link_contents", force: :cascade do |t|
    t.integer  "type",       limit: 4
    t.string   "name",       limit: 255
    t.string   "title",      limit: 255
    t.boolean  "popup"
    t.string   "url",        limit: 255
    t.string   "style",      limit: 255
    t.integer  "cible_id",   limit: 4
    t.string   "cible_type", limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "mail_archives", force: :cascade do |t|
    t.integer  "newsletter_id",         limit: 4
    t.integer  "archive_newsletter_id", limit: 4
    t.string   "email",                 limit: 255
    t.integer  "customer_id",           limit: 4
    t.string   "token",                 limit: 255
    t.boolean  "readed"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "mail_archives", ["archive_newsletter_id"], name: "index_mail_archives_on_archive_newsletter_id", using: :btree
  add_index "mail_archives", ["customer_id"], name: "index_mail_archives_on_customer_id", using: :btree
  add_index "mail_archives", ["newsletter_id"], name: "index_mail_archives_on_newsletter_id", using: :btree

  create_table "map_contents", force: :cascade do |t|
    t.string   "address",    limit: 255
    t.string   "name",       limit: 255
    t.integer  "view",       limit: 4
    t.boolean  "info_bule"
    t.integer  "zoom",       limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "menu_aliases", force: :cascade do |t|
    t.integer  "menu_item_id", limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "menu_items", force: :cascade do |t|
    t.string   "name",              limit: 255
    t.string   "slug",              limit: 255
    t.string   "permalink",         limit: 255
    t.string   "section_name",      limit: 255
    t.integer  "section_id",        limit: 4
    t.string   "repertoire_name",   limit: 255
    t.integer  "repertoire_id",     limit: 4
    t.integer  "parent_id",         limit: 4
    t.integer  "position",          limit: 4
    t.boolean  "super_admin"
    t.boolean  "enabled"
    t.boolean  "visible"
    t.boolean  "deleted"
    t.integer  "menu_id",           limit: 4
    t.integer  "menu_content_id",   limit: 4
    t.string   "menu_content_type", limit: 255
    t.integer  "archive_id",        limit: 4
    t.boolean  "archived"
    t.datetime "archived_at"
    t.boolean  "password"
    t.boolean  "comment"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "menu_urls", force: :cascade do |t|
    t.string   "url",        limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "menus", force: :cascade do |t|
    t.string   "name",       limit: 255
    t.string   "max_levels", limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "messages", force: :cascade do |t|
    t.datetime "created_at",                null: false
    t.datetime "updated_at",                null: false
    t.integer  "customer_id", limit: 4
    t.integer  "need_id",     limit: 4
    t.text     "content",     limit: 65535
    t.integer  "admin_id",    limit: 4
  end

  add_index "messages", ["admin_id"], name: "index_messages_on_admin_id", using: :btree

  create_table "need_categories", force: :cascade do |t|
    t.datetime "created_at",                     null: false
    t.datetime "updated_at",                     null: false
    t.string   "name",               limit: 255
    t.integer  "need_categories_id", limit: 4
    t.integer  "parent_id",          limit: 4
  end

  add_index "need_categories", ["need_categories_id"], name: "index_need_categories_on_need_categories_id", using: :btree
  add_index "need_categories", ["parent_id"], name: "index_need_categories_on_parent_id", using: :btree

  create_table "needs", force: :cascade do |t|
    t.string   "title",                 limit: 255
    t.text     "description",           limit: 65535
    t.datetime "created_at",                          null: false
    t.datetime "updated_at",                          null: false
    t.integer  "author_id",             limit: 4
    t.datetime "deleted_at"
    t.string   "state",                 limit: 255
    t.integer  "category_id",           limit: 4
    t.string   "devis",                 limit: 255
    t.integer  "image_file_id",         limit: 4
    t.text     "note",                  limit: 65535
    t.integer  "referent_negos_id",     limit: 4
    t.integer  "referent_technique_id", limit: 4
    t.integer  "reseaux_id",            limit: 4
  end

  add_index "needs", ["author_id"], name: "index_needs_on_author_id", using: :btree
  add_index "needs", ["category_id"], name: "index_needs_on_category_id", using: :btree
  add_index "needs", ["deleted_at"], name: "index_needs_on_deleted_at", using: :btree
  add_index "needs", ["image_file_id"], name: "index_needs_on_image_file_id", using: :btree
  add_index "needs", ["title"], name: "index_needs_on_title", using: :btree

  create_table "newsgroups", force: :cascade do |t|
    t.string   "name",            limit: 255
    t.string   "slug",            limit: 255
    t.boolean  "default_checked"
    t.boolean  "enabled"
    t.datetime "created_at",                  null: false
    t.datetime "updated_at",                  null: false
  end

  create_table "newsletters", force: :cascade do |t|
    t.string   "title",      limit: 255
    t.text     "content",    limit: 65535
    t.datetime "sendmail"
    t.boolean  "archive"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "offer_reseauxes", force: :cascade do |t|
    t.integer  "offer_id",   limit: 4
    t.integer  "reseaux_id", limit: 4
    t.datetime "created_at",           null: false
    t.datetime "updated_at",           null: false
  end

  add_index "offer_reseauxes", ["offer_id"], name: "index_offer_reseauxes_on_offer_id", using: :btree
  add_index "offer_reseauxes", ["reseaux_id"], name: "index_offer_reseauxes_on_reseaux_id", using: :btree

  create_table "offers", force: :cascade do |t|
    t.datetime "created_at",                                                        null: false
    t.datetime "updated_at",                                                        null: false
    t.float    "price",          limit: 24
    t.float    "fee_percentage", limit: 24
    t.integer  "need_id",        limit: 4
    t.string   "supplier",       limit: 255
    t.datetime "deleted_at"
    t.decimal  "qte",                        precision: 10, scale: 2, default: 1.0
    t.decimal  "gain",                       precision: 10, scale: 2
  end

  add_index "offers", ["deleted_at"], name: "index_offers_on_deleted_at", using: :btree
  add_index "offers", ["need_id"], name: "index_offers_on_need_id", using: :btree

  create_table "pages", force: :cascade do |t|
    t.text     "title",       limit: 65535
    t.text     "description", limit: 65535
    t.text     "keywords",    limit: 65535
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "particulars", force: :cascade do |t|
    t.boolean  "pro"
    t.string   "organisation",    limit: 255
    t.string   "name",            limit: 255
    t.string   "firstname",       limit: 255
    t.string   "address_1",       limit: 255
    t.string   "address_2",       limit: 255
    t.string   "address_3",       limit: 255
    t.string   "address_4",       limit: 255
    t.string   "address_5",       limit: 255
    t.string   "cp",              limit: 255
    t.string   "city",            limit: 255
    t.string   "country",         limit: 255
    t.string   "tel",             limit: 255
    t.string   "email",           limit: 255
    t.string   "tel2",            limit: 255
    t.string   "tel3",            limit: 255
    t.string   "fax",             limit: 255
    t.string   "owner_type",      limit: 255
    t.integer  "owner_id",        limit: 4
    t.string   "particular_type", limit: 255
    t.boolean  "skip_validation"
    t.datetime "created_at",                  null: false
    t.datetime "updated_at",                  null: false
    t.string   "civilite",        limit: 255
  end

  create_table "payments", force: :cascade do |t|
    t.integer  "customer_id",         limit: 4
    t.string   "element_type",        limit: 255
    t.integer  "element_id",          limit: 4
    t.datetime "paid_at"
    t.boolean  "paid"
    t.string   "ogone_payid",         limit: 255
    t.string   "ogone_pm",            limit: 255
    t.string   "ogone_status",        limit: 255
    t.string   "ogone_acceptance",    limit: 255
    t.string   "ogone_cardno",        limit: 255
    t.string   "ogone_ed",            limit: 255
    t.string   "ogone_cn",            limit: 255
    t.string   "ogone_trxdate",       limit: 255
    t.string   "ogone_ncerror",       limit: 255
    t.string   "ogone_brand",         limit: 255
    t.string   "ogone_subbrand",      limit: 255
    t.string   "ogone_eci",           limit: 255
    t.string   "ogone_ip",            limit: 255
    t.string   "ogone_alias",         limit: 255
    t.date     "ogone_cb_expiration"
    t.string   "iban",                limit: 255
    t.string   "bic",                 limit: 255
    t.string   "token",               limit: 255
    t.string   "check_number",        limit: 255
    t.string   "check_bank",          limit: 255
    t.decimal  "amount",                          precision: 10, scale: 2
    t.integer  "payment_type_id",     limit: 4
    t.datetime "created_at",                                               null: false
    t.datetime "updated_at",                                               null: false
  end

  create_table "portlets", force: :cascade do |t|
    t.integer  "block_id",     limit: 4
    t.integer  "content_id",   limit: 4
    t.string   "content_type", limit: 255
    t.integer  "position",     limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "product_categories", force: :cascade do |t|
    t.integer  "parent_id",           limit: 4
    t.datetime "created_at",                        null: false
    t.datetime "updated_at",                        null: false
    t.integer  "position",            limit: 4
    t.text     "description",         limit: 65535
    t.integer  "image_file_id",       limit: 4
    t.string   "color",               limit: 255
    t.integer  "image_file_left_id",  limit: 4
    t.integer  "image_file_right_id", limit: 4
    t.integer  "top_image_id",        limit: 4
  end

  create_table "product_category_langs", force: :cascade do |t|
    t.string   "name",                limit: 255
    t.string   "slug",                limit: 255
    t.string   "lang",                limit: 255
    t.integer  "product_category_id", limit: 4
    t.datetime "created_at",                        null: false
    t.datetime "updated_at",                        null: false
    t.text     "description",         limit: 65535
  end

  add_index "product_category_langs", ["product_category_id"], name: "index_product_category_langs_on_product_category_id", using: :btree

  create_table "product_collection_langs", force: :cascade do |t|
    t.string   "name",                  limit: 255
    t.string   "slug",                  limit: 255
    t.string   "lang",                  limit: 255
    t.integer  "product_collection_id", limit: 4
    t.datetime "created_at",                          null: false
    t.datetime "updated_at",                          null: false
    t.text     "description",           limit: 65535
  end

  add_index "product_collection_langs", ["product_collection_id"], name: "index_product_collection_langs_on_product_collection_id", using: :btree

  create_table "product_collections", force: :cascade do |t|
    t.integer  "product_category_id", limit: 4
    t.datetime "created_at",                      null: false
    t.datetime "updated_at",                      null: false
    t.integer  "image_fille_id",      limit: 4
    t.string   "color",               limit: 255
  end

  add_index "product_collections", ["product_category_id"], name: "index_product_collections_on_product_category_id", using: :btree

  create_table "product_customers", force: :cascade do |t|
    t.string   "email",                  limit: 255
    t.string   "password_digest",        limit: 255, default: "",    null: false
    t.string   "reset_password_token",   limit: 255
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          limit: 4,   default: 0
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip",     limit: 255
    t.string   "last_sign_in_ip",        limit: 255
    t.boolean  "lock"
    t.datetime "locked_at"
    t.datetime "created_at",                                         null: false
    t.datetime "updated_at",                                         null: false
    t.string   "remote_ip",              limit: 255
    t.string   "token",                  limit: 255
    t.boolean  "particular_idem",                    default: false
    t.integer  "particular_bill_id",     limit: 4
    t.integer  "particular_send_id",     limit: 4
  end

  create_table "product_degressifs", force: :cascade do |t|
    t.integer  "product_stock_id", limit: 4
    t.decimal  "price",                      precision: 10, scale: 2
    t.decimal  "price_remise",               precision: 10, scale: 2
    t.decimal  "nbr",                        precision: 10, scale: 2
    t.boolean  "archived",                                            default: false
    t.datetime "created_at",                                                          null: false
    t.datetime "updated_at",                                                          null: false
  end

  add_index "product_degressifs", ["product_stock_id"], name: "index_product_degressifs_on_product_stock_id", using: :btree

  create_table "product_fdps", force: :cascade do |t|
    t.decimal  "price",                         precision: 10, scale: 2
    t.text     "country",         limit: 65535
    t.string   "fdp_description", limit: 255
    t.decimal  "price_max",                     precision: 10, scale: 2
    t.string   "delais",          limit: 255
    t.datetime "created_at",                                             null: false
    t.datetime "updated_at",                                             null: false
    t.boolean  "archived"
  end

  create_table "product_images", force: :cascade do |t|
    t.string   "title",         limit: 255
    t.text     "description",   limit: 65535
    t.integer  "position",      limit: 4
    t.integer  "image_file_id", limit: 4
    t.integer  "product_id",    limit: 4
    t.datetime "created_at",                  null: false
    t.datetime "updated_at",                  null: false
  end

  add_index "product_images", ["image_file_id"], name: "index_product_images_on_image_file_id", using: :btree

  create_table "product_langs", force: :cascade do |t|
    t.string   "title",                 limit: 255
    t.string   "lang",                  limit: 255
    t.text     "description",           limit: 65535
    t.string   "slug",                  limit: 255
    t.integer  "product_category_id",   limit: 4
    t.integer  "product_collection_id", limit: 4
    t.integer  "product_id",            limit: 4
    t.datetime "created_at",                          null: false
    t.datetime "updated_at",                          null: false
    t.boolean  "archived"
    t.text     "bl_title",              limit: 65535
  end

  add_index "product_langs", ["product_category_id"], name: "index_product_langs_on_product_category_id", using: :btree
  add_index "product_langs", ["product_collection_id"], name: "index_product_langs_on_product_collection_id", using: :btree
  add_index "product_langs", ["product_id"], name: "index_product_langs_on_product_id", using: :btree

  create_table "product_option_langs", force: :cascade do |t|
    t.string   "lang",              limit: 255
    t.integer  "product_option_id", limit: 4
    t.string   "name",              limit: 255
    t.datetime "created_at",                    null: false
    t.datetime "updated_at",                    null: false
    t.boolean  "archived"
  end

  add_index "product_option_langs", ["product_option_id"], name: "index_product_option_langs_on_product_option_id", using: :btree

  create_table "product_options", force: :cascade do |t|
    t.integer  "product_id", limit: 4
    t.datetime "created_at",           null: false
    t.datetime "updated_at",           null: false
    t.boolean  "archived"
  end

  add_index "product_options", ["product_id"], name: "index_product_options_on_product_id", using: :btree

  create_table "product_order_document_types", force: :cascade do |t|
    t.string   "prefix",         limit: 255
    t.string   "label",          limit: 255
    t.text     "header",         limit: 65535
    t.text     "footer",         limit: 65535
    t.integer  "image_file_id",  limit: 4
    t.integer  "data_file_id",   limit: 4
    t.integer  "reseaux_id",     limit: 4
    t.integer  "fournisseur_id", limit: 4
    t.string   "name",           limit: 255
    t.datetime "created_at",                                   null: false
    t.datetime "updated_at",                                   null: false
    t.boolean  "public",                       default: false
  end

  create_table "product_order_documents", force: :cascade do |t|
    t.string   "d_number",                       limit: 255
    t.integer  "d_index",                        limit: 4
    t.integer  "d_year",                         limit: 4
    t.string   "d_prefix",                       limit: 255
    t.string   "label",                          limit: 255
    t.text     "header",                         limit: 65535
    t.text     "footer",                         limit: 65535
    t.integer  "image_file_id",                  limit: 4
    t.integer  "data_file_id",                   limit: 4
    t.integer  "product_order_id",               limit: 4
    t.integer  "product_order_document_type_id", limit: 4
    t.integer  "reseaux_id",                     limit: 4
    t.integer  "fournisseur_id",                 limit: 4
    t.string   "token",                          limit: 255
    t.datetime "created_at",                                                   null: false
    t.datetime "updated_at",                                                   null: false
    t.string   "name",                           limit: 255
    t.boolean  "public",                                       default: false
  end

  add_index "product_order_documents", ["product_order_id"], name: "index_product_order_documents_on_product_order_id", using: :btree

  create_table "product_order_payments", force: :cascade do |t|
    t.integer  "product_order_payment_type_id", limit: 4
    t.integer  "product_order_id",              limit: 4
    t.decimal  "amount",                                    precision: 10
    t.string   "check_number",                  limit: 255
    t.string   "check_bank",                    limit: 255
    t.string   "payplug_payment_id",            limit: 255
    t.string   "payplug_card_id",               limit: 255
    t.string   "payplug_card_expiry_month",     limit: 255
    t.string   "payplug_card_expiry_year",      limit: 255
    t.string   "payplug_card_last_number",      limit: 255
    t.datetime "paid_at"
    t.datetime "tr_canceled_at"
    t.boolean  "tr_canceled",                                              default: false
    t.string   "token",                         limit: 255
    t.datetime "created_at",                                                               null: false
    t.datetime "updated_at",                                                               null: false
    t.string   "ogone_payid",                   limit: 255
    t.string   "ogone_pm",                      limit: 255
    t.string   "ogone_status",                  limit: 255
    t.string   "ogone_acceptance",              limit: 255
    t.string   "ogone_cardno",                  limit: 255
    t.string   "ogone_ed",                      limit: 255
    t.string   "ogone_cn",                      limit: 255
    t.string   "ogone_trxdate",                 limit: 255
    t.string   "ogone_ncerror",                 limit: 255
    t.string   "ogone_brand",                   limit: 255
    t.string   "ogone_subbrand",                limit: 255
    t.string   "ogone_eci",                     limit: 255
    t.string   "ogone_ip",                      limit: 255
    t.string   "ogone_alias",                   limit: 255
    t.date     "ogone_cb_expiration"
  end

  create_table "product_order_products", force: :cascade do |t|
    t.integer  "product_order_id",           limit: 4
    t.integer  "product_id",                 limit: 4
    t.string   "name",                       limit: 255
    t.decimal  "price_ht",                               precision: 10, scale: 2
    t.decimal  "price_reduced_ht",                       precision: 10, scale: 2
    t.integer  "archived_product_id",        limit: 4
    t.decimal  "qty",                                    precision: 10
    t.decimal  "total",                                  precision: 10, scale: 2
    t.integer  "product_size_id",            limit: 4
    t.integer  "product_option_id",          limit: 4
    t.datetime "created_at",                                                      null: false
    t.datetime "updated_at",                                                      null: false
    t.integer  "archived_product_option_id", limit: 4
    t.integer  "archived_product_size_id",   limit: 4
  end

  create_table "product_orders", force: :cascade do |t|
    t.decimal  "amount",                                       precision: 10, scale: 2
    t.boolean  "particular_idem",                                                       default: false
    t.boolean  "paid",                                                                  default: false
    t.integer  "particular_bill_id",               limit: 4
    t.string   "particular_send_id",               limit: 255
    t.string   "token",                            limit: 255
    t.boolean  "completed_finish",                                                      default: false
    t.integer  "product_order_payment_ok_id",      limit: 4
    t.integer  "product_order_payment_type_ok_id", limit: 4
    t.integer  "bill_index",                       limit: 4
    t.string   "bill_number",                      limit: 255
    t.string   "bill_year",                        limit: 255
    t.boolean  "bill_ok",                                                               default: false
    t.integer  "product_customer_id",              limit: 4
    t.datetime "paid_at"
    t.datetime "created_at",                                                                            null: false
    t.datetime "updated_at",                                                                            null: false
    t.integer  "product_fdp_id",                   limit: 4
    t.integer  "product_fdp_archived_id",          limit: 4
    t.boolean  "cgv"
    t.integer  "customer_id",                      limit: 4
    t.string   "bl_number",                        limit: 255
    t.integer  "bl_index",                         limit: 4
    t.integer  "bl_year",                          limit: 4
    t.boolean  "shiped"
    t.integer  "reseaux_id",                       limit: 4
  end

  create_table "product_product_sizes", force: :cascade do |t|
    t.integer  "product_id",      limit: 4
    t.integer  "product_size_id", limit: 4
    t.datetime "created_at",                null: false
    t.datetime "updated_at",                null: false
  end

  add_index "product_product_sizes", ["product_id"], name: "index_product_product_sizes_on_product_id", using: :btree
  add_index "product_product_sizes", ["product_size_id"], name: "index_product_product_sizes_on_product_size_id", using: :btree

  create_table "product_sizes", force: :cascade do |t|
    t.string   "name",       limit: 255
    t.integer  "position",   limit: 4
    t.datetime "created_at",             null: false
    t.datetime "updated_at",             null: false
    t.boolean  "archived"
  end

  create_table "product_stocks", force: :cascade do |t|
    t.integer  "product_id",        limit: 4
    t.integer  "product_size_id",   limit: 4
    t.integer  "product_option_id", limit: 4
    t.integer  "stock",             limit: 4
    t.integer  "stock_th",          limit: 4
    t.datetime "created_at",                  null: false
    t.datetime "updated_at",                  null: false
  end

  add_index "product_stocks", ["product_id"], name: "index_product_stocks_on_product_id", using: :btree

  create_table "products", force: :cascade do |t|
    t.decimal  "price_ht",                          precision: 10, scale: 2
    t.decimal  "price_reduced_ht",                  precision: 10, scale: 2
    t.boolean  "enabled"
    t.integer  "default_image_id",      limit: 4
    t.integer  "position",              limit: 4
    t.datetime "created_at",                                                                 null: false
    t.datetime "updated_at",                                                                 null: false
    t.integer  "product_category_id",   limit: 4
    t.integer  "product_collection_id", limit: 4
    t.boolean  "archived",                                                   default: false
    t.integer  "reseaux_id",            limit: 4
    t.string   "sage_reference",        limit: 255
    t.string   "sage_tiers",            limit: 255
    t.decimal  "step_start",                        precision: 10, scale: 2
    t.decimal  "step_group",                        precision: 10, scale: 2
    t.decimal  "step_stop",                         precision: 10, scale: 2
    t.boolean  "constraint_qty"
  end

  add_index "products", ["product_category_id"], name: "index_products_on_product_category_id", using: :btree
  add_index "products", ["product_collection_id"], name: "index_products_on_product_collection_id", using: :btree

  create_table "reseaux_customers", force: :cascade do |t|
    t.integer  "reseaux_id",  limit: 4
    t.integer  "customer_id", limit: 4
    t.datetime "created_at",            null: false
    t.datetime "updated_at",            null: false
  end

  add_index "reseaux_customers", ["customer_id"], name: "index_reseaux_customers_on_customer_id", using: :btree
  add_index "reseaux_customers", ["reseaux_id"], name: "index_reseaux_customers_on_reseaux_id", using: :btree

  create_table "reseauxes", force: :cascade do |t|
    t.string   "name",                     limit: 255
    t.text     "description",              limit: 65535
    t.integer  "chef_reseau_id",           limit: 4
    t.datetime "created_at",                                                            null: false
    t.datetime "updated_at",                                                            null: false
    t.string   "token",                    limit: 255
    t.integer  "parent_id",                limit: 4
    t.integer  "logo_image_file_id",       limit: 4
    t.integer  "background_image_file_id", limit: 4
    t.string   "title",                    limit: 255
    t.string   "baseline",                 limit: 255
    t.string   "sub_domain",               limit: 255
    t.decimal  "abo_price",                              precision: 10
    t.boolean  "abo_needed",                                            default: false
    t.boolean  "offres_enabled",                                        default: false
    t.boolean  "needs_enabled",                                         default: false
  end

  create_table "sessions", force: :cascade do |t|
    t.string   "session_id", limit: 255,   null: false
    t.text     "data",       limit: 65535
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree

  create_table "sub_products", force: :cascade do |t|
    t.integer  "product_id",               limit: 4
    t.string   "name",                     limit: 255
    t.text     "description",              limit: 65535
    t.decimal  "price_ht",                               precision: 10, scale: 2
    t.decimal  "price_ht_total",                         precision: 10, scale: 2
    t.decimal  "qte",                                    precision: 10, scale: 2
    t.integer  "product_order_product_id", limit: 4
    t.integer  "fournisseur_id",           limit: 4
    t.string   "reference",                limit: 255
    t.datetime "created_at",                                                      null: false
    t.datetime "updated_at",                                                      null: false
    t.integer  "sub_product_reference_id", limit: 4
    t.boolean  "archived"
    t.string   "price_type",               limit: 255
  end

  create_table "table_contents", force: :cascade do |t|
    t.integer  "style",      limit: 4
    t.integer  "nbr_rows",   limit: 4
    t.integer  "nbr_cols",   limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "table_rows", force: :cascade do |t|
    t.integer  "position",         limit: 4
    t.integer  "style",            limit: 4
    t.integer  "table_content_id", limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "tag_taggables", force: :cascade do |t|
    t.string   "taggable_type", limit: 255
    t.integer  "taggable_id",   limit: 4
    t.integer  "tag_id",        limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "tags", force: :cascade do |t|
    t.string   "name",          limit: 255
    t.string   "slug",          limit: 255
    t.integer  "parent_id",     limit: 4
    t.boolean  "public"
    t.string   "taggable_type", limit: 255
    t.integer  "taggable_id",   limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "text_contents", force: :cascade do |t|
    t.string   "style",      limit: 255
    t.text     "content",    limit: 65535
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "thing_conversations", force: :cascade do |t|
    t.integer  "thing_id",        limit: 4
    t.string   "thing_type",      limit: 255
    t.integer  "conversation_id", limit: 4
    t.datetime "created_at",                  null: false
    t.datetime "updated_at",                  null: false
  end

  add_index "thing_conversations", ["conversation_id"], name: "index_thing_conversations_on_conversation_id", using: :btree

  create_table "title_contents", force: :cascade do |t|
    t.text     "content",    limit: 65535
    t.integer  "level",      limit: 4
    t.string   "style",      limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "wishes", force: :cascade do |t|
    t.integer  "customer_id", limit: 4
    t.integer  "need_id",     limit: 4
    t.datetime "created_at",                                                       null: false
    t.datetime "updated_at",                                                       null: false
    t.text     "note",        limit: 65535
    t.string   "devis",       limit: 255
    t.decimal  "qte",                       precision: 10, scale: 2, default: 1.0
  end

  add_foreign_key "customer_messages", "conversations"
  add_foreign_key "customer_newsgroups", "customers"
  add_foreign_key "customer_newsgroups", "newsgroups"
  add_foreign_key "domain_customers", "customers"
  add_foreign_key "domain_customers", "domains"
  add_foreign_key "domain_need_categories", "domains"
  add_foreign_key "domain_need_categories", "need_categories"
  add_foreign_key "domain_needs", "domains"
  add_foreign_key "domain_needs", "needs"
  add_foreign_key "offer_reseauxes", "offers"
  add_foreign_key "offer_reseauxes", "reseauxes"
  add_foreign_key "product_category_langs", "product_categories"
  add_foreign_key "product_collection_langs", "product_collections"
  add_foreign_key "product_collections", "product_categories"
  add_foreign_key "product_degressifs", "product_stocks"
  add_foreign_key "product_images", "image_files"
  add_foreign_key "product_langs", "product_categories"
  add_foreign_key "product_langs", "product_collections"
  add_foreign_key "product_option_langs", "product_options"
  add_foreign_key "product_options", "products"
  add_foreign_key "product_order_documents", "product_orders"
  add_foreign_key "product_product_sizes", "product_sizes"
  add_foreign_key "product_product_sizes", "products"
  add_foreign_key "product_stocks", "products"
  add_foreign_key "products", "product_categories"
  add_foreign_key "products", "product_collections"
  add_foreign_key "reseaux_customers", "customers"
  add_foreign_key "reseaux_customers", "reseauxes"
  add_foreign_key "thing_conversations", "conversations"
end
