This commit is contained in:
Benjamin Toby
2025-01-13 09:00:21 +01:00
parent 6364f6a312
commit e0a030f10d
859 changed files with 5397 additions and 10163 deletions
+56
View File
@@ -0,0 +1,56 @@
import createDbFromSchema from "@/package-shared/shell/createDbFromSchema";
import mysql, { ServerlessMysql } from "serverless-mysql";
console.log(`Initializing Database ...`);
/**
* # Declare Global Variables
*/
declare global {
var DB_CONN: ServerlessMysql;
var DSQL_DB_CONN: ServerlessMysql;
}
global.DSQL_DB_CONN = mysql({
config: {
host: process.env.DSQL_DB_HOST,
user: process.env.DSQL_DB_USERNAME,
password: process.env.DSQL_DB_PASSWORD,
database: process.env.DSQL_DB_NAME,
charset: "utf8mb4",
// ssl: grabDbSSL(),
},
});
global.DSQL_READ_ONLY_DB_CONN = mysql({
config: {
host: process.env.DSQL_DB_HOST,
user: process.env.DSQL_DB_READ_ONLY_USERNAME,
password: process.env.DSQL_DB_READ_ONLY_PASSWORD,
port: process.env.DSQL_DB_PORT
? Number(process.env.DSQL_DB_PORT)
: undefined,
charset: "utf8mb4",
// ssl: grabDbSSL(),
},
});
global.DSQL_FULL_ACCESS_DB_CONN = mysql({
config: {
host: process.env.DSQL_DB_HOST,
user: process.env.DSQL_DB_FULL_ACCESS_USERNAME,
password: process.env.DSQL_DB_FULL_ACCESS_PASSWORD,
port: process.env.DSQL_DB_PORT
? Number(process.env.DSQL_DB_PORT)
: undefined,
charset: "utf8mb4",
// ssl: grabDbSSL(),
},
});
/**
* # Run Function
*/
await createDbFromSchema({});
process.exit(0);