aboutsummaryrefslogtreecommitdiff
path: root/db/schema.rb
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2020-10-09 10:24:06 +0200
committerhellekin <hellekin@cepheide.org>2020-10-09 10:24:06 +0200
commitf48ce2f4c934fde3862cdad593eececc7a567d61 (patch)
treed2c874f8ebf4686d07052fa333032c04ef49e861 /db/schema.rb
parent31850c6ca118b7828dbaa3ad1a87dab4287718f5 (diff)
downloadincommon-map-f48ce2f4c934fde3862cdad593eececc7a567d61.tar.gz
Add Classifications and Resource validations
- Turn `has_and_belongs_to_many` into `has_many :through`: now, resources and sections are related through Classifications. - Refactor usage of jsonb column to use ActiveRecord validations - Attention! store_accessor: NOTE: If you are using structured database data types (eg. PostgreSQL hstore/json, or MySQL 5.7+ json) there is no need for the serialization provided by .store. Simply use .store_accessor instead to generate the accessor methods. Be aware that these columns use a string keyed hash and do not allow access using a symbol. NOTE: The default validations with the exception of uniqueness will work. For example, if you want to check for uniqueness with hstore you will need to use a custom validation to handle it. https://api.rubyonrails.org/classes/ActiveRecord/Store.html
Diffstat (limited to 'db/schema.rb')
-rw-r--r--db/schema.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/db/schema.rb b/db/schema.rb
index 16ba65c..0660ef9 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: 2020_10_08_190558) do
+ActiveRecord::Schema.define(version: 2020_10_09_061548) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -50,21 +50,22 @@ ActiveRecord::Schema.define(version: 2020_10_08_190558) do
t.index ["taxonomy_id"], name: "index_categories_on_taxonomy_id"
end
+ create_table "classifications", id: false, force: :cascade do |t|
+ t.bigint "resource_id", null: false
+ t.bigint "section_id", null: false
+ end
+
create_table "resources", force: :cascade do |t|
t.uuid "uuid"
- t.jsonb "feature"
+ t.jsonb "feature", default: {"geometry"=>{"type"=>"Point", "coordinates"=>[0, 0]}, "properties"=>{"city"=>"", "name"=>"", "srid"=>4326, "email"=>"", "source"=>"incommon", "address"=>"", "website"=>"", "categories"=>[], "description"=>"", "postal_code"=>"", "entry_number"=>nil, "phone_number"=>""}}
t.bigint "agent_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["agent_id"], name: "index_resources_on_agent_id"
+ t.index ["feature"], name: "index_resources_on_feature", using: :gin
t.index ["uuid"], name: "index_resources_on_uuid", unique: true
end
- create_table "resources_sections", id: false, force: :cascade do |t|
- t.bigint "resource_id", null: false
- t.bigint "section_id", null: false
- end
-
create_table "sections", force: :cascade do |t|
t.string "name", limit: 64
t.string "summary", limit: 136