summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20210503001859_create_activities.rb12
-rw-r--r--db/schema.rb11
-rw-r--r--db/seeds.rb5
3 files changed, 27 insertions, 1 deletions
diff --git a/db/migrate/20210503001859_create_activities.rb b/db/migrate/20210503001859_create_activities.rb
new file mode 100644
index 0000000..883d82a
--- /dev/null
+++ b/db/migrate/20210503001859_create_activities.rb
@@ -0,0 +1,12 @@
+class CreateActivities < ActiveRecord::Migration[6.1]
+ def change
+ create_table :activities do |t|
+ t.string :gid
+ t.string :name
+ t.text :description
+ t.jsonb :whatnot
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 67fd0f5..85aa952 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,11 +10,20 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2021_05_02_212517) do
+ActiveRecord::Schema.define(version: 2021_05_03_001859) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
+ create_table "activities", force: :cascade do |t|
+ t.string "gid"
+ t.string "name"
+ t.text "description"
+ t.jsonb "whatnot"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ end
+
create_table "items", force: :cascade do |t|
t.string "gid"
t.string "name"
diff --git a/db/seeds.rb b/db/seeds.rb
index 2008d89..00a0566 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -24,3 +24,8 @@ load_data_file("data/items.yml").map do |gid, hash|
item.whatnot = hash[:whatnot]
item.save
end
+
+load_data_file("data/activities.yml").map do |gid, hash|
+ activity = Activity.find_or_create_by(gid: gid)
+ activity.update(hash)
+end