Browse Source
* Update remote schema.rb with migrations, main features for this ticket still incoming * Add join table for organisation self-referential parent/child relationships * Add join table for organisation self-referential parent/child relationships * Remove organisation_la factory and add test for organisation_relationship child/parent association * Update spec/models/organisation_spec.rb Co-authored-by: James Rose <james@jbpr.net> Co-authored-by: James Rose <james@jbpr.net>pull/834/head
natdeanlewissoftwire
2 years ago
committed by
GitHub
6 changed files with 46 additions and 8 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