lsmacedo/rdm

Allow insertion of multiple table rows for the same record

Opened this issue · 0 comments

If necessary to execute multiple queries, make sure to do it in a transaction.

Suggestion 1:

...
"image": {
  "set": [{
    "url": "$track.image",
    "track_id": "track.id"
  }, {
    "url": "$album.image",
    "album_id": "album.id"
  }],
},
...

Suggestion 2:

...
"tables": [{
  "track": {...},
  "image": {...}
}, {
  "album": {...},
  "image": {...}
}]
...

Both suggestions can be implemented, as each of them has advantages and disadvantages.

Fake scenario not possible with suggestion 1: inserting multiple image data rows for each image, for example with a different value for type.

Fake scenario not possible with suggestion 2: assigning both track and album a artist id without duplicating the artist upsert.