UNPKG

mssql-change-tracking

Version:
19 lines 883 B
import { writeLog } from "fast-node-logger"; import { getTableFullPath } from "../../../helpers/util"; /** grant access to change tracking data for specific table to specific user */ export async function ctAccessGrant({ pool, userName, tableName, dbName, schema, }) { writeLog(`ctAccessGrant`, { level: "trace" }); await pool .request() .query(ctAccessGrantQuery({ tableName, userName, dbName, schema })) .then((result) => result.recordset); } export function ctAccessGrantQuery({ tableName, userName, schema, dbName, }) { const tableFullPath = getTableFullPath({ tableName, schema, dbName }); let query = `GRANT VIEW CHANGE TRACKING ON ${tableFullPath} TO [${userName}]`; if (dbName) { query = `USE [${dbName}]; `.concat(query); } return query; } //# sourceMappingURL=change-tracking-access-grant.js.map