migraguard 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +4 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import { dirname, resolve, join } from 'path';
|
|
|
9
9
|
import { existsSync } from 'fs';
|
|
10
10
|
import { randomBytes, createHash } from 'crypto';
|
|
11
11
|
import libpg from 'libpg-query';
|
|
12
|
-
import
|
|
12
|
+
import nodeSqlParser from 'node-sql-parser';
|
|
13
13
|
import { pathToFileURL } from 'url';
|
|
14
14
|
import { diffLines } from 'diff';
|
|
15
15
|
import { tmpdir } from 'os';
|
|
@@ -1135,6 +1135,7 @@ function isMetadataJson(data) {
|
|
|
1135
1135
|
(m) => typeof m === "object" && m !== null && typeof m["file"] === "string" && typeof m["checksum"] === "string"
|
|
1136
1136
|
);
|
|
1137
1137
|
}
|
|
1138
|
+
var { Parser } = nodeSqlParser;
|
|
1138
1139
|
function toParserDatabase(dialect) {
|
|
1139
1140
|
return dialect === "mysql" ? "MySQL" : "SQLite";
|
|
1140
1141
|
}
|
|
@@ -3860,6 +3861,7 @@ var ALL_RULES = [
|
|
|
3860
3861
|
backfillBanDdl,
|
|
3861
3862
|
contractRequiresAllowDirective
|
|
3862
3863
|
];
|
|
3864
|
+
var { Parser: Parser2 } = nodeSqlParser;
|
|
3863
3865
|
var ALLOW_DIRECTIVE_RE2 = /^--\s*migraguard:allow\s+(.+)$/gm;
|
|
3864
3866
|
function parseAllowDirectives2(sql) {
|
|
3865
3867
|
const allowed = /* @__PURE__ */ new Set();
|
|
@@ -3903,7 +3905,7 @@ async function runGenericRules(sql, rules, dialect) {
|
|
|
3903
3905
|
}
|
|
3904
3906
|
const createdTables = /* @__PURE__ */ new Set();
|
|
3905
3907
|
let inTransaction = false;
|
|
3906
|
-
const parser = new
|
|
3908
|
+
const parser = new Parser2();
|
|
3907
3909
|
let stmts = [];
|
|
3908
3910
|
try {
|
|
3909
3911
|
const ast = parser.astify(sql, { database: toParserDatabase2(dialect) });
|