mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Add subject column to semantic links
This commit is contained in:
14
db/migrate/20241030023153_add_subject_to_semantic_links.rb
Normal file
14
db/migrate/20241030023153_add_subject_to_semantic_links.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# rails g migration AddSubjectToSemanticLinks subject:references{polymorphic}
|
||||
#
|
||||
# We want to add links to Exchanges as well as Variants.
|
||||
# The word subject comes from the triple structure of the Semantic Web:
|
||||
#
|
||||
# Subject predicate object (variant has linke URL)
|
||||
class AddSubjectToSemanticLinks < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
# We allow `null` until we filled the new columns with existing data.
|
||||
add_reference :semantic_links, :subject, polymorphic: true, null: true
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2024_10_23_054951) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2024_10_30_023153) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "plpgsql"
|
||||
@@ -405,6 +405,9 @@ ActiveRecord::Schema[7.0].define(version: 2024_10_23_054951) do
|
||||
t.string "semantic_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "subject_type"
|
||||
t.bigint "subject_id"
|
||||
t.index ["subject_type", "subject_id"], name: "index_semantic_links_on_subject"
|
||||
t.index ["variant_id"], name: "index_semantic_links_on_variant_id"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user