This is because we don't store strings as NULL in the database but instead store them as ''.
The underlying motivation for this was that the frontend shouldn't have to deal with both.
But we should have done the null -> '' transformation at a different level (either API level or in the frontend but at a low level so that it's not spread across the codebase).
We should do a command to migrate existing data in the DB.
When creating a unique index we had to resort to temporary hacks like this: https://github.com/twentyhq/twenty/blob/849d7c2423db7524f9fd82ccc354945668eaa342/packages/twenty-server/src/engine/workspace-manager/workspace-migration-builder/factories/workspace-migration-index.factory.ts#L114
This is because we don't store strings as NULL in the database but instead store them as ''. The underlying motivation for this was that the frontend shouldn't have to deal with both. But we should have done the null -> '' transformation at a different level (either API level or in the frontend but at a low level so that it's not spread across the codebase).
We should do a command to migrate existing data in the DB.