4 ms·
> I’ve always personally preferred simple database IDs to be generally preferable over using UUIDs. Unless you start migrating data between environments and wa
by jve 4y ago
> I’ve always personally preferred simple database IDs to be generally preferable over using UUIDs.
Unless you start migrating data between environments and want references to be alive.
Anyway, if you need a hardcoded GUID for tests or what, paste this into PowerShell: [Guid]::NewGuid()
Not arguing, just developing for a system that uses guids as primary IDs and writing tests for that system. I don't even need to hardcode GUID, as within test bootstrap I'm creating objects with generated IDs I can reference later for comparison.
- lstamour 4y agoI’ve done that before too - but it’s always possible if you run tests often enough that you’ll get an ID collision that randomly fails a test and causes a developer some grief. Easier to not use random sources of data as a rule of thumb within your unit tests.