Skip to content

Create Constraints

CJ Brewer edited this page Oct 12, 2016 · 1 revision

KEY: "valid" = (1) record exists and (2) that record's _meta._archived is set to false.

hasMany --> hasMany

checkValidIds

  • The original's relationship array must either be (A) or (B)

    (A) an empty array NOTE: check manually

    (B) an array of "valid" ids

hasMany --> hasOne

NOTE: The original's relationship is not actually stored.

checkManyInverseHasOne

  • The original's relationship must be (A) or (B)

    (A) an empty array NOTE: check manually

    (B) an array of "valid" ids

  • The inverse's relationship must either be (A) or (B) or (C)

    (A) empty

    (B) a resourcePointer with its _archived flag set to true

    (C) a resourcePointer with its _related flag set to false

hasMany --> belongsTo

NOTE: The original's relationship is not actually stored.

  • The original's relationship array must be null or empty. NOTE: check manually

hasOne --> hasOne

checkInverseHasOne

  • The original's relationship must either be (A) or (B)

    (A) null NOTE: check manually

    (B) point to a "valid" id

  • The inverse's relationship must either be (A) or (B) or (C)

    (A) empty

    (B) a resourcePointer with its _archived flag set to true

    (C) a resourcePointer with its _related flag set to false

hasOne --> hasMany

NOTE: The inverse's relationship is not actually stored.

checkValidId

  • The original's relationship must either be (A) or (B)

    (A) null NOTE: check manually

    (B) point to a "valid" id

hasOne --> belongsTo

  • The original's relationship must be null or empty. NOTE: check manually

belongsTo --> hasMany

NOTE: The inverse's relationship is not actually stored.

checkValidId

  • The original's relationship must be (1) and (2)

    (1) be set NOTE: check manually

    (2) point to "valid" id

belongsTo --> hasOne

checkInverseHasOne

  • The original's relationship must be (1) and (2)

    (1) be set NOTE: check manually

    (2) point to "valid" id

  • The inverse's relationship must either be (A) or (B) or (C)

    (A) empty

    (B) a resourcePointer with its _archived flag set to true

    (C) a resourcePointer with its _related flag set to false

Clone this wiki locally