Skip to content

Family sharing migration, phase 2 #1271

Description

@sokie

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:

  1. Set all existing families to default_account_sharing: "shared" (preserves current behavior)
  2. Set owner_id to the family admin (or first user) for all existing accounts
  3. 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 )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions