Skip to content

Commit 029df39

Browse files
committed
Add space reference field
1 parent ff0ba1b commit 029df39

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class AddSpaceIdToTables < ActiveRecord::Migration[7.2]
2+
def change
3+
add_reference :materials, :space, foreign_key: true
4+
add_reference :events, :space, foreign_key: true
5+
add_reference :workflows, :space, foreign_key: true
6+
add_reference :collections, :space, foreign_key: true
7+
add_reference :learning_paths, :space, foreign_key: true
8+
add_reference :learning_path_topics, :space, foreign_key: true
9+
end
10+
end

db/schema.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@
124124
t.string "image_content_type"
125125
t.bigint "image_file_size"
126126
t.datetime "image_updated_at"
127+
t.bigint "space_id"
127128
t.index ["slug"], name: "index_collections_on_slug", unique: true
129+
t.index ["space_id"], name: "index_collections_on_space_id"
128130
t.index ["user_id"], name: "index_collections_on_user_id"
129131
end
130132

@@ -230,8 +232,10 @@
230232
t.boolean "visible", default: true
231233
t.string "language"
232234
t.string "open_science", default: [], array: true
235+
t.bigint "space_id"
233236
t.index ["presence"], name: "index_events_on_presence"
234237
t.index ["slug"], name: "index_events_on_slug", unique: true
238+
t.index ["space_id"], name: "index_events_on_space_id"
235239
t.index ["user_id"], name: "index_events_on_user_id"
236240
end
237241

@@ -294,6 +298,8 @@
294298
t.datetime "created_at", null: false
295299
t.datetime "updated_at", null: false
296300
t.string "difficulty_level", default: "notspecified"
301+
t.bigint "space_id"
302+
t.index ["space_id"], name: "index_learning_path_topics_on_space_id"
297303
end
298304

299305
create_table "learning_paths", force: :cascade do |t|
@@ -316,8 +322,10 @@
316322
t.datetime "created_at", null: false
317323
t.datetime "updated_at", null: false
318324
t.boolean "public", default: true
325+
t.bigint "space_id"
319326
t.index ["content_provider_id"], name: "index_learning_paths_on_content_provider_id"
320327
t.index ["slug"], name: "index_learning_paths_on_slug", unique: true
328+
t.index ["space_id"], name: "index_learning_paths_on_space_id"
321329
t.index ["user_id"], name: "index_learning_paths_on_user_id"
322330
end
323331

@@ -379,8 +387,10 @@
379387
t.text "learning_objectives"
380388
t.string "fields", default: [], array: true
381389
t.boolean "visible", default: true
390+
t.bigint "space_id"
382391
t.index ["content_provider_id"], name: "index_materials_on_content_provider_id"
383392
t.index ["slug"], name: "index_materials_on_slug", unique: true
393+
t.index ["space_id"], name: "index_materials_on_space_id"
384394
t.index ["user_id"], name: "index_materials_on_user_id"
385395
end
386396

@@ -616,24 +626,31 @@
616626
t.date "remote_updated_date"
617627
t.boolean "hide_child_nodes", default: false
618628
t.boolean "public", default: true
629+
t.bigint "space_id"
619630
t.index ["slug"], name: "index_workflows_on_slug", unique: true
631+
t.index ["space_id"], name: "index_workflows_on_space_id"
620632
t.index ["user_id"], name: "index_workflows_on_user_id"
621633
end
622634

623635
add_foreign_key "bans", "users"
624636
add_foreign_key "bans", "users", column: "banner_id"
625637
add_foreign_key "collaborations", "users"
638+
add_foreign_key "collections", "spaces"
626639
add_foreign_key "collections", "users"
627640
add_foreign_key "content_providers", "nodes"
628641
add_foreign_key "content_providers", "users"
629642
add_foreign_key "event_materials", "events"
630643
add_foreign_key "event_materials", "materials"
644+
add_foreign_key "events", "spaces"
631645
add_foreign_key "events", "users"
632646
add_foreign_key "learning_path_topic_links", "learning_paths"
647+
add_foreign_key "learning_path_topics", "spaces"
633648
add_foreign_key "learning_paths", "content_providers"
649+
add_foreign_key "learning_paths", "spaces"
634650
add_foreign_key "learning_paths", "users"
635651
add_foreign_key "llm_interactions", "events"
636652
add_foreign_key "materials", "content_providers"
653+
add_foreign_key "materials", "spaces"
637654
add_foreign_key "materials", "users"
638655
add_foreign_key "node_links", "nodes"
639656
add_foreign_key "nodes", "users"
@@ -644,5 +661,6 @@
644661
add_foreign_key "stars", "users"
645662
add_foreign_key "subscriptions", "users"
646663
add_foreign_key "users", "roles"
664+
add_foreign_key "workflows", "spaces"
647665
add_foreign_key "workflows", "users"
648666
end

0 commit comments

Comments
 (0)