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.
|
|
|
|
|
2020-02-11 15:51:15 +01:00
|
|
|
ActiveRecord::Schema.define(version: 2020_02_10_100938) 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
|
|
|
|
2019-04-09 15:44:36 +02:00
|
|
|
create_table "action_text_rich_texts", force: :cascade do |t|
|
|
|
|
t.string "name", null: false
|
|
|
|
t.text "body"
|
|
|
|
t.string "record_type", null: false
|
|
|
|
t.bigint "record_id", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
|
|
|
|
end
|
|
|
|
|
2018-02-12 10:44:10 +01:00
|
|
|
create_table "active_storage_attachments", force: :cascade do |t|
|
|
|
|
t.string "name", null: false
|
|
|
|
t.string "record_type", null: false
|
|
|
|
t.bigint "record_id", null: false
|
|
|
|
t.bigint "blob_id", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
|
|
|
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "active_storage_blobs", force: :cascade do |t|
|
|
|
|
t.string "key", null: false
|
|
|
|
t.string "filename", null: false
|
|
|
|
t.string "content_type"
|
|
|
|
t.text "metadata"
|
|
|
|
t.bigint "byte_size", null: false
|
|
|
|
t.string "checksum", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "administrateurs", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "email", default: "", null: false
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2019-10-28 14:59:58 +01:00
|
|
|
t.boolean "active", default: false
|
2018-08-24 16:45:43 +02:00
|
|
|
t.string "encrypted_token"
|
2020-02-03 11:02:57 +01:00
|
|
|
t.index ["email"], name: "index_administrateurs_on_email"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2019-08-05 16:09:39 +02:00
|
|
|
create_table "administrateurs_instructeurs", id: false, force: :cascade do |t|
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "administrateur_id"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.integer "instructeur_id"
|
2018-12-18 21:47:11 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.index ["administrateur_id"], name: "index_administrateurs_instructeurs_on_administrateur_id"
|
|
|
|
t.index ["instructeur_id", "administrateur_id"], name: "unique_couple_administrateur_instructeur", unique: true
|
|
|
|
t.index ["instructeur_id"], name: "index_administrateurs_instructeurs_on_instructeur_id"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-03-23 11:39:36 +01:00
|
|
|
create_table "administrateurs_procedures", id: false, force: :cascade do |t|
|
|
|
|
t.bigint "administrateur_id", null: false
|
|
|
|
t.bigint "procedure_id", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["administrateur_id", "procedure_id"], name: "index_unique_admin_proc_couple", unique: true
|
|
|
|
t.index ["administrateur_id"], name: "index_administrateurs_procedures_on_administrateur_id"
|
|
|
|
t.index ["procedure_id"], name: "index_administrateurs_procedures_on_procedure_id"
|
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "administrations", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "email", default: "", null: false
|
|
|
|
t.string "encrypted_password", default: "", null: false
|
|
|
|
t.string "reset_password_token"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "reset_password_sent_at"
|
|
|
|
t.datetime "remember_created_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.integer "sign_in_count", default: 0, null: false
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "current_sign_in_at"
|
|
|
|
t.datetime "last_sign_in_at"
|
2018-02-08 17:38:01 +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"
|
2019-07-29 16:30:04 +02:00
|
|
|
t.integer "failed_attempts", default: 0, null: false
|
|
|
|
t.string "unlock_token"
|
|
|
|
t.datetime "locked_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["email"], name: "index_administrations_on_email", unique: true
|
|
|
|
t.index ["reset_password_token"], name: "index_administrations_on_reset_password_token", unique: true
|
2019-07-29 16:30:04 +02:00
|
|
|
t.index ["unlock_token"], name: "index_administrations_on_unlock_token", unique: true
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "assign_tos", id: :serial, force: :cascade do |t|
|
2019-08-05 16:09:39 +02:00
|
|
|
t.integer "instructeur_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.integer "procedure_id"
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2019-03-18 14:43:05 +01:00
|
|
|
t.boolean "email_notifications_enabled", default: false, null: false
|
2019-08-20 16:47:41 +02:00
|
|
|
t.bigint "groupe_instructeur_id"
|
2020-02-11 15:51:15 +01:00
|
|
|
t.boolean "weekly_email_notifications_enabled", default: true, null: false
|
2019-08-20 16:47:41 +02:00
|
|
|
t.index ["groupe_instructeur_id", "instructeur_id"], name: "unique_couple_groupe_instructeur_instructeur", unique: true
|
|
|
|
t.index ["groupe_instructeur_id"], name: "index_assign_tos_on_groupe_instructeur_id"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.index ["instructeur_id", "procedure_id"], name: "index_assign_tos_on_instructeur_id_and_procedure_id", unique: true
|
|
|
|
t.index ["instructeur_id"], name: "index_assign_tos_on_instructeur_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["procedure_id"], name: "index_assign_tos_on_procedure_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "attestation_templates", id: :serial, force: :cascade do |t|
|
|
|
|
t.text "title"
|
|
|
|
t.text "body"
|
|
|
|
t.text "footer"
|
|
|
|
t.boolean "activated"
|
2016-11-14 17:33:45 +01:00
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
2018-02-08 17:38:01 +01:00
|
|
|
t.integer "procedure_id"
|
|
|
|
t.index ["procedure_id"], name: "index_attestation_templates_on_procedure_id", unique: true
|
2016-11-14 17:33:45 +01:00
|
|
|
end
|
2016-11-04 17:11:26 +01:00
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "attestations", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "title"
|
|
|
|
t.integer "dossier_id", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["dossier_id"], name: "index_attestations_on_dossier_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "avis", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "email"
|
|
|
|
t.text "introduction"
|
|
|
|
t.text "answer"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.integer "instructeur_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.integer "dossier_id"
|
|
|
|
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
|
|
|
|
t.index ["claimant_id"], name: "index_avis_on_claimant_id"
|
|
|
|
t.index ["dossier_id"], name: "index_avis_on_dossier_id"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.index ["instructeur_id"], name: "index_avis_on_instructeur_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
end
|
|
|
|
|
2019-06-17 11:01:41 +02:00
|
|
|
create_table "bill_signatures", force: :cascade do |t|
|
|
|
|
t.string "digest"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "champs", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "value"
|
|
|
|
t.integer "type_de_champ_id"
|
|
|
|
t.integer "dossier_id"
|
|
|
|
t.string "type"
|
2017-10-23 10:25:07 +02:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-02-14 11:46:38 +01:00
|
|
|
t.boolean "private", default: false, null: false
|
2018-02-21 16:26:49 +01:00
|
|
|
t.integer "etablissement_id"
|
2018-12-18 11:17:52 +01:00
|
|
|
t.bigint "parent_id"
|
|
|
|
t.integer "row"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["dossier_id"], name: "index_champs_on_dossier_id"
|
2018-12-18 11:17:52 +01:00
|
|
|
t.index ["parent_id"], name: "index_champs_on_parent_id"
|
2018-02-09 17:21:46 +01:00
|
|
|
t.index ["private"], name: "index_champs_on_private"
|
2018-12-18 11:17:52 +01:00
|
|
|
t.index ["row"], name: "index_champs_on_row"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "closed_mails", id: :serial, force: :cascade do |t|
|
|
|
|
t.text "body"
|
|
|
|
t.string "subject"
|
|
|
|
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"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "commentaires", id: :serial, 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
|
2018-12-04 13:53:18 +01:00
|
|
|
t.bigint "user_id"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.bigint "instructeur_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["dossier_id"], name: "index_commentaires_on_dossier_id"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.index ["instructeur_id"], name: "index_commentaires_on_instructeur_id"
|
2018-12-04 13:53:18 +01:00
|
|
|
t.index ["user_id"], name: "index_commentaires_on_user_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "delayed_jobs", id: :serial, 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"
|
2017-09-26 10:43:50 +02:00
|
|
|
t.datetime "run_at"
|
|
|
|
t.datetime "locked_at"
|
|
|
|
t.datetime "failed_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.string "locked_by"
|
|
|
|
t.string "queue"
|
2017-09-26 10:43:50 +02:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.string "cron"
|
|
|
|
t.index ["priority", "run_at"], name: "delayed_jobs_priority"
|
2017-09-26 10:43:50 +02:00
|
|
|
end
|
|
|
|
|
2018-05-30 11:36:48 +02:00
|
|
|
create_table "deleted_dossiers", force: :cascade do |t|
|
|
|
|
t.bigint "procedure_id"
|
|
|
|
t.bigint "dossier_id"
|
|
|
|
t.datetime "deleted_at"
|
|
|
|
t.string "state"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["procedure_id"], name: "index_deleted_dossiers_on_procedure_id"
|
|
|
|
end
|
|
|
|
|
2018-11-23 21:02:18 +01:00
|
|
|
create_table "dossier_operation_logs", force: :cascade do |t|
|
|
|
|
t.string "operation", null: false
|
|
|
|
t.bigint "dossier_id"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.bigint "instructeur_id"
|
2018-11-23 21:02:18 +01:00
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
2019-01-10 17:42:38 +01:00
|
|
|
t.boolean "automatic_operation", default: false, null: false
|
2019-05-02 16:18:10 +02:00
|
|
|
t.datetime "keep_until"
|
|
|
|
t.datetime "executed_at"
|
|
|
|
t.text "digest"
|
2019-06-17 11:01:41 +02:00
|
|
|
t.bigint "bill_signature_id"
|
|
|
|
t.index ["bill_signature_id"], name: "index_dossier_operation_logs_on_bill_signature_id"
|
2018-11-23 21:02:18 +01:00
|
|
|
t.index ["dossier_id"], name: "index_dossier_operation_logs_on_dossier_id"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.index ["instructeur_id"], name: "index_dossier_operation_logs_on_instructeur_id"
|
2019-05-02 16:18:10 +02:00
|
|
|
t.index ["keep_until"], name: "index_dossier_operation_logs_on_keep_until"
|
2018-11-23 21:02:18 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "dossiers", id: :serial, force: :cascade do |t|
|
|
|
|
t.boolean "autorisation_donnees"
|
|
|
|
t.integer "procedure_id"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.string "state"
|
|
|
|
t.integer "user_id"
|
|
|
|
t.boolean "archived", 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"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.text "motivation"
|
2017-06-27 15:26:40 +02:00
|
|
|
t.datetime "hidden_at"
|
2018-07-25 18:13:31 +02:00
|
|
|
t.text "search_terms"
|
|
|
|
t.text "private_search_terms"
|
2019-08-22 17:58:31 +02:00
|
|
|
t.bigint "groupe_instructeur_id"
|
2019-11-28 15:53:51 +01:00
|
|
|
t.datetime "brouillon_close_to_expiration_notice_sent_at"
|
2018-07-25 18:13:31 +02:00
|
|
|
t.index "to_tsvector('french'::regconfig, (search_terms || private_search_terms))", name: "index_dossiers_on_search_terms_private_search_terms", using: :gin
|
|
|
|
t.index "to_tsvector('french'::regconfig, search_terms)", name: "index_dossiers_on_search_terms", using: :gin
|
2019-09-20 15:47:01 +02:00
|
|
|
t.index ["archived"], name: "index_dossiers_on_archived"
|
2019-08-22 17:58:31 +02:00
|
|
|
t.index ["groupe_instructeur_id"], name: "index_dossiers_on_groupe_instructeur_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["hidden_at"], name: "index_dossiers_on_hidden_at"
|
|
|
|
t.index ["procedure_id"], name: "index_dossiers_on_procedure_id"
|
2019-09-20 15:47:01 +02:00
|
|
|
t.index ["state"], name: "index_dossiers_on_state"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["user_id"], name: "index_dossiers_on_user_id"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "drop_down_lists", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "value"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "type_de_champ_id"
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["type_de_champ_id"], name: "index_drop_down_lists_on_type_de_champ_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "etablissements", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "siret"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.boolean "siege_social"
|
2018-02-08 17:38:01 +01:00
|
|
|
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"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "dossier_id"
|
|
|
|
t.integer "entreprise_id"
|
2018-02-21 16:26:49 +01:00
|
|
|
t.string "entreprise_siren"
|
2018-03-07 11:24:41 +01:00
|
|
|
t.bigint "entreprise_capital_social"
|
2018-02-21 16:26:49 +01:00
|
|
|
t.string "entreprise_numero_tva_intracommunautaire"
|
|
|
|
t.string "entreprise_forme_juridique"
|
|
|
|
t.string "entreprise_forme_juridique_code"
|
|
|
|
t.string "entreprise_nom_commercial"
|
|
|
|
t.string "entreprise_raison_sociale"
|
|
|
|
t.string "entreprise_siret_siege_social"
|
|
|
|
t.string "entreprise_code_effectif_entreprise"
|
|
|
|
t.date "entreprise_date_creation"
|
|
|
|
t.string "entreprise_nom"
|
|
|
|
t.string "entreprise_prenom"
|
|
|
|
t.string "association_rna"
|
|
|
|
t.string "association_titre"
|
|
|
|
t.text "association_objet"
|
|
|
|
t.date "association_date_creation"
|
|
|
|
t.date "association_date_declaration"
|
|
|
|
t.date "association_date_publication"
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["dossier_id"], name: "index_etablissements_on_dossier_id"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "exercices", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "ca"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "dateFinExercice"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.integer "date_fin_exercice_timestamp"
|
|
|
|
t.integer "etablissement_id"
|
2018-02-21 16:26:49 +01:00
|
|
|
t.datetime "date_fin_exercice"
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2019-12-03 18:36:50 +01:00
|
|
|
create_table "exports", force: :cascade do |t|
|
|
|
|
t.string "format", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "exports_groupe_instructeurs", force: :cascade do |t|
|
|
|
|
t.bigint "export_id", null: false
|
|
|
|
t.bigint "groupe_instructeur_id", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
end
|
|
|
|
|
2018-08-08 17:37:41 +02:00
|
|
|
create_table "feedbacks", force: :cascade do |t|
|
|
|
|
t.bigint "user_id"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
2018-08-27 13:14:11 +02:00
|
|
|
t.string "rating", null: false
|
2018-08-08 17:37:41 +02:00
|
|
|
t.index ["user_id"], name: "index_feedbacks_on_user_id"
|
|
|
|
end
|
|
|
|
|
2019-07-04 12:36:17 +02:00
|
|
|
create_table "flipper_features", force: :cascade do |t|
|
|
|
|
t.string "key", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["key"], name: "index_flipper_features_on_key", unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "flipper_gates", force: :cascade do |t|
|
|
|
|
t.string "feature_key", null: false
|
|
|
|
t.string "key", null: false
|
|
|
|
t.string "value"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true
|
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "follows", id: :serial, force: :cascade do |t|
|
2019-08-05 16:09:39 +02:00
|
|
|
t.integer "instructeur_id", null: false
|
2018-02-08 17:38:01 +01:00
|
|
|
t.integer "dossier_id", null: false
|
2019-06-07 14:41:24 +02:00
|
|
|
t.datetime "demande_seen_at", null: false
|
|
|
|
t.datetime "annotations_privees_seen_at", null: false
|
|
|
|
t.datetime "avis_seen_at", null: false
|
|
|
|
t.datetime "messagerie_seen_at", null: false
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2019-06-07 14:59:49 +02:00
|
|
|
t.datetime "unfollowed_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["dossier_id"], name: "index_follows_on_dossier_id"
|
2019-08-05 16:09:39 +02:00
|
|
|
t.index ["instructeur_id", "dossier_id", "unfollowed_at"], name: "uniqueness_index", unique: true
|
|
|
|
t.index ["instructeur_id"], name: "index_follows_on_instructeur_id"
|
2019-09-20 15:47:01 +02:00
|
|
|
t.index ["unfollowed_at"], name: "index_follows_on_unfollowed_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "france_connect_informations", id: :serial, 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"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "user_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.string "email_france_connect"
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["user_id"], name: "index_france_connect_informations_on_user_id"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-10-16 13:00:52 +02:00
|
|
|
create_table "geo_areas", force: :cascade do |t|
|
|
|
|
t.string "source"
|
|
|
|
t.jsonb "geometry"
|
|
|
|
t.jsonb "properties"
|
|
|
|
t.bigint "champ_id"
|
2018-10-30 11:05:08 +01:00
|
|
|
t.string "geo_reference_id"
|
2018-12-18 21:47:11 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-10-16 13:00:52 +02:00
|
|
|
t.index ["champ_id"], name: "index_geo_areas_on_champ_id"
|
|
|
|
t.index ["source"], name: "index_geo_areas_on_source"
|
|
|
|
end
|
|
|
|
|
2019-08-19 16:12:30 +02:00
|
|
|
create_table "groupe_instructeurs", force: :cascade do |t|
|
|
|
|
t.bigint "procedure_id", null: false
|
|
|
|
t.text "label", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["procedure_id", "label"], name: "index_groupe_instructeurs_on_procedure_id_and_label", unique: true
|
|
|
|
t.index ["procedure_id"], name: "index_groupe_instructeurs_on_procedure_id"
|
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "individuals", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "nom"
|
|
|
|
t.string "prenom"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "dossier_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.string "gender"
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-04-04 13:49:52 +02:00
|
|
|
t.date "birthdate"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["dossier_id"], name: "index_individuals_on_dossier_id"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "initiated_mails", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "subject"
|
|
|
|
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"
|
2017-03-07 10:25:28 +01:00
|
|
|
end
|
|
|
|
|
2019-08-05 16:09:39 +02:00
|
|
|
create_table "instructeurs", id: :serial, force: :cascade do |t|
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
t.text "encrypted_login_token"
|
|
|
|
t.datetime "login_token_created_at"
|
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "invites", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "email"
|
|
|
|
t.string "email_sender"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "dossier_id"
|
|
|
|
t.integer "user_id"
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2019-07-29 11:40:51 +02:00
|
|
|
t.text "message"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "module_api_cartos", id: :serial, force: :cascade do |t|
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "procedure_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.boolean "use_api_carto", default: false
|
2016-11-04 17:11:26 +01:00
|
|
|
t.boolean "quartiers_prioritaires", default: false
|
2018-02-08 17:38:01 +01:00
|
|
|
t.boolean "cadastre", default: false
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-10-31 11:17:03 +01:00
|
|
|
t.boolean "migrated"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["procedure_id"], name: "index_module_api_cartos_on_procedure_id", unique: true
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "procedure_presentations", id: :serial, force: :cascade do |t|
|
2017-10-02 17:03:30 +02:00
|
|
|
t.integer "assign_to_id"
|
2018-09-20 17:05:24 +02:00
|
|
|
t.jsonb "sort", default: {"order"=>"desc", "table"=>"notifications", "column"=>"notifications"}, null: false
|
|
|
|
t.jsonb "filters", default: {"tous"=>[], "suivis"=>[], "traites"=>[], "a-suivre"=>[], "archives"=>[]}, null: false
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-09-20 17:05:24 +02:00
|
|
|
t.jsonb "displayed_fields", default: [{"label"=>"Demandeur", "table"=>"user", "column"=>"email"}], null: false
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["assign_to_id"], name: "index_procedure_presentations_on_assign_to_id", unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "procedures", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "libelle"
|
|
|
|
t.string "description"
|
2018-05-11 12:09:32 +02:00
|
|
|
t.string "organisation"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.string "direction"
|
|
|
|
t.string "lien_demarche"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.boolean "euro_flag", default: false
|
|
|
|
t.boolean "cerfa_flag", default: false
|
|
|
|
t.string "lien_site_web"
|
|
|
|
t.string "lien_notice"
|
|
|
|
t.boolean "for_individual", default: false
|
|
|
|
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"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.boolean "ask_birthday", default: false, null: false
|
2018-03-01 17:04:05 +01:00
|
|
|
t.string "web_hook_url"
|
2018-04-12 18:20:49 +02:00
|
|
|
t.boolean "cloned_from_library", default: false
|
2018-04-24 15:23:07 +02:00
|
|
|
t.bigint "parent_procedure_id"
|
2018-05-09 18:02:04 +02:00
|
|
|
t.datetime "test_started_at"
|
2018-05-15 16:20:21 +02:00
|
|
|
t.string "aasm_state", default: "brouillon"
|
2018-04-17 16:11:49 +02:00
|
|
|
t.bigint "service_id"
|
2018-05-23 16:45:12 +02:00
|
|
|
t.integer "duree_conservation_dossiers_dans_ds"
|
|
|
|
t.integer "duree_conservation_dossiers_hors_ds"
|
2018-05-02 15:41:43 +02:00
|
|
|
t.string "cadre_juridique"
|
2018-06-01 10:46:59 +02:00
|
|
|
t.boolean "juridique_required", default: true
|
2018-05-24 23:27:12 +02:00
|
|
|
t.boolean "durees_conservation_required", default: true
|
2019-09-17 15:55:35 +02:00
|
|
|
t.string "path", null: false
|
2019-05-23 14:28:14 +02:00
|
|
|
t.string "declarative_with_state"
|
2019-07-17 15:34:10 +02:00
|
|
|
t.text "monavis_embed"
|
2019-10-23 20:42:34 +02:00
|
|
|
t.text "routing_criteria_name", default: "Votre ville"
|
2019-10-03 15:35:31 +02:00
|
|
|
t.boolean "csv_export_queued"
|
|
|
|
t.boolean "xlsx_export_queued"
|
|
|
|
t.boolean "ods_export_queued"
|
2019-11-14 09:59:16 +01:00
|
|
|
t.datetime "closed_at"
|
2019-12-04 15:35:15 +01:00
|
|
|
t.datetime "unpublished_at"
|
2019-12-04 16:58:26 +01:00
|
|
|
t.bigint "canonical_procedure_id"
|
2019-05-23 14:28:14 +02:00
|
|
|
t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["hidden_at"], name: "index_procedures_on_hidden_at"
|
2018-04-24 15:23:07 +02:00
|
|
|
t.index ["parent_procedure_id"], name: "index_procedures_on_parent_procedure_id"
|
2019-12-18 13:28:29 +01:00
|
|
|
t.index ["path", "closed_at", "hidden_at"], name: "index_procedures_on_path_and_closed_at_and_hidden_at", unique: true
|
2018-04-17 16:11:49 +02:00
|
|
|
t.index ["service_id"], name: "index_procedures_on_service_id"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "received_mails", id: :serial, force: :cascade do |t|
|
|
|
|
t.text "body"
|
|
|
|
t.string "subject"
|
|
|
|
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"
|
2017-03-06 11:51:34 +01:00
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "refused_mails", id: :serial, force: :cascade do |t|
|
|
|
|
t.text "body"
|
|
|
|
t.string "subject"
|
|
|
|
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"
|
2017-03-06 11:51:34 +01:00
|
|
|
end
|
|
|
|
|
2018-04-17 16:11:49 +02:00
|
|
|
create_table "services", force: :cascade do |t|
|
|
|
|
t.string "type_organisme", null: false
|
|
|
|
t.string "nom", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.bigint "administrateur_id"
|
2018-05-10 11:38:11 +02:00
|
|
|
t.string "organisme"
|
|
|
|
t.string "email"
|
|
|
|
t.string "telephone"
|
|
|
|
t.text "horaires"
|
|
|
|
t.text "adresse"
|
2018-04-17 16:11:49 +02:00
|
|
|
t.index ["administrateur_id", "nom"], name: "index_services_on_administrateur_id_and_nom", unique: true
|
|
|
|
t.index ["administrateur_id"], name: "index_services_on_administrateur_id"
|
|
|
|
end
|
|
|
|
|
2018-07-18 15:45:23 +02:00
|
|
|
create_table "task_records", id: false, force: :cascade do |t|
|
|
|
|
t.string "version", null: false
|
|
|
|
end
|
|
|
|
|
2019-02-01 18:11:55 +01:00
|
|
|
create_table "trusted_device_tokens", force: :cascade do |t|
|
|
|
|
t.string "token", null: false
|
2019-08-05 16:09:39 +02:00
|
|
|
t.bigint "instructeur_id"
|
2019-02-01 18:11:55 +01:00
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
2019-08-05 16:09:39 +02:00
|
|
|
t.index ["instructeur_id"], name: "index_trusted_device_tokens_on_instructeur_id"
|
2019-02-01 18:11:55 +01:00
|
|
|
t.index ["token"], name: "index_trusted_device_tokens_on_token", unique: true
|
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "types_de_champ", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "libelle"
|
|
|
|
t.string "type_champ"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.integer "order_place"
|
|
|
|
t.integer "procedure_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.text "description"
|
|
|
|
t.boolean "mandatory", default: false
|
2018-02-14 11:46:38 +01:00
|
|
|
t.boolean "private", default: false, null: false
|
2018-03-19 22:53:15 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-10-16 13:00:52 +02:00
|
|
|
t.jsonb "options"
|
2018-11-23 19:22:33 +01:00
|
|
|
t.bigint "stable_id"
|
2018-12-18 11:17:52 +01:00
|
|
|
t.bigint "parent_id"
|
|
|
|
t.index ["parent_id"], name: "index_types_de_champ_on_parent_id"
|
2018-02-09 17:21:46 +01:00
|
|
|
t.index ["private"], name: "index_types_de_champ_on_private"
|
2019-02-26 12:02:38 +01:00
|
|
|
t.index ["procedure_id"], name: "index_types_de_champ_on_procedure_id"
|
2018-11-23 19:22:33 +01:00
|
|
|
t.index ["stable_id"], name: "index_types_de_champ_on_stable_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "users", id: :serial, force: :cascade do |t|
|
|
|
|
t.string "email", default: "", null: false
|
|
|
|
t.string "encrypted_password", default: "", null: false
|
|
|
|
t.string "reset_password_token"
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "reset_password_sent_at"
|
|
|
|
t.datetime "remember_created_at"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.integer "sign_in_count", default: 0, null: false
|
2016-11-04 17:11:26 +01:00
|
|
|
t.datetime "current_sign_in_at"
|
|
|
|
t.datetime "last_sign_in_at"
|
2018-02-08 17:38:01 +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"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.string "siret"
|
|
|
|
t.string "loged_in_with_france_connect", default: "false"
|
2018-05-14 14:21:03 +02:00
|
|
|
t.string "confirmation_token"
|
|
|
|
t.datetime "confirmed_at"
|
|
|
|
t.datetime "confirmation_sent_at"
|
2019-09-10 16:53:11 +02:00
|
|
|
t.text "unconfirmed_email"
|
2019-07-29 16:30:04 +02:00
|
|
|
t.integer "failed_attempts", default: 0, null: false
|
|
|
|
t.string "unlock_token"
|
|
|
|
t.datetime "locked_at"
|
2019-08-08 16:49:40 +02:00
|
|
|
t.bigint "instructeur_id"
|
2019-08-09 09:45:11 +02:00
|
|
|
t.bigint "administrateur_id"
|
|
|
|
t.index ["administrateur_id"], name: "index_users_on_administrateur_id"
|
2018-05-14 14:21:03 +02:00
|
|
|
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["email"], name: "index_users_on_email", unique: true
|
2019-08-08 16:49:40 +02:00
|
|
|
t.index ["instructeur_id"], name: "index_users_on_instructeur_id"
|
2018-02-08 17:38:01 +01:00
|
|
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
2019-07-29 16:30:04 +02:00
|
|
|
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|
|
|
|
|
2018-05-11 14:59:20 +02:00
|
|
|
create_table "virus_scans", force: :cascade do |t|
|
|
|
|
t.datetime "scanned_at"
|
|
|
|
t.string "status"
|
|
|
|
t.bigint "champ_id"
|
|
|
|
t.string "blob_key"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["champ_id"], name: "index_virus_scans_on_champ_id"
|
|
|
|
end
|
|
|
|
|
2018-02-08 17:38:01 +01:00
|
|
|
create_table "without_continuation_mails", id: :serial, force: :cascade do |t|
|
|
|
|
t.text "body"
|
|
|
|
t.string "subject"
|
|
|
|
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"
|
2017-03-06 11:51:34 +01:00
|
|
|
end
|
|
|
|
|
2019-08-20 16:47:41 +02:00
|
|
|
add_foreign_key "assign_tos", "groupe_instructeurs"
|
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"
|
2019-08-05 16:09:39 +02:00
|
|
|
add_foreign_key "avis", "instructeurs", column: "claimant_id"
|
2018-12-18 11:17:52 +01:00
|
|
|
add_foreign_key "champs", "champs", column: "parent_id"
|
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"
|
2019-06-17 11:01:41 +02:00
|
|
|
add_foreign_key "dossier_operation_logs", "bill_signatures"
|
2018-11-23 21:02:18 +01:00
|
|
|
add_foreign_key "dossier_operation_logs", "dossiers"
|
2019-08-05 16:09:39 +02:00
|
|
|
add_foreign_key "dossier_operation_logs", "instructeurs"
|
2019-08-22 17:58:31 +02:00
|
|
|
add_foreign_key "dossiers", "groupe_instructeurs"
|
2016-11-04 17:11:26 +01:00
|
|
|
add_foreign_key "dossiers", "users"
|
2018-08-08 17:37:41 +02:00
|
|
|
add_foreign_key "feedbacks", "users"
|
2018-10-16 13:00:52 +02:00
|
|
|
add_foreign_key "geo_areas", "champs"
|
2019-08-19 16:12:30 +02:00
|
|
|
add_foreign_key "groupe_instructeurs", "procedures"
|
2017-03-07 10:25:28 +01:00
|
|
|
add_foreign_key "initiated_mails", "procedures"
|
2017-10-02 17:03:30 +02:00
|
|
|
add_foreign_key "procedure_presentations", "assign_tos"
|
2018-04-17 16:11:49 +02:00
|
|
|
add_foreign_key "procedures", "services"
|
2017-03-06 11:51:34 +01:00
|
|
|
add_foreign_key "received_mails", "procedures"
|
|
|
|
add_foreign_key "refused_mails", "procedures"
|
2018-04-17 16:11:49 +02:00
|
|
|
add_foreign_key "services", "administrateurs"
|
2019-08-05 16:09:39 +02:00
|
|
|
add_foreign_key "trusted_device_tokens", "instructeurs"
|
2018-12-18 11:17:52 +01:00
|
|
|
add_foreign_key "types_de_champ", "types_de_champ", column: "parent_id"
|
2019-08-09 09:45:11 +02:00
|
|
|
add_foreign_key "users", "administrateurs"
|
2019-08-08 16:49:40 +02:00
|
|
|
add_foreign_key "users", "instructeurs"
|
2017-03-06 11:51:34 +01:00
|
|
|
add_foreign_key "without_continuation_mails", "procedures"
|
2016-11-04 17:11:26 +01:00
|
|
|
end
|