fix formatting cuz its bugging me!

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Jan 29, 2026 at 13:48 UTC 1df5facbaefe820abe217da3322dc55ab1ac32f7
1 file changed +31 -31
db.js
+31 -31
@@ -944,40 +944,40 @@ module.exports.CreateDB = function (parent, func) {
944 }
945 });
946 } else {
947 - //Connect to and check pg db first to check if own db exists. Otherwise errors out on 'database does not exist'
947 + //Connect to and check pg db first to check if own db exists. Otherwise errors out on 'database does not exist'
948 connectionArgs.database = 'postgres';
949 DatastoreTest = new Client(connectionArgs);
950 - DatastoreTest.connect();
950 + DatastoreTest.connect();
951 connectionArgs.database = databaseName; //put the name back for backupconfig info
952 - DatastoreTest.query('SELECT 1 FROM pg_catalog.pg_database WHERE datname = $1', [databaseName], function (err, res) { // check database exists first before creating
953 - if (res.rowCount != 0) { // database exists now check tables exists
954 - DatastoreTest.end();
955 - Datastore.connect();
956 - Datastore.query('SELECT doc FROM main WHERE id = $1', ['DatabaseIdentifier'], function (err, res) {
957 - if (err == null) {
958 - (res.rowCount ==0) ? postgreSqlCreateTables(func) : setupFunctions(func)
959 - } else
960 - if (err.code == '42P01') { //42P01 = undefined table, https://www.postgresql.org/docs/current/errcodes-appendix.html
961 - postgreSqlCreateTables(func);
962 - } else {
963 - console.log('Postgresql database exists, other error: ', err.message); process.exit(0);
964 - };
965 - });
966 - } else { // If not present, create the tables and indexes
967 - //not needed, just use a create db statement: const pgtools = require('pgtools');
968 - DatastoreTest.query('CREATE DATABASE "'+ databaseName + '";', [], function (err, res) {
969 - if (err == null) {
970 - // Create the tables and indexes
971 - DatastoreTest.end();
972 - Datastore.connect();
973 - postgreSqlCreateTables(func);
974 - } else {
975 - console.log('Postgresql database create error: ', err.message);
976 - process.exit(0);
977 - }
978 - });
979 - }
980 - });
952 + DatastoreTest.query('SELECT 1 FROM pg_catalog.pg_database WHERE datname = $1', [databaseName], function (err, res) { // check database exists first before creating
953 + if (res.rowCount != 0) { // database exists now check tables exists
954 + DatastoreTest.end();
955 + Datastore.connect();
956 + Datastore.query('SELECT doc FROM main WHERE id = $1', ['DatabaseIdentifier'], function (err, res) {
957 + if (err == null) {
958 + (res.rowCount ==0) ? postgreSqlCreateTables(func) : setupFunctions(func)
959 + } else
960 + if (err.code == '42P01') { //42P01 = undefined table, https://www.postgresql.org/docs/current/errcodes-appendix.html
961 + postgreSqlCreateTables(func);
962 + } else {
963 + console.log('Postgresql database exists, other error: ', err.message); process.exit(0);
964 + };
965 + });
966 + } else { // If not present, create the tables and indexes
967 + //not needed, just use a create db statement: const pgtools = require('pgtools');
968 + DatastoreTest.query('CREATE DATABASE "'+ databaseName + '";', [], function (err, res) {
969 + if (err == null) {
970 + // Create the tables and indexes
971 + DatastoreTest.end();
972 + Datastore.connect();
973 + postgreSqlCreateTables(func);
974 + } else {
975 + console.log('Postgresql database create error: ', err.message);
976 + process.exit(0);
977 + }
978 + });
979 + }
980 + });
981 }
982 } else if (parent.args.mongodb) {
983 // Use MongoDB