2016-11-04 17:11:26 +01:00
|
|
|
# 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.
|
|
|
|
|
2018-01-15 10:02:32 +01:00
|
|
|
ActiveRecord::Schema.define(version: 20180111153308) do
|
2017-06-08 14:16:48 +02:00
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
# These are extensions that must be enabled in order to support this database
|
|
|
|
enable_extension "plpgsql"
|
2018-01-08 14:59:23 +01:00
|
|
|
enable_extension "unaccent"
|
2016-11-04 17:11:26 +01:00
|
|
|
|
|
|
|
create_table "administrateurs", force: :cascade do |t|
|
|
|
|
t.string "email", default: "", null: false
|
|
|
|
t.string "encrypted_password", default: "", null: false
|
|
|
|
t.string "reset_password_token"
|
|
|
|
t.datetime "reset_password_sent_at"
|
|
|
|
t.datetime "remember_created_at"
|
|
|
|
t.integer "sign_in_count", default: 0, null: false
|
|
|
|
t.datetime "current_sign_in_at"
|
|
|
|
t.datetime "last_sign_in_at"
|
2017-02-14 18:20:40 +01:00
|
|
|
t.string "current_sign_in_ip"
|
|
|
|
t.string "last_sign_in_ip"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
t.string "api_token"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["email"], name: "index_administrateurs_on_email", unique: true, using: :btree
|
|
|
|
t.index ["reset_password_token"], name: "index_administrateurs_on_reset_password_token", unique: true, using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "administrateurs_gestionnaires", id: false, force: :cascade do |t|
|
|
|
|
t.integer "administrateur_id"
|
|
|
|
t.integer "gestionnaire_id"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["administrateur_id"], name: "index_administrateurs_gestionnaires_on_administrateur_id", using: :btree
|
|
|
|
t.index ["gestionnaire_id", "administrateur_id"], name: "unique_couple_administrateur_gestionnaire", unique: true, using: :btree
|
|
|
|
t.index ["gestionnaire_id"], name: "index_administrateurs_gestionnaires_on_gestionnaire_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "administrations", force: :cascade do |t|
|
|
|
|
t.string "email", default: "", null: false
|
|
|
|
t.string "encrypted_password", default: "", null: false
|
|
|
|
t.string "reset_password_token"
|
|
|
|
t.datetime "reset_password_sent_at"
|
|
|
|
t.datetime "remember_created_at"
|
|
|
|
t.integer "sign_in_count", default: 0, null: false
|
|
|
|
t.datetime "current_sign_in_at"
|
|
|
|
t.datetime "last_sign_in_at"
|
2017-02-14 18:20:40 +01:00
|
|
|
t.string "current_sign_in_ip"
|
|
|
|
t.string "last_sign_in_ip"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["email"], name: "index_administrations_on_email", unique: true, using: :btree
|
|
|
|
t.index ["reset_password_token"], name: "index_administrations_on_reset_password_token", unique: true, using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2016-11-14 17:33:45 +01:00
|
|
|
create_table "ar_internal_metadata", primary_key: "key", id: :string, force: :cascade do |t|
|
|
|
|
t.string "value"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
end
|
2016-11-04 17:11:26 +01:00
|
|
|
|
2017-08-01 10:53:06 +02:00
|
|
|
create_table "assign_tos", force: :cascade do |t|
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "gestionnaire_id"
|
|
|
|
t.integer "procedure_id"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["gestionnaire_id"], name: "index_assign_tos_on_gestionnaire_id", using: :btree
|
|
|
|
t.index ["procedure_id"], name: "index_assign_tos_on_procedure_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2017-06-08 14:16:48 +02:00
|
|
|
create_table "attestation_templates", force: :cascade do |t|
|
|
|
|
t.text "title"
|
|
|
|
t.text "body"
|
|
|
|
t.text "footer"
|
|
|
|
t.string "logo"
|
|
|
|
t.string "signature"
|
|
|
|
t.boolean "activated"
|
2017-11-23 13:56:09 +01:00
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
2017-06-08 14:16:48 +02:00
|
|
|
t.integer "procedure_id"
|
2017-10-19 15:07:18 +02:00
|
|
|
t.string "logo_secure_token"
|
|
|
|
t.string "signature_secure_token"
|
2017-06-08 14:16:48 +02:00
|
|
|
t.index ["procedure_id"], name: "index_attestation_templates_on_procedure_id", unique: true, using: :btree
|
|
|
|
end
|
|
|
|
|
2017-06-02 14:30:26 +02:00
|
|
|
create_table "attestations", force: :cascade do |t|
|
|
|
|
t.string "pdf"
|
|
|
|
t.string "title"
|
2017-10-18 14:29:12 +02:00
|
|
|
t.integer "dossier_id", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.string "content_secure_token"
|
2017-06-02 14:30:26 +02:00
|
|
|
t.index ["dossier_id"], name: "index_attestations_on_dossier_id", using: :btree
|
|
|
|
end
|
|
|
|
|
2017-04-25 12:09:11 +02:00
|
|
|
create_table "avis", force: :cascade do |t|
|
|
|
|
t.string "email"
|
|
|
|
t.text "introduction"
|
|
|
|
t.text "answer"
|
|
|
|
t.integer "gestionnaire_id"
|
|
|
|
t.integer "dossier_id"
|
2017-09-08 11:52:20 +02:00
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.integer "claimant_id", null: false
|
|
|
|
t.boolean "confidentiel", default: false, null: false
|
2017-05-23 13:28:17 +02:00
|
|
|
t.index ["claimant_id"], name: "index_avis_on_claimant_id", using: :btree
|
2017-04-25 12:09:11 +02:00
|
|
|
t.index ["dossier_id"], name: "index_avis_on_dossier_id", using: :btree
|
|
|
|
t.index ["gestionnaire_id"], name: "index_avis_on_gestionnaire_id", using: :btree
|
|
|
|
end
|
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
create_table "cadastres", force: :cascade do |t|
|
|
|
|
t.string "surface_intersection"
|
|
|
|
t.float "surface_parcelle"
|
|
|
|
t.string "numero"
|
|
|
|
t.integer "feuille"
|
|
|
|
t.string "section"
|
|
|
|
t.string "code_dep"
|
|
|
|
t.string "nom_com"
|
|
|
|
t.string "code_com"
|
|
|
|
t.string "code_arr"
|
|
|
|
t.text "geometry"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "cerfas", force: :cascade do |t|
|
|
|
|
t.string "content"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.integer "user_id"
|
|
|
|
t.string "original_filename"
|
|
|
|
t.string "content_secure_token"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["dossier_id"], name: "index_cerfas_on_dossier_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "champs", force: :cascade do |t|
|
2017-10-23 10:25:07 +02:00
|
|
|
t.string "value"
|
|
|
|
t.integer "type_de_champ_id"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.string "type"
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["dossier_id"], name: "index_champs_on_dossier_id", using: :btree
|
|
|
|
t.index ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2017-03-06 11:51:34 +01:00
|
|
|
create_table "closed_mails", force: :cascade do |t|
|
|
|
|
t.text "body"
|
2018-01-08 17:26:13 +01:00
|
|
|
t.string "subject"
|
2017-03-06 11:51:34 +01:00
|
|
|
t.integer "procedure_id"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["procedure_id"], name: "index_closed_mails_on_procedure_id", using: :btree
|
|
|
|
end
|
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
create_table "commentaires", force: :cascade do |t|
|
|
|
|
t.string "email"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.string "body"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.integer "piece_justificative_id"
|
2016-11-14 18:00:26 +01:00
|
|
|
t.integer "champ_id"
|
2017-10-30 16:07:02 +01:00
|
|
|
t.string "file"
|
2016-11-17 16:55:41 +01:00
|
|
|
t.index ["champ_id"], name: "index_commentaires_on_champ_id", using: :btree
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["dossier_id"], name: "index_commentaires_on_dossier_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2017-09-26 10:43:50 +02:00
|
|
|
create_table "delayed_jobs", force: :cascade do |t|
|
|
|
|
t.integer "priority", default: 0, null: false
|
|
|
|
t.integer "attempts", default: 0, null: false
|
|
|
|
t.text "handler", null: false
|
|
|
|
t.text "last_error"
|
|
|
|
t.datetime "run_at"
|
|
|
|
t.datetime "locked_at"
|
|
|
|
t.datetime "failed_at"
|
|
|
|
t.string "locked_by"
|
|
|
|
t.string "queue"
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2017-09-26 11:32:34 +02:00
|
|
|
t.string "cron"
|
2017-09-26 10:43:50 +02:00
|
|
|
t.index ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
|
|
|
|
end
|
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
create_table "dossiers", force: :cascade do |t|
|
|
|
|
t.boolean "autorisation_donnees"
|
|
|
|
t.integer "procedure_id"
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
t.string "state"
|
|
|
|
t.integer "user_id"
|
|
|
|
t.text "json_latlngs"
|
|
|
|
t.boolean "archived", default: false
|
|
|
|
t.boolean "mandataire_social", default: false
|
2017-12-14 15:51:45 +01:00
|
|
|
t.datetime "en_construction_at"
|
2017-12-14 15:53:02 +01:00
|
|
|
t.datetime "en_instruction_at"
|
2017-03-01 09:51:55 +01:00
|
|
|
t.datetime "processed_at"
|
2017-05-30 16:37:12 +02:00
|
|
|
t.text "motivation"
|
2017-06-27 15:26:40 +02:00
|
|
|
t.datetime "hidden_at"
|
|
|
|
t.index ["hidden_at"], name: "index_dossiers_on_hidden_at", using: :btree
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
|
|
|
|
t.index ["user_id"], name: "index_dossiers_on_user_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "drop_down_lists", force: :cascade do |t|
|
|
|
|
t.string "value"
|
|
|
|
t.integer "type_de_champ_id"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["type_de_champ_id"], name: "index_drop_down_lists_on_type_de_champ_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "entreprises", force: :cascade do |t|
|
|
|
|
t.string "siren"
|
|
|
|
t.integer "capital_social"
|
|
|
|
t.string "numero_tva_intracommunautaire"
|
|
|
|
t.string "forme_juridique"
|
|
|
|
t.string "forme_juridique_code"
|
|
|
|
t.string "nom_commercial"
|
|
|
|
t.string "raison_sociale"
|
|
|
|
t.string "siret_siege_social"
|
|
|
|
t.string "code_effectif_entreprise"
|
|
|
|
t.datetime "date_creation"
|
|
|
|
t.string "nom"
|
|
|
|
t.string "prenom"
|
|
|
|
t.integer "dossier_id"
|
2017-12-05 16:37:58 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["dossier_id"], name: "index_entreprises_on_dossier_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "etablissements", force: :cascade do |t|
|
|
|
|
t.string "siret"
|
|
|
|
t.boolean "siege_social"
|
|
|
|
t.string "naf"
|
|
|
|
t.string "libelle_naf"
|
|
|
|
t.string "adresse"
|
|
|
|
t.string "numero_voie"
|
|
|
|
t.string "type_voie"
|
|
|
|
t.string "nom_voie"
|
|
|
|
t.string "complement_adresse"
|
|
|
|
t.string "code_postal"
|
|
|
|
t.string "localite"
|
|
|
|
t.string "code_insee_localite"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.integer "entreprise_id"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["dossier_id"], name: "index_etablissements_on_dossier_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "exercices", force: :cascade do |t|
|
|
|
|
t.string "ca"
|
|
|
|
t.datetime "dateFinExercice"
|
|
|
|
t.integer "date_fin_exercice_timestamp"
|
|
|
|
t.integer "etablissement_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "follows", force: :cascade do |t|
|
2017-10-23 10:25:07 +02:00
|
|
|
t.integer "gestionnaire_id", null: false
|
|
|
|
t.integer "dossier_id", null: false
|
|
|
|
t.datetime "demande_seen_at"
|
|
|
|
t.datetime "annotations_privees_seen_at"
|
|
|
|
t.datetime "avis_seen_at"
|
|
|
|
t.datetime "messagerie_seen_at"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["dossier_id"], name: "index_follows_on_dossier_id", using: :btree
|
2017-07-18 15:03:08 +02:00
|
|
|
t.index ["gestionnaire_id", "dossier_id"], name: "index_follows_on_gestionnaire_id_and_dossier_id", unique: true, using: :btree
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["gestionnaire_id"], name: "index_follows_on_gestionnaire_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "france_connect_informations", force: :cascade do |t|
|
|
|
|
t.string "gender"
|
|
|
|
t.string "given_name"
|
|
|
|
t.string "family_name"
|
|
|
|
t.date "birthdate"
|
|
|
|
t.string "birthplace"
|
|
|
|
t.string "france_connect_particulier_id"
|
|
|
|
t.integer "user_id"
|
|
|
|
t.string "email_france_connect"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["user_id"], name: "index_france_connect_informations_on_user_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "gestionnaires", force: :cascade do |t|
|
|
|
|
t.string "email", default: "", null: false
|
|
|
|
t.string "encrypted_password", default: "", null: false
|
|
|
|
t.string "reset_password_token"
|
|
|
|
t.datetime "reset_password_sent_at"
|
|
|
|
t.datetime "remember_created_at"
|
|
|
|
t.integer "sign_in_count", default: 0, null: false
|
|
|
|
t.datetime "current_sign_in_at"
|
|
|
|
t.datetime "last_sign_in_at"
|
2017-02-14 18:20:40 +01:00
|
|
|
t.string "current_sign_in_ip"
|
|
|
|
t.string "last_sign_in_ip"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
t.integer "procedure_filter"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["email"], name: "index_gestionnaires_on_email", unique: true, using: :btree
|
|
|
|
t.index ["reset_password_token"], name: "index_gestionnaires_on_reset_password_token", unique: true, using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "individuals", force: :cascade do |t|
|
|
|
|
t.string "nom"
|
|
|
|
t.string "prenom"
|
|
|
|
t.string "birthdate"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.string "gender"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["dossier_id"], name: "index_individuals_on_dossier_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2017-03-07 10:25:28 +01:00
|
|
|
create_table "initiated_mails", force: :cascade do |t|
|
2018-01-08 17:26:13 +01:00
|
|
|
t.string "subject"
|
2017-03-07 10:25:28 +01:00
|
|
|
t.text "body"
|
|
|
|
t.integer "procedure_id"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["procedure_id"], name: "index_initiated_mails_on_procedure_id", using: :btree
|
|
|
|
end
|
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
create_table "invites", force: :cascade do |t|
|
|
|
|
t.string "email"
|
|
|
|
t.string "email_sender"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.integer "user_id"
|
|
|
|
t.string "type", default: "InviteGestionnaire"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "module_api_cartos", force: :cascade do |t|
|
|
|
|
t.integer "procedure_id"
|
|
|
|
t.boolean "use_api_carto", default: false
|
|
|
|
t.boolean "quartiers_prioritaires", default: false
|
|
|
|
t.boolean "cadastre", default: false
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["procedure_id"], name: "index_module_api_cartos_on_procedure_id", unique: true, using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2016-12-21 17:26:31 +01:00
|
|
|
create_table "notifications", force: :cascade do |t|
|
|
|
|
t.boolean "already_read", default: false
|
|
|
|
t.string "liste", array: true
|
|
|
|
t.string "type_notif"
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.index ["dossier_id"], name: "index_notifications_on_dossier_id", using: :btree
|
|
|
|
end
|
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
create_table "pieces_justificatives", force: :cascade do |t|
|
|
|
|
t.string "content"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.integer "type_de_piece_justificative_id"
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.integer "user_id"
|
|
|
|
t.string "original_filename"
|
|
|
|
t.string "content_secure_token"
|
2017-10-23 10:25:07 +02:00
|
|
|
t.datetime "updated_at"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["dossier_id"], name: "index_pieces_justificatives_on_dossier_id", using: :btree
|
|
|
|
t.index ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "procedure_paths", force: :cascade do |t|
|
2017-04-14 11:34:53 +02:00
|
|
|
t.string "path"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "procedure_id"
|
|
|
|
t.integer "administrateur_id"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["path"], name: "index_procedure_paths_on_path", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2017-10-02 17:03:30 +02:00
|
|
|
create_table "procedure_presentations", force: :cascade do |t|
|
|
|
|
t.integer "assign_to_id"
|
2017-11-17 18:23:45 +01:00
|
|
|
t.text "displayed_fields", default: ["{\"label\":\"Demandeur\",\"table\":\"user\",\"column\":\"email\"}"], null: false, array: true
|
|
|
|
t.json "sort", default: "{\"table\":\"notifications\",\"column\":\"notifications\",\"order\":\"desc\"}", null: false
|
|
|
|
t.json "filters", default: "{\"a-suivre\":[],\"suivis\":[],\"traites\":[],\"tous\":[],\"archives\":[]}", null: false
|
2017-10-02 17:03:30 +02:00
|
|
|
t.index ["assign_to_id"], name: "index_procedure_presentations_on_assign_to_id", unique: true, using: :btree
|
|
|
|
end
|
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
create_table "procedures", force: :cascade do |t|
|
|
|
|
t.string "libelle"
|
|
|
|
t.string "description"
|
2017-11-23 13:56:09 +01:00
|
|
|
t.string "organisation", null: false
|
2016-11-04 17:11:26 +01:00
|
|
|
t.string "direction"
|
|
|
|
t.string "lien_demarche"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.integer "administrateur_id"
|
|
|
|
t.boolean "euro_flag", default: false
|
|
|
|
t.string "logo"
|
|
|
|
t.boolean "cerfa_flag", default: false
|
|
|
|
t.string "logo_secure_token"
|
|
|
|
t.string "lien_site_web"
|
|
|
|
t.string "lien_notice"
|
|
|
|
t.boolean "for_individual", default: false
|
|
|
|
t.boolean "individual_with_siret", default: false
|
2017-06-27 14:22:43 +02:00
|
|
|
t.date "auto_archive_on"
|
2017-06-27 11:22:44 +02:00
|
|
|
t.datetime "published_at"
|
2017-12-05 16:37:58 +01:00
|
|
|
t.datetime "hidden_at"
|
2017-06-27 16:49:52 +02:00
|
|
|
t.datetime "archived_at"
|
2018-01-05 17:08:43 +01:00
|
|
|
t.datetime "whitelisted_at"
|
2017-08-21 14:38:06 +02:00
|
|
|
t.index ["hidden_at"], name: "index_procedures_on_hidden_at", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "quartier_prioritaires", force: :cascade do |t|
|
|
|
|
t.string "code"
|
|
|
|
t.string "nom"
|
|
|
|
t.string "commune"
|
|
|
|
t.text "geometry"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
end
|
|
|
|
|
2017-03-06 11:51:34 +01:00
|
|
|
create_table "received_mails", force: :cascade do |t|
|
|
|
|
t.text "body"
|
2018-01-08 17:26:13 +01:00
|
|
|
t.string "subject"
|
2017-03-06 11:51:34 +01:00
|
|
|
t.integer "procedure_id"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["procedure_id"], name: "index_received_mails_on_procedure_id", using: :btree
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "refused_mails", force: :cascade do |t|
|
|
|
|
t.text "body"
|
2018-01-08 17:26:13 +01:00
|
|
|
t.string "subject"
|
2017-03-06 11:51:34 +01:00
|
|
|
t.integer "procedure_id"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["procedure_id"], name: "index_refused_mails_on_procedure_id", using: :btree
|
|
|
|
end
|
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
create_table "rna_informations", force: :cascade do |t|
|
|
|
|
t.string "association_id"
|
|
|
|
t.string "titre"
|
|
|
|
t.text "objet"
|
|
|
|
t.date "date_creation"
|
|
|
|
t.date "date_declaration"
|
|
|
|
t.date "date_publication"
|
|
|
|
t.integer "entreprise_id"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["entreprise_id"], name: "index_rna_informations_on_entreprise_id", using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "types_de_champ", force: :cascade do |t|
|
|
|
|
t.string "libelle"
|
|
|
|
t.string "type_champ"
|
|
|
|
t.integer "order_place"
|
|
|
|
t.integer "procedure_id"
|
|
|
|
t.text "description"
|
|
|
|
t.boolean "mandatory", default: false
|
|
|
|
t.string "type"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "types_de_piece_justificative", force: :cascade do |t|
|
|
|
|
t.string "libelle"
|
|
|
|
t.string "description"
|
|
|
|
t.boolean "api_entreprise", default: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.integer "procedure_id"
|
|
|
|
t.integer "order_place"
|
2017-01-18 17:13:54 +01:00
|
|
|
t.string "lien_demarche"
|
2017-03-29 14:30:29 +02:00
|
|
|
t.boolean "mandatory", default: false
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "users", force: :cascade do |t|
|
|
|
|
t.string "email", default: "", null: false
|
|
|
|
t.string "encrypted_password", default: "", null: false
|
|
|
|
t.string "reset_password_token"
|
|
|
|
t.datetime "reset_password_sent_at"
|
|
|
|
t.datetime "remember_created_at"
|
|
|
|
t.integer "sign_in_count", default: 0, null: false
|
|
|
|
t.datetime "current_sign_in_at"
|
|
|
|
t.datetime "last_sign_in_at"
|
2017-02-14 18:20:40 +01:00
|
|
|
t.string "current_sign_in_ip"
|
|
|
|
t.string "last_sign_in_ip"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
t.string "siret"
|
|
|
|
t.string "loged_in_with_france_connect", default: "false"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
|
|
|
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2017-03-06 11:51:34 +01:00
|
|
|
create_table "without_continuation_mails", force: :cascade do |t|
|
|
|
|
t.text "body"
|
2018-01-08 17:26:13 +01:00
|
|
|
t.string "subject"
|
2017-03-06 11:51:34 +01:00
|
|
|
t.integer "procedure_id"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["procedure_id"], name: "index_without_continuation_mails_on_procedure_id", using: :btree
|
|
|
|
end
|
|
|
|
|
2017-06-08 14:16:48 +02:00
|
|
|
add_foreign_key "attestation_templates", "procedures"
|
2017-06-02 14:30:26 +02:00
|
|
|
add_foreign_key "attestations", "dossiers"
|
2017-05-23 13:28:17 +02:00
|
|
|
add_foreign_key "avis", "gestionnaires", column: "claimant_id"
|
2016-11-04 17:11:26 +01:00
|
|
|
add_foreign_key "cerfas", "dossiers"
|
2017-03-06 11:51:34 +01:00
|
|
|
add_foreign_key "closed_mails", "procedures"
|
2016-11-04 17:11:26 +01:00
|
|
|
add_foreign_key "commentaires", "dossiers"
|
|
|
|
add_foreign_key "dossiers", "users"
|
2017-03-07 10:25:28 +01:00
|
|
|
add_foreign_key "initiated_mails", "procedures"
|
2016-11-04 17:11:26 +01:00
|
|
|
add_foreign_key "procedure_paths", "administrateurs"
|
|
|
|
add_foreign_key "procedure_paths", "procedures"
|
2017-10-02 17:03:30 +02:00
|
|
|
add_foreign_key "procedure_presentations", "assign_tos"
|
2017-03-06 11:51:34 +01:00
|
|
|
add_foreign_key "received_mails", "procedures"
|
|
|
|
add_foreign_key "refused_mails", "procedures"
|
|
|
|
add_foreign_key "without_continuation_mails", "procedures"
|
2016-11-04 17:11:26 +01:00
|
|
|
|
|
|
|
create_view :searches, sql_definition: <<-SQL
|
|
|
|
SELECT dossiers.id AS dossier_id,
|
|
|
|
(((((((((((((((((((((((((((((((((((((((((((((((((((((((COALESCE(users.email, ''::character varying))::text || ' '::text) || (COALESCE(france_connect_informations.given_name, ''::character varying))::text) || ' '::text) || (COALESCE(france_connect_informations.family_name, ''::character varying))::text) || ' '::text) || (COALESCE(cerfas.content, ''::character varying))::text) || ' '::text) || (COALESCE(champs.value, ''::character varying))::text) || ' '::text) || (COALESCE(drop_down_lists.value, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.siren, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.numero_tva_intracommunautaire, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.forme_juridique, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.forme_juridique_code, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.nom_commercial, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.raison_sociale, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.siret_siege_social, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.nom, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.prenom, ''::character varying))::text) || ' '::text) || (COALESCE(rna_informations.association_id, ''::character varying))::text) || ' '::text) || (COALESCE(rna_informations.titre, ''::character varying))::text) || ' '::text) || COALESCE(rna_informations.objet, ''::text)) || ' '::text) || (COALESCE(etablissements.siret, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.naf, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.libelle_naf, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.adresse, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.code_postal, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.localite, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.code_insee_localite, ''::character varying))::text) || ' '::text) || (COALESCE(individuals.nom, ''::character varying))::text) || ' '::text) || (COALESCE(individuals.prenom, ''::character varying))::text) || ' '::text) || (COALESCE(pieces_justificatives.content, ''::character varying))::text) AS term
|
|
|
|
FROM ((((((((((dossiers
|
|
|
|
JOIN users ON ((users.id = dossiers.user_id)))
|
|
|
|
LEFT JOIN france_connect_informations ON ((france_connect_informations.user_id = dossiers.user_id)))
|
|
|
|
LEFT JOIN cerfas ON ((cerfas.dossier_id = dossiers.id)))
|
|
|
|
LEFT JOIN champs ON ((champs.dossier_id = dossiers.id)))
|
|
|
|
LEFT JOIN drop_down_lists ON ((drop_down_lists.type_de_champ_id = champs.type_de_champ_id)))
|
|
|
|
LEFT JOIN entreprises ON ((entreprises.dossier_id = dossiers.id)))
|
|
|
|
LEFT JOIN rna_informations ON ((rna_informations.entreprise_id = entreprises.id)))
|
|
|
|
LEFT JOIN etablissements ON ((etablissements.dossier_id = dossiers.id)))
|
|
|
|
LEFT JOIN individuals ON ((individuals.dossier_id = dossiers.id)))
|
|
|
|
LEFT JOIN pieces_justificatives ON ((pieces_justificatives.dossier_id = dossiers.id)));
|
|
|
|
SQL
|
2017-06-27 11:22:44 +02:00
|
|
|
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|