mssql-change-tracking
Version:
MS SQL server change tracking functions
43 lines • 1.44 kB
JavaScript
import mssql from "mssql";
import { config } from "dotenv";
config();
import { createLoggerInstance, env, getCredential } from "./helpers/util";
import { ctChangesAllFields, ctChangesAllFieldsQuery, } from "./services/change-tracking";
import { getPrimaryKeys } from "./services/general";
await createLoggerInstance("development");
const { account, password } = await getCredential(env("vpCredentialName"));
const pool = new mssql.ConnectionPool({
server: env("vpDbHost"),
database: env("vpDbName"),
user: account,
password,
options: { encrypt: false },
});
await pool.connect();
// await ctMinValidVersion({ pool, tableName: "bJCCM" }).then(console.log);
// await ctChanges<{ KeyId: string }>({
// pool,
// sinceVersion: "58",
// tableName: "bJCCM",
// safeRun: true,
// dbName: env("vpDbName"),
// }).then((res) => {
// console.log(`File: app.ts,`, `Line: 31 => `, res);
// });
const a = ctChangesAllFieldsQuery({
primaryKeys: ["KeyID"],
sinceVersion: "64",
tableName: "bJCCM",
});
console.log(`File: app.ts,`, `Line: 48 => `, a);
await ctChangesAllFields({
pool,
sinceVersion: "79",
tableName: "bJCJM",
safeRun: true,
dbName: env("vpDbName"),
primaryKeys: await getPrimaryKeys({ tableName: "bJCCM", pool }),
}).then((res) => {
console.log(`File: app.ts,`, `Line: 52 => `, res.changes);
});
//# sourceMappingURL=app.js.map