Jack S
2 years ago
committed by
GitHub
4 changed files with 39 additions and 6 deletions
@ -1,4 +1,11 @@ |
|||||||
class OrganisationRelationship < ApplicationRecord |
class OrganisationRelationship < ApplicationRecord |
||||||
belongs_to :child_organisation, class_name: "Organisation" |
belongs_to :child_organisation, class_name: "Organisation" |
||||||
belongs_to :parent_organisation, class_name: "Organisation" |
belongs_to :parent_organisation, class_name: "Organisation" |
||||||
|
|
||||||
|
RELATIONSHIP_TYPE = { |
||||||
|
"owning": 0, |
||||||
|
"managing": 1, |
||||||
|
}.freeze |
||||||
|
|
||||||
|
enum relationship_type: RELATIONSHIP_TYPE |
||||||
end |
end |
||||||
|
@ -0,0 +1,10 @@ |
|||||||
|
class AddRelationshipTypeToOrgRelationships < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
add_column( |
||||||
|
:organisation_relationships, |
||||||
|
:relationship_type, |
||||||
|
:integer, |
||||||
|
null: false, # rubocop:disable Rails/NotNullColumn |
||||||
|
) |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue