aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2020-11-12 23:39:13 +0100
committerhellekin <hellekin@cepheide.org>2020-11-12 23:39:13 +0100
commit6c9922a87fb72b958b78014c45b6cd1efafdd30e (patch)
treec58addb0b39bafe5bc8aceebe659bb2cc86f3851 /db
parent8d9387cf64929b6467b6ba52f22ca0aa5ed35782 (diff)
downloadincommon-map-6c9922a87fb72b958b78014c45b6cd1efafdd30e.tar.gz
Add Stimulus Map and Taxonomy (WIP)
This commit add StimulusJS interaction for the map and taxonomy, as well as styling. It provides preliminary work to hook up live data on the map from the taxonomy.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20201110225447_create_maps.rb14
-rw-r--r--db/seeds.rb5
2 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20201110225447_create_maps.rb b/db/migrate/20201110225447_create_maps.rb
new file mode 100644
index 0000000..bf001f0
--- /dev/null
+++ b/db/migrate/20201110225447_create_maps.rb
@@ -0,0 +1,14 @@
+class CreateMaps < ActiveRecord::Migration[6.0]
+ def change
+ create_table :maps do |t|
+ t.uuid :uuid, null: false, unique: true
+ t.decimal :latitude, precision: 9, scale: 7
+ t.decimal :longitude, precision: 10, scale: 7
+ t.integer :zoom, default: 13
+ t.references :taxonomy, null: false, foreign_key: true
+
+ t.timestamps
+ end
+ add_index :maps, [:uuid], unique: true
+ end
+end
diff --git a/db/seeds.rb b/db/seeds.rb
index ea9fc25..6252ebf 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -48,3 +48,8 @@ if Category.count == 0
end
end
end
+
+# Create default map
+if Map.count == 0
+ Map.create(uuid: "1a42651e-3fe8-4e83-bfcd-f14bb8d0c713", latitude: 50.8503396, longitude: 4.3517103, zoom: 13, taxonomy_id: 1)
+end