Bugfix
This commit is contained in:
@@ -19,18 +19,13 @@ const targetDatabase = dbFlag >= 0 ? process.argv[dbFlag + 1] : null;
|
||||
* @param {string} [params.dbFnArg] - User Database full name
|
||||
*/
|
||||
async function createDbFromSchema({ userId, dbFnArg }) {
|
||||
/**
|
||||
* Grab Schema
|
||||
*
|
||||
* @description Grab Schema
|
||||
*/
|
||||
const path = userId
|
||||
const schemaPath = userId
|
||||
? `${String(
|
||||
process.env.DSQL_USER_DB_SCHEMA_PATH
|
||||
)}/user-${userId}/main.json`
|
||||
: "../jsonData/dbSchemas/main.json";
|
||||
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType[]} */
|
||||
const dbSchema = require(path);
|
||||
const dbSchema = require(schemaPath);
|
||||
|
||||
// await createDatabasesFromSchema(dbSchema);
|
||||
|
||||
|
||||
@@ -57,12 +57,19 @@ module.exports = function generateColumnDescription({
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
// if (String(fieldEntryText).match(/ UUID$/)) {
|
||||
// fieldEntryText += ` DEFAULT UUID()`;
|
||||
// } else
|
||||
if (nullValue) {
|
||||
fieldEntryText += " DEFAULT NULL";
|
||||
} else if (defaultValueLiteral) {
|
||||
fieldEntryText += ` DEFAULT ${defaultValueLiteral}`;
|
||||
} else if (defaultValue) {
|
||||
fieldEntryText += ` DEFAULT '${defaultValue}'`;
|
||||
if (String(defaultValue).match(/uuid\(\)/i)) {
|
||||
fieldEntryText += ` DEFAULT UUID()`;
|
||||
} else {
|
||||
fieldEntryText += ` DEFAULT '${defaultValue}'`;
|
||||
}
|
||||
} else if (notNullValue) {
|
||||
fieldEntryText += ` NOT NULL`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user