Revert "Convert metadata tables to camelCase" (#2419)

Revert "Convert metadata tables to camelCase (#2400)"

This reverts commit 1cf08c797f.
This commit is contained in:
Charles Bochet
2023-11-10 11:48:44 +01:00
committed by GitHub
parent 1cf08c797f
commit 7b9175a4a4
238 changed files with 2253 additions and 1852 deletions

View File

@ -0,0 +1,21 @@
/**
* Converts a UUID to a base 36 string.
* This is used to generate the schema name since hyphens from workspace uuid are not allowed in postgres schema names.
*
* @param uuid
* @returns
*/
export function uuidToBase36(uuid: string): string {
let devId = false;
if (uuid.startsWith('twenty-')) {
devId = true;
// Clean dev uuids (twenty-)
uuid = uuid.replace('twenty-', '');
}
const hexString = uuid.replace(/-/g, '');
const base10Number = BigInt('0x' + hexString);
const base36String = base10Number.toString(36);
return `${devId ? 'twenty_' : ''}${base36String}`;
}