diff options
author | hellekin <hellekin@cepheide.org> | 2020-10-06 16:17:44 +0200 |
---|---|---|
committer | hellekin <hellekin@cepheide.org> | 2020-10-06 16:21:40 +0200 |
commit | 77d78b9023106cedd81703a1c6735e9109f631bb (patch) | |
tree | 66547d568d713d1d6e01efbe80e3d10f4d9da36b /db/migrate/20201006140511_create_resources.rb | |
parent | 341293217aefc15a10fc81dfc1d7850f89acfb1f (diff) | |
download | incommon-map-77d78b9023106cedd81703a1c6735e9109f631bb.tar.gz |
Add Resource model
Resources will be stored as JSON, in the (GeoJSON) :feature column.
They are assigned an UUID upon creation if they don't comme with one.
They belong to an Agent.
Diffstat (limited to 'db/migrate/20201006140511_create_resources.rb')
-rw-r--r-- | db/migrate/20201006140511_create_resources.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/db/migrate/20201006140511_create_resources.rb b/db/migrate/20201006140511_create_resources.rb new file mode 100644 index 0000000..761d5bc --- /dev/null +++ b/db/migrate/20201006140511_create_resources.rb @@ -0,0 +1,13 @@ +class CreateResources < ActiveRecord::Migration[6.0] + def change + create_table :resources do |t| + t.uuid :uuid + t.jsonb :feature + t.references :agent, null: false, foreign_key: true + + t.timestamps + end + add_index :resources, [:uuid], unique: true + add_index :resources, [:agent_id] + end +end |