twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
Other
23.66k stars 2.44k forks source link

Use NULL for strings instead of empty string '' #8007

Open FelixMalfait opened 1 month ago

FelixMalfait commented 1 month ago

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.

ritikpal1122 commented 1 week ago

Hi Can i Work on this ?

FelixMalfait commented 1 week ago

Hey @ritikpal1122 this is probably a bit too uncertain/complex for an external contributor to work on, we still need to refine the strategy. Thanks!!