Created
June 2, 2023 18:24
-
-
Save thegorgon/afcc36859497e2b2da38e1e85fe03827 to your computer and use it in GitHub Desktop.
Table Options?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create_table :relationships do |t| | |
t.belongs_to :entity_left, polymorphic: true | |
t.belongs_to :entity_right, polymorphic: true | |
t.string :relationship_type | |
t.string :relationship_type_other | |
t.integer :ownership_percentage # For beneficial ownership | |
t.boolean :relationship_continues # For institution relationships | |
t.date :actioned_at # For institution relationships | |
t.string :status # For institution relationships | |
t.jsonb :other_metadata # For other relationships | |
end | |
# OR | |
create_table :relationships do |t| | |
t.belongs_to :entity_left, polymorphic: true | |
t.belongs_to :entity_right, polymorphic: true | |
t.string :relationship_type | |
t.string :relationship_type_other | |
t.jsonb :other_metadata | |
end | |
create_table :ownership_relationship_metadata do |t| | |
t.belongs_to :relationship | |
t.integer :ownership_percentage # For beneficial ownership | |
end | |
create_table :institution_relationship_metadata do |t| | |
t.belongs_to :relationship | |
t.boolean :relationship_continues # For institution relationships | |
t.date :actioned_at # For institution relationships | |
t.string :status # For institution relationships | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment