To speed up, avoid unnecessary stuff on the DB and more importantly, avoid collision, we should create the unique URL from the data we have for each training. So we won't need the id_url field any longer as we can decode it back into the unique row's ID. We should also add some unique strings at the beginning and the end to make it more random.
For example, users with ID '1' and '456' would have this URL strings:
To speed up, avoid unnecessary stuff on the DB and more importantly, avoid collision, we should create the unique URL from the data we have for each training. So we won't need the
id_url
field any longer as we can decode it back into the unique row's ID. We should also add some unique strings at the beginning and the end to make it more random.For example, users with ID '1' and '456' would have this URL strings:
The best thing about this is that we than can decode this URL to get the ID:
We can then make a regular expression to grab the number between 'calcu' and 'evs'. And we got the ID!
:+1: