From 202e055b7b0522a4a0f1cef701d9bc9165453f68 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 16 Oct 2018 14:00:52 +0300 Subject: [PATCH] Add geo areas schema --- db/migrate/20181010183331_create_geo_areas.rb | 14 ++++++++++++++ db/schema.rb | 13 ++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20181010183331_create_geo_areas.rb diff --git a/db/migrate/20181010183331_create_geo_areas.rb b/db/migrate/20181010183331_create_geo_areas.rb new file mode 100644 index 000000000..b634e5c67 --- /dev/null +++ b/db/migrate/20181010183331_create_geo_areas.rb @@ -0,0 +1,14 @@ +class CreateGeoAreas < ActiveRecord::Migration[5.2] + def change + create_table :geo_areas do |t| + t.string :source, index: true + + t.jsonb :geometry + t.jsonb :properties + + t.references :champ, foreign_key: true, index: true + end + + add_column :types_de_champ, :options, :jsonb + end +end diff --git a/db/schema.rb b/db/schema.rb index bc277e782..d74aeec41 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_10_10_070424) do +ActiveRecord::Schema.define(version: 2018_10_10_183331) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -342,6 +342,15 @@ ActiveRecord::Schema.define(version: 2018_10_10_070424) do t.index ["user_id"], name: "index_france_connect_informations_on_user_id" end + create_table "geo_areas", force: :cascade do |t| + t.string "source" + t.jsonb "geometry" + t.jsonb "properties" + t.bigint "champ_id" + t.index ["champ_id"], name: "index_geo_areas_on_champ_id" + t.index ["source"], name: "index_geo_areas_on_source" + end + create_table "gestionnaires", id: :serial, force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -544,6 +553,7 @@ ActiveRecord::Schema.define(version: 2018_10_10_070424) do t.boolean "private", default: false, null: false t.datetime "created_at" t.datetime "updated_at" + t.jsonb "options" t.index ["private"], name: "index_types_de_champ_on_private" end @@ -608,6 +618,7 @@ ActiveRecord::Schema.define(version: 2018_10_10_070424) do add_foreign_key "commentaires", "dossiers" add_foreign_key "dossiers", "users" add_foreign_key "feedbacks", "users" + add_foreign_key "geo_areas", "champs" add_foreign_key "initiated_mails", "procedures" add_foreign_key "procedure_paths", "administrateurs" add_foreign_key "procedure_paths", "procedures"