Add subject column to semantic links

This commit is contained in:
Maikel Linke
2024-10-30 13:54:32 +11:00
parent 60d4cd60ff
commit 48e8ad3dd0
2 changed files with 18 additions and 1 deletions

View 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

View File

@@ -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