Add relation between Goal and LocalTarget
This is similar to what we do with investments, which belong to a heading but also belong to a budget. In our case, the reason is we've been asked to add local targets which belong to a goal but are not related to any existing target. Even though we're not implementing that case right now, we're adding the relation so we don't have to add data migrations in the future.
This commit is contained in:
5
db/migrate/20210123100638_add_goals_to_local_targets.rb
Normal file
5
db/migrate/20210123100638_add_goals_to_local_targets.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddGoalsToLocalTargets < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_reference :sdg_local_targets, :goal
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_01_07_125458) do
|
||||
ActiveRecord::Schema.define(version: 2021_01_23_100638) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_trgm"
|
||||
@@ -1322,7 +1322,9 @@ ActiveRecord::Schema.define(version: 2021_01_07_125458) do
|
||||
t.string "code"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.bigint "goal_id"
|
||||
t.index ["code"], name: "index_sdg_local_targets_on_code", unique: true
|
||||
t.index ["goal_id"], name: "index_sdg_local_targets_on_goal_id"
|
||||
t.index ["target_id"], name: "index_sdg_local_targets_on_target_id"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user