Category: Laravel, Laravel, MySQL, MySQL, api, api

We think you might be interested in this job:

Lead Full-Stack Developer

SPARK Business Works

On one of the projects I'm working on we've decided to switch to using UUIDs as our publicly facing identifiers (in routes, API requests, etc). The motivation behind this is that the business does not want to competitors to know how we a tracking in terms of business metrics, which can sometimes be deduced from the changes in integer ids.

Next up, we need to actually add the UUID column to all of our database tables and populate it with an automatically generated UUID.

To migrate each table, we need to execute a few steps in order: To do this, we loop over each one of the model classes defined int the MODEL_CLASSES constant.

We do this in chunks of 1000 to ensure that we don't accidentally run out of memory, and also consider soft deleted records (we're going to add a NOT NULL constraint to the table, so every single row need a UUID).

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Community Partners