4 changed files with 25 additions and 1 deletions
@ -0,0 +1,4 @@ |
|||||||
|
class OrganisationRelationship < ApplicationRecord |
||||||
|
belongs_to :child_organisation, class_name: "Organisation" |
||||||
|
belongs_to :parent_organisation, class_name: "Organisation" |
||||||
|
end |
@ -0,0 +1,9 @@ |
|||||||
|
class AddParentChildRelationships < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
create_table :organisation_relationships do |t| |
||||||
|
t.integer :child_organisation_id, foreign_key: true |
||||||
|
t.integer :parent_organisation_id, foreign_key: true |
||||||
|
t.timestamps |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue