Updated logging messages in migration commands

no issue

- by switching around the the columns and tables, it becomes a
  lot easier to read the log line in a natural order
This commit is contained in:
Daniel Lockyer 2021-03-04 13:53:06 +00:00
parent ae090b0a13
commit 4e18606942
No known key found for this signature in database
GPG Key ID: FFBC6FA2A6F6ABC1

View File

@ -199,7 +199,7 @@ async function addForeign({fromTable, fromColumn, toTable, toColumn, cascadeDele
const hasForeignKey = await hasForeign({fromTable, fromColumn, toTable, toColumn, transaction}); const hasForeignKey = await hasForeign({fromTable, fromColumn, toTable, toColumn, transaction});
if (!hasForeignKey) { if (!hasForeignKey) {
logging.info(`Adding foreign key for: ${fromColumn} in ${fromTable} to ${toColumn} in ${toTable}`); logging.info(`Adding foreign key from ${fromTable}.${fromColumn} to ${toTable}.${toColumn}`);
//disable and re-enable foreign key checks on sqlite because of https://github.com/knex/knex/issues/4155 //disable and re-enable foreign key checks on sqlite because of https://github.com/knex/knex/issues/4155
let foreignKeysEnabled; let foreignKeysEnabled;
@ -224,7 +224,7 @@ async function addForeign({fromTable, fromColumn, toTable, toColumn, cascadeDele
} }
} }
} else { } else {
logging.warn(`Skipped adding foreign key for ${fromColumn} in ${fromTable} to ${toColumn} in ${toTable} - foreign key already exists`); logging.warn(`Skipped adding foreign key from ${fromTable}.${fromColumn} to ${toTable}.${toColumn} - foreign key already exists`);
} }
} }
@ -243,7 +243,7 @@ async function dropForeign({fromTable, fromColumn, toTable, toColumn, transactio
const hasForeignKey = await hasForeign({fromTable, fromColumn, toTable, toColumn, transaction}); const hasForeignKey = await hasForeign({fromTable, fromColumn, toTable, toColumn, transaction});
if (hasForeignKey) { if (hasForeignKey) {
logging.info(`Dropping foreign key for: ${fromColumn} in ${fromTable} to ${toColumn} in ${toTable}`); logging.info(`Dropping foreign key from ${fromTable}.${fromColumn} to ${toTable}.${toColumn}`);
//disable and re-enable foreign key checks on sqlite because of https://github.com/knex/knex/issues/4155 //disable and re-enable foreign key checks on sqlite because of https://github.com/knex/knex/issues/4155
let foreignKeysEnabled; let foreignKeysEnabled;
@ -264,7 +264,7 @@ async function dropForeign({fromTable, fromColumn, toTable, toColumn, transactio
} }
} }
} else { } else {
logging.warn(`Skipped dropping foreign key for ${fromColumn} in ${fromTable} to ${toColumn} in ${toTable} - foreign key does not exist`); logging.warn(`Skipped dropping foreign key from ${fromTable}.${fromColumn} to ${toTable}.${toColumn} - foreign key does not exist`);
} }
} }