Skip to content

Fix user sync script when swapping rooms #522

@nymous

Description

@nymous

In lib/tasks/sync_accounts.rake

Initial situation:

  • User 1 in B001
  • User 2 in A001

What we want to sync:

  • User 1 in A001
  • User 2 in B001

Because we loop on users in ID number, we will set User 1 room to A001 first, which will break the unique constraint.

We can replace our unique index with a unique constraint that is DEFERRABLE, then configure in the transaction that we want to delay constraint validation.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions