2020-09-30 21:42:33 +01:00
|
|
|
import crypto from "crypto";
|
|
|
|
|
2020-11-02 19:33:14 +00:00
|
|
|
export function generateUniqueName(baseName = "", length = 4): string {
|
2020-09-30 21:42:33 +01:00
|
|
|
return `${baseName}${crypto.randomBytes(length).toString("hex")}`;
|
|
|
|
}
|
2021-02-18 13:40:58 +00:00
|
|
|
|
2021-04-21 18:45:34 +01:00
|
|
|
export function generateDatabaseNameWithTimestamp(baseName = "db", length = 1): string {
|
2021-03-05 00:12:31 +00:00
|
|
|
return `${baseName}${crypto.randomBytes(length).toString("hex")}-${Date.now()}`;
|
|
|
|
}
|