[Issue 1166] Create tables for expanded opportunity data model #1187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1166
This requires #1136 to be merged first as it builds ontop of that work
Time to review: 5 mins
Changes proposed
Created the opportunity tables for the expanded data model
https://app.gitbook.com/o/cFcvhi6d0nlLyH2VzVgn/s/v1V0jIH7mb7Yb3jlNrgk/engineering/learnings/opportunity-endpoint-data-model#overview
Setup factories to generate data in a reasonable way for these tables
Context for reviewers
This sets up all of the tables for our expanded opportunity data model - tables we'll copy to for DMS that will later be transformed to these tables will be a separate PR.
The factories try to make somewhat realistic data with some variability.
Note that I did adjust a few things from the tech spec, which I just haven't changed in that document yet (can't merge the changes myself)
other_value
fields in the link tables actually make sense to stay in the summary table, I found examples of them working different than I had assumed, so it makes more sense to keep them in a general place.opportunity_agency
table idea I've dropped - if we want to adjust how agency data is stored, will deal with it later when we deal with the rest of the agency dataopportunity_id
- already was going to keep several that way - don't see a reason to have several different primary/foreign key setups.Additional information
Running
![Screenshot 2024-02-07 at 12 55 48 PM](https://private-user-images.githubusercontent.com/46358556/303088619-1432481d-0563-45d2-9660-66721c16c4ba.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NzE3MTAsIm5iZiI6MTczODg3MTQxMCwicGF0aCI6Ii80NjM1ODU1Ni8zMDMwODg2MTktMTQzMjQ4MWQtMDU2My00NWQyLTk2NjAtNjY3MjFjMTZjNGJhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDE5NTAxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUyYzljN2Y0NmM3Njk1ODBkODg3N2JjZDc0NWJlNmMzOTM2NmRmNDBjMDA2NjIyYmM0YmRkMjRhOTFkNDRmZDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BMO7Kk4sxBoOWt9WoubCog0T7TBP2W0LAXBS8QuseQM)
![Screenshot 2024-02-07 at 12 56 14 PM](https://private-user-images.githubusercontent.com/46358556/303088874-5d9a63fb-4339-42cc-b445-f204f9a7842c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NzE3MTAsIm5iZiI6MTczODg3MTQxMCwicGF0aCI6Ii80NjM1ODU1Ni8zMDMwODg4NzQtNWQ5YTYzZmItNDMzOS00MmNjLWI0NDUtZjIwNGY5YTc4NDJjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDE5NTAxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZlOWMwYzlmNDdlMjBkY2Y1NzIzMTU2YWM4ZTBmMTBhNTBiY2MwNThjNTFhNTEzOWFkM2FhM2Q3ODhjOTdkZGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.jzY5Dd68wXkLnYLP-8N6zdKci3LSQ0wNTae61BJiY2U)
![Screenshot 2024-02-07 at 12 56 21 PM](https://private-user-images.githubusercontent.com/46358556/303088877-d61999ed-f2c9-4bbe-9c09-8337fdf38914.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NzE3MTAsIm5iZiI6MTczODg3MTQxMCwicGF0aCI6Ii80NjM1ODU1Ni8zMDMwODg4NzctZDYxOTk5ZWQtZjJjOS00YmJlLTljMDktODMzN2ZkZjM4OTE0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDE5NTAxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNkNTJmMzNiOWQyYjY0ZjFjNjZhMzBkNjNmMTY5NjRlNWVhYmUzYjk1ZTMwYjQ2ZmFlNjBiNDZkOGFlZDVmOTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.v3im3KiGDbMvbal31fKHzEBy-vdMNy6nWuWH2ghd2VI)
![Screenshot 2024-02-07 at 12 56 26 PM](https://private-user-images.githubusercontent.com/46358556/303088879-478002bb-6c41-4429-ae6b-d088e3f8297f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NzE3MTAsIm5iZiI6MTczODg3MTQxMCwicGF0aCI6Ii80NjM1ODU1Ni8zMDMwODg4NzktNDc4MDAyYmItNmM0MS00NDI5LWFlNmItZDA4OGUzZjgyOTdmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDE5NTAxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI3MGFhZTJjYzk2YzE3MmYwZmI3MDllZTYyNjYzYmEwYmMzNjdlZTgwNzZhNTc5MmI4ODJkNzc3NmEyNTdhNjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.JMFfmfJbu09hV0tOBC90QC2dMziVPHIDN7LY9RXaUT4)
![Screenshot 2024-02-07 at 12 56 44 PM](https://private-user-images.githubusercontent.com/46358556/303088882-2211c4cb-6f99-4655-b814-09db66b4aeb9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NzE3MTAsIm5iZiI6MTczODg3MTQxMCwicGF0aCI6Ii80NjM1ODU1Ni8zMDMwODg4ODItMjIxMWM0Y2ItNmY5OS00NjU1LWI4MTQtMDlkYjY2YjRhZWI5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDE5NTAxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBkNDk0MTVkNGM2NDgzMGMzNDc2ZTZhNDliMjAzNWRiNWEwZjIwMThhYjY5Y2U3MzgyZmE1OGNmODBkNzIzZDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.yujBOyc-BAXcDELeN-1eI1THeC_ZZkk9B9YVOLmiqHE)
make db-seed-local
after the migrations shows the data in various tables in what I would expect: