Finish the rollout of account_id to all core data models

Schema:
- add account_id to tables it was missing from
- make account_id a required column everywhere
- add [account_id] indexes, or add `account_id` to existing indices

Models:
- add `belongs_to :account` to all models (default to using a domain
  model's account whenever possible)
- add account_id in all the necessary fixtures
- add account_id to insert_all hashes
- pass account_id to a few initialize calls

Miscellaneous:
- update the import script to set account_id

Note that I'm not adding account_id to the join tables primarily
because I couldn't think of an easy way to populate it without making
it a full Join model, and that was more work than I have time to take
on right now.
This commit is contained in:
Mike Dalessio
2025-11-13 21:48:30 -05:00
parent 5a7f08067a
commit fe6df7085f
42 changed files with 311 additions and 49 deletions
+2
View File
@@ -2,12 +2,14 @@
active_webhook_tracker:
id: <%= ActiveRecord::FixtureSet.identify("active_webhook_tracker", :uuid) %>
account: 37s_uuid
webhook: active_uuid
consecutive_failures_count: 1
first_failure_at: <%= 1.hour.ago %>
inactive_webhook_tracker:
id: <%= ActiveRecord::FixtureSet.identify("inactive_webhook_tracker", :uuid) %>
account: 37s_uuid
webhook: inactive_uuid
consecutive_failures_count: 1
first_failure_at: <%= 1.hour.ago %>
+5
View File
@@ -2,6 +2,7 @@
successfully_completed:
id: <%= ActiveRecord::FixtureSet.identify("successfully_completed_delivery", :uuid) %>
account: 37s_uuid
webhook: active_uuid
event: logo_published_uuid
state: completed
@@ -11,6 +12,7 @@ successfully_completed:
unsuccessfully_completed:
id: <%= ActiveRecord::FixtureSet.identify("unsuccessfully_completed_delivery", :uuid) %>
account: 37s_uuid
webhook: active_uuid
event: logo_assignment_jz_uuid
state: completed
@@ -20,6 +22,7 @@ unsuccessfully_completed:
errored:
id: <%= ActiveRecord::FixtureSet.identify("errored_delivery", :uuid) %>
account: 37s_uuid
webhook: active_uuid
event: layout_published_uuid
state: errored
@@ -29,6 +32,7 @@ errored:
pending:
id: <%= ActiveRecord::FixtureSet.identify("pending_delivery", :uuid) %>
account: 37s_uuid
webhook: active_uuid
event: shipping_closed_uuid
state: pending
@@ -38,6 +42,7 @@ pending:
in_progress:
id: <%= ActiveRecord::FixtureSet.identify("in_progress_delivery", :uuid) %>
account: 37s_uuid
webhook: active_uuid
event: logo_assignment_km_uuid
state: in_progress