@dbml/core
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -113,3 +113,18 @@ "use strict"; | ||
if (foreignEndpoint === '1') line += '- ';else line += '< '; | ||
line += "\"".concat(foreignEndpoint.tableName, "\".\"").concat(foreignEndpoint.fieldName, "\"\n"); | ||
line += "\"".concat(foreignEndpoint.tableName, "\".\"").concat(foreignEndpoint.fieldName, "\""); | ||
var refActions = []; | ||
if (ref.onUpdate) { | ||
refActions.push("update: ".concat(ref.onUpdate.toLowerCase())); | ||
} | ||
if (ref.onDelete) { | ||
refActions.push("delete: ".concat(ref.onDelete.toLowerCase())); | ||
} | ||
if (refActions.length > 0) { | ||
line += " [".concat(refActions.join(', '), "]"); | ||
} | ||
line += '\n'; | ||
return line; | ||
@@ -116,0 +131,0 @@ }); |
@@ -46,3 +46,3 @@ "use strict"; | ||
value: function _export() { | ||
return JSON.stringify(this.schema["export"]()); | ||
return JSON.stringify(this.schema["export"](), null, 2); | ||
} | ||
@@ -49,0 +49,0 @@ }]); |
@@ -114,4 +114,13 @@ "use strict"; | ||
line += "FOREIGN KEY (`".concat(foreignEndpoint.fieldName, "`) REFERENCES `").concat(refEndpoint.tableName, "` (`").concat(refEndpoint.fieldName, "`);"); | ||
line += '\n'; | ||
line += "FOREIGN KEY (`".concat(foreignEndpoint.fieldName, "`) REFERENCES `").concat(refEndpoint.tableName, "` (`").concat(refEndpoint.fieldName, "`)"); | ||
if (ref.onDelete) { | ||
line += " ON DELETE ".concat(ref.onDelete.toUpperCase()); | ||
} | ||
if (ref.onUpdate) { | ||
line += " ON UPDATE ".concat(ref.onUpdate.toUpperCase()); | ||
} | ||
line += ';\n'; | ||
return line; | ||
@@ -118,0 +127,0 @@ }); |
@@ -128,4 +128,13 @@ "use strict"; | ||
line += "FOREIGN KEY (\"".concat(foreignEndpoint.fieldName, "\") REFERENCES \"").concat(refEndpoint.tableName, "\" (\"").concat(refEndpoint.fieldName, "\");"); | ||
line += '\n'; | ||
line += "FOREIGN KEY (\"".concat(foreignEndpoint.fieldName, "\") REFERENCES \"").concat(refEndpoint.tableName, "\" (\"").concat(refEndpoint.fieldName, "\")"); | ||
if (ref.onDelete) { | ||
line += " ON DELETE ".concat(ref.onDelete.toUpperCase()); | ||
} | ||
if (ref.onUpdate) { | ||
line += " ON UPDATE ".concat(ref.onUpdate.toUpperCase()); | ||
} | ||
line += ';\n'; | ||
return line; | ||
@@ -132,0 +141,0 @@ }); |
@@ -115,2 +115,11 @@ "use strict"; | ||
line += "FOREIGN KEY ([".concat(foreignEndpoint.fieldName, "]) REFERENCES [").concat(refEndpoint.tableName, "] ([").concat(refEndpoint.fieldName, "])"); | ||
if (ref.onDelete) { | ||
line += " ON DELETE ".concat(ref.onDelete.toUpperCase()); | ||
} | ||
if (ref.onUpdate) { | ||
line += " ON UPDATE ".concat(ref.onUpdate.toUpperCase()); | ||
} | ||
line += '\nGO\n'; | ||
@@ -117,0 +126,0 @@ return line; |
@@ -8,2 +8,8 @@ /* | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var _ = require("lodash"), | ||
@@ -164,3 +170,16 @@ pluralize = require("pluralize"); | ||
}, | ||
peg$c10 = function peg$c10(name, body) { | ||
peg$c10 = function peg$c10(r, value) { | ||
switch (r.toLowerCase()) { | ||
case 'on_delete': | ||
return { | ||
onDelete: value.split('_').join(' ') | ||
}; | ||
case 'on_update': | ||
return { | ||
onUpdate: value.split('_').join(' ') | ||
}; | ||
} | ||
}, | ||
peg$c11 = function peg$c11(name, body) { | ||
var table = { | ||
@@ -176,3 +195,3 @@ name: name, | ||
}, | ||
peg$c11 = function peg$c11(fields) { | ||
peg$c12 = function peg$c12(fields) { | ||
return { | ||
@@ -196,6 +215,6 @@ fields: fields.filter(function (field) { | ||
}, | ||
peg$c12 = function peg$c12(field) { | ||
peg$c13 = function peg$c13(field) { | ||
return field; | ||
}, | ||
peg$c13 = function peg$c13(reference) { | ||
peg$c14 = function peg$c14(reference) { | ||
return { | ||
@@ -206,3 +225,3 @@ reference: reference, | ||
}, | ||
peg$c14 = function peg$c14(field) { | ||
peg$c15 = function peg$c15(field) { | ||
return { | ||
@@ -213,6 +232,6 @@ field: field, | ||
}, | ||
peg$c15 = function peg$c15(reference) { | ||
peg$c16 = function peg$c16(reference) { | ||
return reference; | ||
}, | ||
peg$c16 = function peg$c16(type, name) { | ||
peg$c17 = function peg$c17(type, name) { | ||
return { | ||
@@ -225,82 +244,86 @@ name: name, | ||
}, | ||
peg$c17 = function peg$c17(reference) { | ||
peg$c18 = function peg$c18(reference) { | ||
return reference; | ||
}, | ||
peg$c18 = peg$otherExpectation("add index"), | ||
peg$c19 = "add_index", | ||
peg$c20 = peg$literalExpectation("add_index", false), | ||
peg$c21 = peg$otherExpectation("schema define"), | ||
peg$c22 = "ActiveRecord::Schema.define", | ||
peg$c23 = peg$literalExpectation("ActiveRecord::Schema.define", false), | ||
peg$c24 = peg$otherExpectation("create table"), | ||
peg$c25 = "create_table", | ||
peg$c26 = peg$literalExpectation("create_table", true), | ||
peg$c27 = peg$otherExpectation("do |t|"), | ||
peg$c28 = peg$otherExpectation("index"), | ||
peg$c29 = ".index", | ||
peg$c30 = peg$literalExpectation(".index", false), | ||
peg$c31 = peg$otherExpectation("references"), | ||
peg$c32 = ".references", | ||
peg$c33 = peg$literalExpectation(".references", false), | ||
peg$c34 = peg$otherExpectation("add foreign key"), | ||
peg$c35 = "add_foreign_key", | ||
peg$c36 = peg$literalExpectation("add_foreign_key", true), | ||
peg$c37 = peg$otherExpectation("column"), | ||
peg$c38 = "column", | ||
peg$c39 = peg$literalExpectation("column", false), | ||
peg$c40 = peg$otherExpectation("primary key"), | ||
peg$c41 = "primary_key", | ||
peg$c42 = peg$literalExpectation("primary_key", false), | ||
peg$c43 = "version", | ||
peg$c44 = peg$literalExpectation("version", false), | ||
peg$c45 = "do", | ||
peg$c46 = peg$literalExpectation("do", false), | ||
peg$c47 = "end", | ||
peg$c48 = peg$literalExpectation("end", false), | ||
peg$c49 = peg$otherExpectation("lambda function"), | ||
peg$c50 = "=>", | ||
peg$c51 = peg$literalExpectation("=>", false), | ||
peg$c52 = "->", | ||
peg$c53 = peg$literalExpectation("->", false), | ||
peg$c54 = /^[^"\n]/, | ||
peg$c55 = peg$classExpectation(["\"", "\n"], true, false), | ||
peg$c56 = function peg$c56(c) { | ||
peg$c19 = "on_delete", | ||
peg$c20 = peg$literalExpectation("on_delete", true), | ||
peg$c21 = "on_update", | ||
peg$c22 = peg$literalExpectation("on_update", true), | ||
peg$c23 = peg$otherExpectation("add index"), | ||
peg$c24 = "add_index", | ||
peg$c25 = peg$literalExpectation("add_index", false), | ||
peg$c26 = peg$otherExpectation("schema define"), | ||
peg$c27 = "ActiveRecord::Schema.define", | ||
peg$c28 = peg$literalExpectation("ActiveRecord::Schema.define", false), | ||
peg$c29 = peg$otherExpectation("create table"), | ||
peg$c30 = "create_table", | ||
peg$c31 = peg$literalExpectation("create_table", true), | ||
peg$c32 = peg$otherExpectation("do |t|"), | ||
peg$c33 = peg$otherExpectation("index"), | ||
peg$c34 = ".index", | ||
peg$c35 = peg$literalExpectation(".index", false), | ||
peg$c36 = peg$otherExpectation("references"), | ||
peg$c37 = ".references", | ||
peg$c38 = peg$literalExpectation(".references", false), | ||
peg$c39 = peg$otherExpectation("add foreign key"), | ||
peg$c40 = "add_foreign_key", | ||
peg$c41 = peg$literalExpectation("add_foreign_key", true), | ||
peg$c42 = peg$otherExpectation("column"), | ||
peg$c43 = "column", | ||
peg$c44 = peg$literalExpectation("column", false), | ||
peg$c45 = peg$otherExpectation("primary key"), | ||
peg$c46 = "primary_key", | ||
peg$c47 = peg$literalExpectation("primary_key", false), | ||
peg$c48 = "version", | ||
peg$c49 = peg$literalExpectation("version", false), | ||
peg$c50 = "do", | ||
peg$c51 = peg$literalExpectation("do", false), | ||
peg$c52 = "end", | ||
peg$c53 = peg$literalExpectation("end", false), | ||
peg$c54 = peg$otherExpectation("lambda function"), | ||
peg$c55 = "=>", | ||
peg$c56 = peg$literalExpectation("=>", false), | ||
peg$c57 = "->", | ||
peg$c58 = peg$literalExpectation("->", false), | ||
peg$c59 = /^[^"\n]/, | ||
peg$c60 = peg$classExpectation(["\"", "\n"], true, false), | ||
peg$c61 = function peg$c61(c) { | ||
return c.join(""); | ||
}, | ||
peg$c57 = ".", | ||
peg$c58 = peg$literalExpectation(".", false), | ||
peg$c59 = peg$anyExpectation(), | ||
peg$c60 = function peg$c60() { | ||
peg$c62 = ".", | ||
peg$c63 = peg$literalExpectation(".", false), | ||
peg$c64 = peg$anyExpectation(), | ||
peg$c65 = function peg$c65() { | ||
return text(); | ||
}, | ||
peg$c61 = /^[0-9]/i, | ||
peg$c62 = peg$classExpectation([["0", "9"]], false, true), | ||
peg$c63 = peg$otherExpectation("letter, number or underscore"), | ||
peg$c64 = /^[a-z0-9_.]/i, | ||
peg$c65 = peg$classExpectation([["a", "z"], ["0", "9"], "_", "."], false, true), | ||
peg$c66 = peg$otherExpectation("comment line"), | ||
peg$c67 = "#", | ||
peg$c68 = peg$literalExpectation("#", false), | ||
peg$c69 = peg$otherExpectation("whatever"), | ||
peg$c70 = /^[^\t\r\n]/, | ||
peg$c71 = peg$classExpectation(["\t", "\r", "\n"], true, false), | ||
peg$c72 = "\"", | ||
peg$c73 = peg$literalExpectation("\"", false), | ||
peg$c74 = "|", | ||
peg$c75 = peg$literalExpectation("|", false), | ||
peg$c76 = peg$otherExpectation("comment"), | ||
peg$c77 = "//", | ||
peg$c78 = peg$literalExpectation("//", false), | ||
peg$c79 = /^[^\n]/, | ||
peg$c80 = peg$classExpectation(["\n"], true, false), | ||
peg$c81 = peg$otherExpectation("newline"), | ||
peg$c82 = "\r\n", | ||
peg$c83 = peg$literalExpectation("\r\n", false), | ||
peg$c84 = "\n", | ||
peg$c85 = peg$literalExpectation("\n", false), | ||
peg$c86 = peg$otherExpectation("whitespace"), | ||
peg$c87 = /^[ \t\r\n\r]/, | ||
peg$c88 = peg$classExpectation([" ", "\t", "\r", "\n", "\r"], false, false), | ||
peg$c89 = " ", | ||
peg$c90 = peg$literalExpectation(" ", false), | ||
peg$c66 = /^[0-9]/i, | ||
peg$c67 = peg$classExpectation([["0", "9"]], false, true), | ||
peg$c68 = peg$otherExpectation("letter, number or underscore"), | ||
peg$c69 = /^[a-z0-9_.]/i, | ||
peg$c70 = peg$classExpectation([["a", "z"], ["0", "9"], "_", "."], false, true), | ||
peg$c71 = peg$otherExpectation("comment line"), | ||
peg$c72 = "#", | ||
peg$c73 = peg$literalExpectation("#", false), | ||
peg$c74 = peg$otherExpectation("whatever"), | ||
peg$c75 = /^[^\t\r\n]/, | ||
peg$c76 = peg$classExpectation(["\t", "\r", "\n"], true, false), | ||
peg$c77 = "\"", | ||
peg$c78 = peg$literalExpectation("\"", false), | ||
peg$c79 = "|", | ||
peg$c80 = peg$literalExpectation("|", false), | ||
peg$c81 = peg$otherExpectation("comment"), | ||
peg$c82 = "//", | ||
peg$c83 = peg$literalExpectation("//", false), | ||
peg$c84 = /^[^\n]/, | ||
peg$c85 = peg$classExpectation(["\n"], true, false), | ||
peg$c86 = peg$otherExpectation("newline"), | ||
peg$c87 = "\r\n", | ||
peg$c88 = peg$literalExpectation("\r\n", false), | ||
peg$c89 = "\n", | ||
peg$c90 = peg$literalExpectation("\n", false), | ||
peg$c91 = peg$otherExpectation("whitespace"), | ||
peg$c92 = /^[ \t\r\n\r]/, | ||
peg$c93 = peg$classExpectation([" ", "\t", "\r", "\n", "\r"], false, false), | ||
peg$c94 = " ", | ||
peg$c95 = peg$literalExpectation(" ", false), | ||
peg$currPos = 0, | ||
@@ -801,2 +824,82 @@ peg$savedPos = 0, | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 44) { | ||
s1 = peg$c3; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c4); | ||
} | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsesp(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsesp(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parsereferential_actions(); | ||
if (s3 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 58) { | ||
s4 = peg$c6; | ||
peg$currPos++; | ||
} else { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c7); | ||
} | ||
} | ||
if (s4 !== peg$FAILED) { | ||
s5 = []; | ||
s6 = peg$parsesp(); | ||
while (s6 !== peg$FAILED) { | ||
s5.push(s6); | ||
s6 = peg$parsesp(); | ||
} | ||
if (s5 !== peg$FAILED) { | ||
s6 = peg$parsesymbol(); | ||
if (s6 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c10(s3, s6); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} | ||
} | ||
@@ -838,3 +941,3 @@ | ||
peg$savedPos = s0; | ||
s1 = peg$c10(s3, s6); | ||
s1 = peg$c11(s3, s6); | ||
s0 = s1; | ||
@@ -886,3 +989,3 @@ } else { | ||
peg$savedPos = s0; | ||
s1 = peg$c11(s1); | ||
s1 = peg$c12(s1); | ||
} | ||
@@ -922,3 +1025,3 @@ | ||
peg$savedPos = s0; | ||
s1 = peg$c12(s2); | ||
s1 = peg$c13(s2); | ||
s0 = s1; | ||
@@ -955,3 +1058,3 @@ } else { | ||
peg$savedPos = s0; | ||
s1 = peg$c13(s1); | ||
s1 = peg$c14(s1); | ||
} | ||
@@ -967,3 +1070,3 @@ | ||
peg$savedPos = s0; | ||
s1 = peg$c14(s1); | ||
s1 = peg$c15(s1); | ||
} | ||
@@ -1041,3 +1144,3 @@ | ||
peg$savedPos = s0; | ||
s1 = peg$c15(s3); | ||
s1 = peg$c16(s3); | ||
s0 = s1; | ||
@@ -1083,3 +1186,3 @@ } else { | ||
peg$savedPos = s0; | ||
s1 = peg$c16(s1, s3); | ||
s1 = peg$c17(s1, s3); | ||
s0 = s1; | ||
@@ -1122,3 +1225,3 @@ } else { | ||
peg$savedPos = s0; | ||
s1 = peg$c17(s2); | ||
s1 = peg$c18(s2); | ||
s0 = s1; | ||
@@ -1140,3 +1243,3 @@ } else { | ||
peg$savedPos = s0; | ||
s1 = peg$c17(s1); | ||
s1 = peg$c18(s1); | ||
} | ||
@@ -1150,2 +1253,32 @@ | ||
function peg$parsereferential_actions() { | ||
var s0; | ||
if (input.substr(peg$currPos, 9).toLowerCase() === peg$c19) { | ||
s0 = input.substr(peg$currPos, 9); | ||
peg$currPos += 9; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c20); | ||
} | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (input.substr(peg$currPos, 9).toLowerCase() === peg$c21) { | ||
s0 = input.substr(peg$currPos, 9); | ||
peg$currPos += 9; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c22); | ||
} | ||
} | ||
} | ||
return s0; | ||
} | ||
function peg$parseadd_index() { | ||
@@ -1155,4 +1288,4 @@ var s0, s1; | ||
if (input.substr(peg$currPos, 9) === peg$c19) { | ||
s0 = peg$c19; | ||
if (input.substr(peg$currPos, 9) === peg$c24) { | ||
s0 = peg$c24; | ||
peg$currPos += 9; | ||
@@ -1163,3 +1296,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c20); | ||
peg$fail(peg$c25); | ||
} | ||
@@ -1174,3 +1307,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c18); | ||
peg$fail(peg$c23); | ||
} | ||
@@ -1186,4 +1319,4 @@ } | ||
if (input.substr(peg$currPos, 27) === peg$c22) { | ||
s0 = peg$c22; | ||
if (input.substr(peg$currPos, 27) === peg$c27) { | ||
s0 = peg$c27; | ||
peg$currPos += 27; | ||
@@ -1194,3 +1327,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c23); | ||
peg$fail(peg$c28); | ||
} | ||
@@ -1205,3 +1338,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c21); | ||
peg$fail(peg$c26); | ||
} | ||
@@ -1217,3 +1350,3 @@ } | ||
if (input.substr(peg$currPos, 12).toLowerCase() === peg$c25) { | ||
if (input.substr(peg$currPos, 12).toLowerCase() === peg$c30) { | ||
s0 = input.substr(peg$currPos, 12); | ||
@@ -1225,3 +1358,3 @@ peg$currPos += 12; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c26); | ||
peg$fail(peg$c31); | ||
} | ||
@@ -1236,3 +1369,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c24); | ||
peg$fail(peg$c29); | ||
} | ||
@@ -1309,3 +1442,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c27); | ||
peg$fail(peg$c32); | ||
} | ||
@@ -1324,4 +1457,4 @@ } | ||
if (s1 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 6) === peg$c29) { | ||
s2 = peg$c29; | ||
if (input.substr(peg$currPos, 6) === peg$c34) { | ||
s2 = peg$c34; | ||
peg$currPos += 6; | ||
@@ -1332,3 +1465,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c30); | ||
peg$fail(peg$c35); | ||
} | ||
@@ -1355,3 +1488,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c28); | ||
peg$fail(peg$c33); | ||
} | ||
@@ -1370,4 +1503,4 @@ } | ||
if (s1 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 11) === peg$c32) { | ||
s2 = peg$c32; | ||
if (input.substr(peg$currPos, 11) === peg$c37) { | ||
s2 = peg$c37; | ||
peg$currPos += 11; | ||
@@ -1378,3 +1511,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c33); | ||
peg$fail(peg$c38); | ||
} | ||
@@ -1401,3 +1534,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c31); | ||
peg$fail(peg$c36); | ||
} | ||
@@ -1413,3 +1546,3 @@ } | ||
if (input.substr(peg$currPos, 15).toLowerCase() === peg$c35) { | ||
if (input.substr(peg$currPos, 15).toLowerCase() === peg$c40) { | ||
s0 = input.substr(peg$currPos, 15); | ||
@@ -1421,3 +1554,3 @@ peg$currPos += 15; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c36); | ||
peg$fail(peg$c41); | ||
} | ||
@@ -1432,3 +1565,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c34); | ||
peg$fail(peg$c39); | ||
} | ||
@@ -1444,4 +1577,4 @@ } | ||
if (input.substr(peg$currPos, 6) === peg$c38) { | ||
s0 = peg$c38; | ||
if (input.substr(peg$currPos, 6) === peg$c43) { | ||
s0 = peg$c43; | ||
peg$currPos += 6; | ||
@@ -1452,3 +1585,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c39); | ||
peg$fail(peg$c44); | ||
} | ||
@@ -1463,3 +1596,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c37); | ||
peg$fail(peg$c42); | ||
} | ||
@@ -1475,4 +1608,4 @@ } | ||
if (input.substr(peg$currPos, 11) === peg$c41) { | ||
s0 = peg$c41; | ||
if (input.substr(peg$currPos, 11) === peg$c46) { | ||
s0 = peg$c46; | ||
peg$currPos += 11; | ||
@@ -1483,3 +1616,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c42); | ||
peg$fail(peg$c47); | ||
} | ||
@@ -1494,3 +1627,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c40); | ||
peg$fail(peg$c45); | ||
} | ||
@@ -1505,4 +1638,4 @@ } | ||
if (input.substr(peg$currPos, 7) === peg$c43) { | ||
s0 = peg$c43; | ||
if (input.substr(peg$currPos, 7) === peg$c48) { | ||
s0 = peg$c48; | ||
peg$currPos += 7; | ||
@@ -1513,3 +1646,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c44); | ||
peg$fail(peg$c49); | ||
} | ||
@@ -1524,4 +1657,4 @@ } | ||
if (input.substr(peg$currPos, 2) === peg$c45) { | ||
s0 = peg$c45; | ||
if (input.substr(peg$currPos, 2) === peg$c50) { | ||
s0 = peg$c50; | ||
peg$currPos += 2; | ||
@@ -1532,3 +1665,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c46); | ||
peg$fail(peg$c51); | ||
} | ||
@@ -1543,4 +1676,4 @@ } | ||
if (input.substr(peg$currPos, 3) === peg$c47) { | ||
s0 = peg$c47; | ||
if (input.substr(peg$currPos, 3) === peg$c52) { | ||
s0 = peg$c52; | ||
peg$currPos += 3; | ||
@@ -1551,3 +1684,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c48); | ||
peg$fail(peg$c53); | ||
} | ||
@@ -1563,4 +1696,4 @@ } | ||
if (input.substr(peg$currPos, 2) === peg$c50) { | ||
s0 = peg$c50; | ||
if (input.substr(peg$currPos, 2) === peg$c55) { | ||
s0 = peg$c55; | ||
peg$currPos += 2; | ||
@@ -1571,3 +1704,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c51); | ||
peg$fail(peg$c56); | ||
} | ||
@@ -1577,4 +1710,4 @@ } | ||
if (s0 === peg$FAILED) { | ||
if (input.substr(peg$currPos, 2) === peg$c52) { | ||
s0 = peg$c52; | ||
if (input.substr(peg$currPos, 2) === peg$c57) { | ||
s0 = peg$c57; | ||
peg$currPos += 2; | ||
@@ -1585,3 +1718,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c53); | ||
peg$fail(peg$c58); | ||
} | ||
@@ -1597,3 +1730,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c49); | ||
peg$fail(peg$c54); | ||
} | ||
@@ -1647,3 +1780,3 @@ } | ||
if (peg$c54.test(input.charAt(peg$currPos))) { | ||
if (peg$c59.test(input.charAt(peg$currPos))) { | ||
s3 = input.charAt(peg$currPos); | ||
@@ -1655,3 +1788,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c55); | ||
peg$fail(peg$c60); | ||
} | ||
@@ -1663,3 +1796,3 @@ } | ||
if (peg$c54.test(input.charAt(peg$currPos))) { | ||
if (peg$c59.test(input.charAt(peg$currPos))) { | ||
s3 = input.charAt(peg$currPos); | ||
@@ -1671,3 +1804,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c55); | ||
peg$fail(peg$c60); | ||
} | ||
@@ -1682,3 +1815,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$c56(s2); | ||
s1 = peg$c61(s2); | ||
s0 = s1; | ||
@@ -1701,2 +1834,42 @@ } else { | ||
function peg$parsesymbol() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 58) { | ||
s1 = peg$c6; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c7); | ||
} | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsecharacter(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsecharacter(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c61(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
return s0; | ||
} | ||
function peg$parsevariable() { | ||
@@ -1719,3 +1892,3 @@ var s0, s1, s2; | ||
peg$savedPos = s0; | ||
s1 = peg$c56(s1); | ||
s1 = peg$c61(s1); | ||
} | ||
@@ -1734,3 +1907,3 @@ | ||
if (input.charCodeAt(peg$currPos) === 46) { | ||
s2 = peg$c57; | ||
s2 = peg$c62; | ||
peg$currPos++; | ||
@@ -1741,3 +1914,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c58); | ||
peg$fail(peg$c63); | ||
} | ||
@@ -1761,3 +1934,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$c56(s3); | ||
s1 = peg$c61(s3); | ||
s0 = s1; | ||
@@ -1803,3 +1976,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c59); | ||
peg$fail(peg$c64); | ||
} | ||
@@ -1810,3 +1983,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$c60(); | ||
s1 = peg$c65(); | ||
s0 = s1; | ||
@@ -1828,3 +2001,3 @@ } else { | ||
if (peg$c61.test(input.charAt(peg$currPos))) { | ||
if (peg$c66.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1836,3 +2009,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c62); | ||
peg$fail(peg$c67); | ||
} | ||
@@ -1848,3 +2021,3 @@ } | ||
if (peg$c64.test(input.charAt(peg$currPos))) { | ||
if (peg$c69.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1856,3 +2029,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c65); | ||
peg$fail(peg$c70); | ||
} | ||
@@ -1867,3 +2040,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c63); | ||
peg$fail(peg$c68); | ||
} | ||
@@ -1995,3 +2168,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 35) { | ||
s2 = peg$c67; | ||
s2 = peg$c72; | ||
peg$currPos++; | ||
@@ -2002,3 +2175,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c68); | ||
peg$fail(peg$c73); | ||
} | ||
@@ -2043,3 +2216,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c66); | ||
peg$fail(peg$c71); | ||
} | ||
@@ -2056,3 +2229,3 @@ } | ||
if (peg$c70.test(input.charAt(peg$currPos))) { | ||
if (peg$c75.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -2064,3 +2237,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c71); | ||
peg$fail(peg$c76); | ||
} | ||
@@ -2072,3 +2245,3 @@ } | ||
if (peg$c70.test(input.charAt(peg$currPos))) { | ||
if (peg$c75.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -2080,3 +2253,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c71); | ||
peg$fail(peg$c76); | ||
} | ||
@@ -2092,3 +2265,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c69); | ||
peg$fail(peg$c74); | ||
} | ||
@@ -2103,3 +2276,3 @@ } | ||
if (peg$c70.test(input.charAt(peg$currPos))) { | ||
if (peg$c75.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -2111,3 +2284,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c71); | ||
peg$fail(peg$c76); | ||
} | ||
@@ -2123,3 +2296,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s0 = peg$c72; | ||
s0 = peg$c77; | ||
peg$currPos++; | ||
@@ -2130,3 +2303,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c73); | ||
peg$fail(peg$c78); | ||
} | ||
@@ -2188,3 +2361,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 124) { | ||
s0 = peg$c74; | ||
s0 = peg$c79; | ||
peg$currPos++; | ||
@@ -2195,3 +2368,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c75); | ||
peg$fail(peg$c80); | ||
} | ||
@@ -2237,4 +2410,4 @@ } | ||
if (input.substr(peg$currPos, 2) === peg$c77) { | ||
s1 = peg$c77; | ||
if (input.substr(peg$currPos, 2) === peg$c82) { | ||
s1 = peg$c82; | ||
peg$currPos += 2; | ||
@@ -2245,3 +2418,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c78); | ||
peg$fail(peg$c83); | ||
} | ||
@@ -2251,3 +2424,3 @@ } | ||
if (s1 !== peg$FAILED) { | ||
if (peg$c79.test(input.charAt(peg$currPos))) { | ||
if (peg$c84.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -2259,3 +2432,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c80); | ||
peg$fail(peg$c85); | ||
} | ||
@@ -2286,3 +2459,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c76); | ||
peg$fail(peg$c81); | ||
} | ||
@@ -2298,4 +2471,4 @@ } | ||
if (input.substr(peg$currPos, 2) === peg$c82) { | ||
s0 = peg$c82; | ||
if (input.substr(peg$currPos, 2) === peg$c87) { | ||
s0 = peg$c87; | ||
peg$currPos += 2; | ||
@@ -2306,3 +2479,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c83); | ||
peg$fail(peg$c88); | ||
} | ||
@@ -2313,3 +2486,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 10) { | ||
s0 = peg$c84; | ||
s0 = peg$c89; | ||
peg$currPos++; | ||
@@ -2320,3 +2493,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c85); | ||
peg$fail(peg$c90); | ||
} | ||
@@ -2332,3 +2505,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c81); | ||
peg$fail(peg$c86); | ||
} | ||
@@ -2344,3 +2517,3 @@ } | ||
if (peg$c87.test(input.charAt(peg$currPos))) { | ||
if (peg$c92.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -2352,3 +2525,3 @@ peg$currPos++; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c88); | ||
peg$fail(peg$c93); | ||
} | ||
@@ -2363,3 +2536,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c86); | ||
peg$fail(peg$c91); | ||
} | ||
@@ -2375,3 +2548,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 32) { | ||
s0 = peg$c89; | ||
s0 = peg$c94; | ||
peg$currPos++; | ||
@@ -2382,3 +2555,3 @@ } else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c90); | ||
peg$fail(peg$c95); | ||
} | ||
@@ -2565,2 +2738,3 @@ } | ||
}]; | ||
var refProp = {}; | ||
@@ -2577,8 +2751,20 @@ for (var i = 0; i < props.length; i += 1) { | ||
} | ||
if (currentProp.onDelete) { | ||
refProp = _objectSpread({}, refProp, { | ||
onDelete: currentProp.onDelete | ||
}); | ||
} | ||
if (currentProp.onUpdate) { | ||
refProp = _objectSpread({}, refProp, { | ||
onUpdate: currentProp.onUpdate | ||
}); | ||
} | ||
} | ||
return { | ||
return _objectSpread({ | ||
name: "fk_rails_".concat(fromTable, "_").concat(toTable), | ||
endpoints: endpoints | ||
}; | ||
}, refProp); | ||
} | ||
@@ -2585,0 +2771,0 @@ |
@@ -51,3 +51,5 @@ "use strict"; | ||
endpoints = _ref.endpoints, | ||
token = _ref.token; | ||
token = _ref.token, | ||
onUpdate = _ref.onUpdate, | ||
onDelete = _ref.onDelete; | ||
@@ -59,2 +61,4 @@ _classCallCheck(this, Ref); | ||
_this.endpoints = endpoints; | ||
_this.onUpdate = onUpdate; | ||
_this.onDelete = onDelete; | ||
@@ -80,3 +84,5 @@ if (_this.endpoints[0].equals(_this.endpoints[1])) { | ||
return e["export"](); | ||
}) | ||
}), | ||
onUpdate: this.onUpdate, | ||
onDelete: this.onDelete | ||
}; | ||
@@ -83,0 +89,0 @@ } |
@@ -83,3 +83,5 @@ "use strict"; | ||
return new _endpoint["default"](e, _this2); | ||
}) | ||
}), | ||
onUpdate: r.onUpdate, | ||
onDelete: r.onDelete | ||
}; | ||
@@ -86,0 +88,0 @@ |
{ | ||
"name": "@dbml/core", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "> TODO: description", | ||
@@ -56,3 +56,3 @@ "author": "Holistics <dev@holistics.io>", | ||
}, | ||
"gitHead": "bf91bd8554c5cd40cefb5a7cada18efe500ecae8" | ||
"gitHead": "e700b553bd81c8aa33f9862c411c6db5b72ec8f6" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
978712
68
21182
3