summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-02 20:21:04 -0400
committerDavid Gay <david@davidgay.org>2021-05-02 20:21:04 -0400
commit2b32a88a8e9f1d0bb5055843ac987d9cb9981803 (patch)
tree19bf361b7cbb69ae493cc02d07f0fae2cf6da928 /db
parent5fe4e8f4a080e02dfc4e4adabd09d6f5c7e38f40 (diff)
Add Activities
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