HABTM (Two-sided relationship) should use transactions to ensure data integrity

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Transactions
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Suppose I have:

      • Customer has_and_belongs_to_many reservations
      • Reservation has_and_belongs_to_many customers

      If I add a relation such as Customer.reservations << res, both the Customers and Reservations collections in my database will be updated. The updates to both collections should be wrapped in a single transaction, to ensure integrity of both collections.

      This ticket would only apply if I am using a server version which supports multi-collection transactions. I forget exactly but I think this was introduced in 4.2 for non-shards and 4.4 for shards.

      Transactions should not be used in the case of inverse_of: nil is used, because the relationship then becomes one-sided.

            Assignee:
            Unassigned
            Reporter:
            Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: