UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,653 lines (1,652 loc) 185 kB
{ "type": "File", "start": 0, "end": 1614, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 65, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1614, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 65, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ClassDeclaration", "start": 15, "end": 39, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 24 } }, "id": { "type": "Identifier", "start": 21, "end": 36, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 21 }, "identifierName": "AbstractDialect" }, "name": "AbstractDialect" }, "superClass": null, "body": { "type": "ClassBody", "start": 37, "end": 39, "loc": { "start": { "line": 3, "column": 22 }, "end": { "line": 3, "column": 24 } }, "body": [] } }, { "type": "ExpressionStatement", "start": 41, "end": 1486, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 60, "column": 2 } }, "expression": { "type": "AssignmentExpression", "start": 41, "end": 1485, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 60, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 41, "end": 75, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 34 } }, "object": { "type": "MemberExpression", "start": 41, "end": 66, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 25 } }, "object": { "type": "Identifier", "start": 41, "end": 56, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 15 }, "identifierName": "AbstractDialect" }, "name": "AbstractDialect" }, "property": { "type": "Identifier", "start": 57, "end": 66, "loc": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 25 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 67, "end": 75, "loc": { "start": { "line": 5, "column": 26 }, "end": { "line": 5, "column": 34 }, "identifierName": "supports" }, "name": "supports" }, "computed": false }, "right": { "type": "ObjectExpression", "start": 78, "end": 1485, "loc": { "start": { "line": 5, "column": 37 }, "end": { "line": 60, "column": 1 } }, "properties": [ { "type": "ObjectProperty", "start": 82, "end": 97, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 17 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 82, "end": 91, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 11 } }, "extra": { "rawValue": "DEFAULT", "raw": "'DEFAULT'" }, "value": "DEFAULT" }, "value": { "type": "BooleanLiteral", "start": 93, "end": 97, "loc": { "start": { "line": 6, "column": 13 }, "end": { "line": 6, "column": 17 } }, "value": true } }, { "type": "ObjectProperty", "start": 101, "end": 124, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 25 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 101, "end": 117, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 18 } }, "extra": { "rawValue": "DEFAULT VALUES", "raw": "'DEFAULT VALUES'" }, "value": "DEFAULT VALUES" }, "value": { "type": "BooleanLiteral", "start": 119, "end": 124, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 25 } }, "value": false } }, { "type": "ObjectProperty", "start": 128, "end": 146, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 128, "end": 139, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 13 } }, "extra": { "rawValue": "VALUES ()", "raw": "'VALUES ()'" }, "value": "VALUES ()" }, "value": { "type": "BooleanLiteral", "start": 141, "end": 146, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 20 } }, "value": false } }, { "type": "ObjectProperty", "start": 150, "end": 174, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 9, "column": 26 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 150, "end": 167, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 9, "column": 19 } }, "extra": { "rawValue": "LIMIT ON UPDATE", "raw": "'LIMIT ON UPDATE'" }, "value": "LIMIT ON UPDATE" }, "value": { "type": "BooleanLiteral", "start": 169, "end": 174, "loc": { "start": { "line": 9, "column": 21 }, "end": { "line": 9, "column": 26 } }, "value": false } }, { "type": "ObjectProperty", "start": 178, "end": 202, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 26 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 178, "end": 196, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 20 } }, "extra": { "rawValue": "ON DUPLICATE KEY", "raw": "'ON DUPLICATE KEY'" }, "value": "ON DUPLICATE KEY" }, "value": { "type": "BooleanLiteral", "start": 198, "end": 202, "loc": { "start": { "line": 10, "column": 22 }, "end": { "line": 10, "column": 26 } }, "value": true } }, { "type": "ObjectProperty", "start": 206, "end": 226, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 206, "end": 219, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 15 } }, "extra": { "rawValue": "ORDER NULLS", "raw": "'ORDER NULLS'" }, "value": "ORDER NULLS" }, "value": { "type": "BooleanLiteral", "start": 221, "end": 226, "loc": { "start": { "line": 11, "column": 17 }, "end": { "line": 11, "column": 22 } }, "value": false } }, { "type": "ObjectProperty", "start": 230, "end": 243, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 15 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 230, "end": 237, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 9 } }, "extra": { "rawValue": "UNION", "raw": "'UNION'" }, "value": "UNION" }, "value": { "type": "BooleanLiteral", "start": 239, "end": 243, "loc": { "start": { "line": 12, "column": 11 }, "end": { "line": 12, "column": 15 } }, "value": true } }, { "type": "ObjectProperty", "start": 247, "end": 264, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 19 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 247, "end": 258, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 13 } }, "extra": { "rawValue": "UNION ALL", "raw": "'UNION ALL'" }, "value": "UNION ALL" }, "value": { "type": "BooleanLiteral", "start": 260, "end": 264, "loc": { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 19 } }, "value": true } }, { "type": "ObjectProperty", "start": 324, "end": 336, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 14 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 324, "end": 332, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 10 } }, "extra": { "rawValue": "IGNORE", "raw": "'IGNORE'" }, "value": "IGNORE", "leadingComments": null }, "value": { "type": "StringLiteral", "start": 334, "end": 336, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 14 } }, "extra": { "rawValue": "", "raw": "''" }, "value": "" }, "leadingComments": [ { "type": "CommentBlock", "value": " What is the dialect's keyword for INSERT IGNORE ", "start": 268, "end": 321, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 55 } } } ] }, { "type": "ObjectProperty", "start": 419, "end": 438, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 21 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 419, "end": 431, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 14 }, "identifierName": "returnValues" }, "name": "returnValues", "leadingComments": null }, "value": { "type": "BooleanLiteral", "start": 433, "end": 438, "loc": { "start": { "line": 18, "column": 16 }, "end": { "line": 18, "column": 21 } }, "value": false }, "leadingComments": [ { "type": "CommentBlock", "value": " does the dialect support returning values for inserted/updated fields ", "start": 341, "end": 416, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 17, "column": 77 } } } ] }, { "type": "ObjectProperty", "start": 493, "end": 841, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 30, "column": 3 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 493, "end": 506, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 21, "column": 15 }, "identifierName": "autoIncrement" }, "name": "autoIncrement", "leadingComments": null }, "value": { "type": "ObjectExpression", "start": 508, "end": 841, "loc": { "start": { "line": 21, "column": 17 }, "end": { "line": 30, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 617, "end": 638, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 25 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 617, "end": 631, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 18 }, "identifierName": "identityInsert" }, "name": "identityInsert", "leadingComments": null }, "value": { "type": "BooleanLiteral", "start": 633, "end": 638, "loc": { "start": { "line": 23, "column": 20 }, "end": { "line": 23, "column": 25 } }, "value": false }, "leadingComments": [ { "type": "CommentBlock", "value": " does the dialect require modification of insert queries when inserting auto increment fields ", "start": 514, "end": 612, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 102 } } } ] }, { "type": "ObjectProperty", "start": 735, "end": 753, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 735, "end": 747, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 16 }, "identifierName": "defaultValue" }, "name": "defaultValue", "leadingComments": null }, "value": { "type": "BooleanLiteral", "start": 749, "end": 753, "loc": { "start": { "line": 26, "column": 18 }, "end": { "line": 26, "column": 22 } }, "value": true }, "leadingComments": [ { "type": "CommentBlock", "value": " does the dialect support inserting default/null values for autoincrement fields ", "start": 645, "end": 730, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 89 } } } ] }, { "type": "ObjectProperty", "start": 825, "end": 837, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 16 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 825, "end": 831, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 10 }, "identifierName": "update" }, "name": "update", "leadingComments": null }, "value": { "type": "BooleanLiteral", "start": 833, "end": 837, "loc": { "start": { "line": 29, "column": 12 }, "end": { "line": 29, "column": 16 } }, "value": true }, "leadingComments": [ { "type": "CommentBlock", "value": " does the dialect support updating autoincrement fields ", "start": 760, "end": 820, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 64 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": " features specific to autoIncrement values ", "start": 443, "end": 490, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 20, "column": 49 } } } ] }, { "type": "ObjectProperty", "start": 895, "end": 913, "loc": { "start": { "line": 32, "column": 2 }, "end": { "line": 32, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 895, "end": 906, "loc": { "start": { "line": 32, "column": 2 }, "end": { "line": 32, "column": 13 }, "identifierName": "bulkDefault" }, "name": "bulkDefault", "leadingComments": null }, "value": { "type": "BooleanLiteral", "start": 908, "end": 913, "loc": { "start": { "line": 32, "column": 15 }, "end": { "line": 32, "column": 20 } }, "value": false }, "leadingComments": [ { "type": "CommentBlock", "value": " Do we need to say DEFAULT for bulk insert ", "start": 845, "end": 892, "loc": { "start": { "line": 31, "column": 2 }, "end": { "line": 31, "column": 49 } } } ] }, { "type": "ObjectProperty", "start": 963, "end": 983, "loc": { "start": { "line": 34, "column": 2 }, "end": { "line": 34, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 963, "end": 979, "loc": { "start": { "line": 34, "column": 2 }, "end": { "line": 34, "column": 18 }, "identifierName": "ignoreDuplicates" }, "name": "ignoreDuplicates", "leadingComments": null }, "value": { "type": "StringLiteral", "start": 981, "end": 983, "loc": { "start": { "line": 34, "column": 20 }, "end": { "line": 34, "column": 22 } }, "extra": { "rawValue": "", "raw": "''" }, "value": "" }, "leadingComments": [ { "type": "CommentBlock", "value": " The dialect's words for INSERT IGNORE ", "start": 917, "end": 960, "loc": { "start": { "line": 33, "column": 2 }, "end": { "line": 33, "column": 45 } } } ] }, { "type": "ObjectProperty", "start": 1044, "end": 1068, "loc": { "start": { "line": 36, "column": 2 }, "end": { "line": 36, "column": 26 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1044, "end": 1061, "loc": { "start": { "line": 36, "column": 2 }, "end": { "line": 36, "column": 19 }, "identifierName": "updateOnDuplicate" }, "name": "updateOnDuplicate", "leadingComments": null }, "value": { "type": "BooleanLiteral", "start": 1063, "end": 1068, "loc": { "start": { "line": 36, "column": 21 }, "end": { "line": 36, "column": 26 } }, "value": false }, "leadingComments": [ { "type": "CommentBlock", "value": " Does the dialect support ON DUPLICATE KEY UPDATE ", "start": 987, "end": 1041, "loc": { "start": { "line": 35, "column": 2 }, "end": { "line": 35, "column": 56 } } } ] }, { "type": "ObjectProperty", "start": 1072, "end": 1086, "loc": { "start": { "line": 37, "column": 2 }, "end": { "line": 37, "column": 16 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1072, "end": 1079, "loc": { "start": { "line": 37, "column": 2 }, "end": { "line": 37, "column": 9 }, "identifierName": "schemas" }, "name": "schemas" }, "value": { "type": "BooleanLiteral", "start": 1081, "end": 1086, "loc": { "start": { "line": 37, "column": 11 }, "end": { "line": 37, "column": 16 } }, "value": false } }, { "type": "ObjectProperty", "start": 1090, "end": 1108, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 38, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1090, "end": 1102, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 38, "column": 14 }, "identifierName": "transactions" }, "name": "transactions" }, "value": { "type": "BooleanLiteral", "start": 1104, "end": 1108, "loc": { "start": { "line": 38, "column": 16 }, "end": { "line": 38, "column": 20 } }, "value": true } }, { "type": "ObjectProperty", "start": 1112, "end": 1153, "loc": { "start": { "line": 39, "column": 2 }, "end": { "line": 41, "column": 3 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1112, "end": 1130, "loc": { "start": { "line": 39, "column": 2 }, "end": { "line": 39, "column": 20 }, "identifierName": "transactionOptions" }, "name": "transactionOptions" }, "value": { "type": "ObjectExpression", "start": 1132, "end": 1153, "loc": { "start": { "line": 39, "column": 22 }, "end": { "line": 41, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 1138, "end": 1149, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 15 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1138, "end": 1142, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 8 }, "identifierName": "type" }, "name": "type" }, "value": { "type": "BooleanLiteral", "start": 1144, "end": 1149, "loc": { "start": { "line": 40, "column": 10 }, "end": { "line": 40, "column": 15 } }, "value": false } } ] } }, { "type": "ObjectProperty", "start": 1157, "end": 1173, "loc": { "start": { "line": 42, "column": 2 }, "end": { "line": 42, "column": 18 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1157, "end": 1167, "loc": { "start": { "line": 42, "column": 2 }, "end": { "line": 42, "column": 12 }, "identifierName": "migrations" }, "name": "migrations" }, "value": { "type": "BooleanLiteral", "start": 1169, "end": 1173, "loc": { "start": { "line": 42, "column": 14 }, "end": { "line": 42, "column": 18 } }, "value": true } }, { "type": "ObjectProperty", "start": 1177, "end": 1190, "loc": { "start": { "line": 43, "column": 2 }, "end": { "line": 43, "column": 15 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1177, "end": 1184, "loc": { "start": { "line": 43, "column": 2 }, "end": { "line": 43, "column": 9 }, "identifierName": "upserts" }, "name": "upserts" }, "value": { "type": "BooleanLiteral", "start": 1186, "end": 1190, "loc": { "start": { "line": 43, "column": 11 }, "end": { "line": 43, "column": 15 } }, "value": true } }, { "type": "ObjectProperty", "start": 1194, "end": 1231, "loc": { "start": { "line": 44, "column": 2 }, "end": { "line": 46, "column": 3 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1194, "end": 1205, "loc": { "start": { "line": 44, "column": 2 }, "end": { "line": 44, "column": 13 }, "identifierName": "constraints" }, "name": "constraints" }, "value": { "type": "ObjectExpression", "start": 1207, "end": 1231, "loc": { "start": { "line": 44, "column": 15 }, "end": { "line": 46, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 1213, "end": 1227, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 18 } }, "method": false, "shorthand": false,