You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.
There are multiple ways to implement a one-to-many model relationship like this.
The least invasive approach would be to follow the example of related steps, and create a proposals.parent_id column so that proposals can be grouped together into a set. The assumption there is that there is enough difference amongst the client_data attribute values on each proposal that we aren't simply duplicating N values on each proposal in the set. If that assumption were false, that would be a disadvantage of this approach. The advantages include: minimal db change, no need to affect existing data, maximum flexibility for different client_data values on each line, ability to approve/disapprove steps on lines independently (line-item veto), and no need to duplicate aggregate values (like total amount) since they can be calculated dynamically.
Create a new client_data_items table with a client_data_id column. These rows would each represent a single line item. Advantages include: "true-er" representation of business case. Disadvantages: potentially duplicated data in client_data and client_data_items, need to keep them in sync.
Create a JSON column on client_data called items. This gives us the most flexibility in terms of the data model, since the internal structure of that column would be managed entirely in code. Advantages: near-zero data duplication. Disadvantages: managing data in code means we cannot rely on db constraints.
Proposals require a way to depict having multiple line-items and multiple vendors.
Reference doc: https://docs.google.com/document/d/1_gjq_3m16Ug7_JcfsV28Lt4dCQTDnEhvWVFofbNaw4g/edit
Reference issue: 18F/C2: Issue #1151
The text was updated successfully, but these errors were encountered: