To preserve functionalty, we added owner_id as nullable. A migration will move all accounts to "shared" by default to preserve current functionality for existing users. New users get to choose their own sharing setting immediately.
1.2 Add owner_id to accounts
# db/migrate/YYYYMMDDHHMMSS_add_owner_to_accounts.rb
add_reference :accounts, :owner, type: :uuid, foreign_key: { to_table: :users }, null: true, index: true
null: true initially to allow backfill. Made NOT NULL in a later migration step.
TODO:
1.4 Backfill migration
Backfill existing accounts:
- Set all existing families to default_account_sharing: "shared" (preserves current behavior)
- Set owner_id to the family admin (or first user) for all existing accounts
- Create account_shares for all non-owner family members with full_control + include_in_finances=true
After backfill, make owner_id NOT NULL:
change_column_null :accounts, :owner_id, false
@jjmata fyi for next release ( or 2 )
To preserve functionalty, we added owner_id as nullable. A migration will move all accounts to "shared" by default to preserve current functionality for existing users. New users get to choose their own sharing setting immediately.
1.2 Add owner_id to accounts
null: true initially to allow backfill. Made NOT NULL in a later migration step.
TODO:
1.4 Backfill migration
Backfill existing accounts:
@jjmata fyi for next release ( or 2 )