May 11, 2015
0
Level 2
Concurrency and a Second ID
I have a table with three columns of interest.
posts(id, uri, uri_id)
The goal is to have a situation as follows.
(1, a, 1)
(2, b, 1)
(3, c, 1)
(4, a, 2)
(5, b, 2)
(6, b, 3)
The uri references another table. id is an autoincrementing number. uri_id only increments to satisfy a unique(uri, uri_id) index.
My friend says that the only way to do this without having concurrency issues is to use a MySQL trigger, however, this would affect the database agnosticism of Laravel which I wish to support.
Has anyone dealt with a similar situation? Does Laravel offer features to deal with concurrency issues when schema building?
Please or to participate in this conversation.