UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,100 lines (1,099 loc) 398 kB
{ "type": "File", "start": 0, "end": 2487, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 69, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2487, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 69, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 633, "end": 2448, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 64, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 639, "end": 2447, "loc": { "start": { "line": 23, "column": 6 }, "end": { "line": 64, "column": 1 } }, "id": { "type": "Identifier", "start": 639, "end": 651, "loc": { "start": { "line": 23, "column": 6 }, "end": { "line": 23, "column": 18 }, "identifierName": "removeColumn" }, "name": "removeColumn", "leadingComments": null }, "init": { "type": "FunctionExpression", "start": 654, "end": 2447, "loc": { "start": { "line": 23, "column": 21 }, "end": { "line": 64, "column": 1 } }, "id": { "type": "Identifier", "start": 639, "end": 651, "loc": { "start": { "line": 23, "column": 6 }, "end": { "line": 23, "column": 18 }, "identifierName": "removeColumn" }, "name": "removeColumn", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 663, "end": 672, "loc": { "start": { "line": 23, "column": 30 }, "end": { "line": 23, "column": 39 }, "identifierName": "tableName" }, "name": "tableName" }, { "type": "Identifier", "start": 674, "end": 687, "loc": { "start": { "line": 23, "column": 41 }, "end": { "line": 23, "column": 54 }, "identifierName": "attributeName" }, "name": "attributeName" }, { "type": "Identifier", "start": 689, "end": 696, "loc": { "start": { "line": 23, "column": 56 }, "end": { "line": 23, "column": 63 }, "identifierName": "options" }, "name": "options" } ], "body": { "type": "BlockStatement", "start": 698, "end": 2447, "loc": { "start": { "line": 23, "column": 65 }, "end": { "line": 64, "column": 1 } }, "body": [ { "type": "ExpressionStatement", "start": 702, "end": 756, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 24, "column": 56 } }, "expression": { "type": "AssignmentExpression", "start": 702, "end": 755, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 24, "column": 55 } }, "operator": "=", "left": { "type": "Identifier", "start": 702, "end": 709, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 24, "column": 9 }, "identifierName": "options" }, "name": "options" }, "right": { "type": "CallExpression", "start": 712, "end": 755, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 55 } }, "callee": { "type": "MemberExpression", "start": 712, "end": 725, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 25 } }, "object": { "type": "Identifier", "start": 712, "end": 718, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 18 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 719, "end": 725, "loc": { "start": { "line": 24, "column": 19 }, "end": { "line": 24, "column": 25 }, "identifierName": "assign" }, "name": "assign" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 726, "end": 739, "loc": { "start": { "line": 24, "column": 26 }, "end": { "line": 24, "column": 39 } }, "properties": [ { "type": "ObjectProperty", "start": 728, "end": 737, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 37 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 728, "end": 731, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 31 }, "identifierName": "raw" }, "name": "raw" }, "value": { "type": "BooleanLiteral", "start": 733, "end": 737, "loc": { "start": { "line": 24, "column": 33 }, "end": { "line": 24, "column": 37 } }, "value": true } } ] }, { "type": "LogicalExpression", "start": 741, "end": 754, "loc": { "start": { "line": 24, "column": 41 }, "end": { "line": 24, "column": 54 } }, "left": { "type": "Identifier", "start": 741, "end": 748, "loc": { "start": { "line": 24, "column": 41 }, "end": { "line": 24, "column": 48 }, "identifierName": "options" }, "name": "options" }, "operator": "||", "right": { "type": "ObjectExpression", "start": 752, "end": 754, "loc": { "start": { "line": 24, "column": 52 }, "end": { "line": 24, "column": 54 } }, "properties": [] } } ] } } }, { "type": "VariableDeclaration", "start": 760, "end": 858, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 26, "column": 100 } }, "declarations": [ { "type": "VariableDeclarator", "start": 766, "end": 857, "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 99 } }, "id": { "type": "Identifier", "start": 766, "end": 783, "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 25 }, "identifierName": "findConstraintSql" }, "name": "findConstraintSql" }, "init": { "type": "CallExpression", "start": 786, "end": 857, "loc": { "start": { "line": 26, "column": 28 }, "end": { "line": 26, "column": 99 } }, "callee": { "type": "MemberExpression", "start": 786, "end": 831, "loc": { "start": { "line": 26, "column": 28 }, "end": { "line": 26, "column": 73 } }, "object": { "type": "MemberExpression", "start": 786, "end": 805, "loc": { "start": { "line": 26, "column": 28 }, "end": { "line": 26, "column": 47 } }, "object": { "type": "ThisExpression", "start": 786, "end": 790, "loc": { "start": { "line": 26, "column": 28 }, "end": { "line": 26, "column": 32 } } }, "property": { "type": "Identifier", "start": 791, "end": 805, "loc": { "start": { "line": 26, "column": 33 }, "end": { "line": 26, "column": 47 }, "identifierName": "QueryGenerator" }, "name": "QueryGenerator" }, "computed": false }, "property": { "type": "Identifier", "start": 806, "end": 831, "loc": { "start": { "line": 26, "column": 48 }, "end": { "line": 26, "column": 73 }, "identifierName": "getDefaultConstraintQuery" }, "name": "getDefaultConstraintQuery" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 832, "end": 841, "loc": { "start": { "line": 26, "column": 74 }, "end": { "line": 26, "column": 83 }, "identifierName": "tableName" }, "name": "tableName" }, { "type": "Identifier", "start": 843, "end": 856, "loc": { "start": { "line": 26, "column": 85 }, "end": { "line": 26, "column": 98 }, "identifierName": "attributeName" }, "name": "attributeName" } ] } } ], "kind": "const" }, { "type": "ReturnStatement", "start": 861, "end": 2445, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 63, "column": 7 } }, "argument": { "type": "CallExpression", "start": 868, "end": 2444, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 63, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 868, "end": 2285, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 60, "column": 9 } }, "object": { "type": "CallExpression", "start": 868, "end": 2275, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 59, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 868, "end": 2031, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 53, "column": 11 } }, "object": { "type": "CallExpression", "start": 868, "end": 2019, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 52, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 868, "end": 1769, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 48, "column": 9 } }, "object": { "type": "CallExpression", "start": 868, "end": 1759, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 47, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 868, "end": 1438, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 40, "column": 11 } }, "object": { "type": "CallExpression", "start": 868, "end": 1426, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 39, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 868, "end": 1250, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 36, "column": 9 } }, "object": { "type": "CallExpression", "start": 868, "end": 1240, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 35, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 868, "end": 928, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 28, "column": 11 } }, "object": { "type": "CallExpression", "start": 868, "end": 916, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 57 } }, "callee": { "type": "MemberExpression", "start": 868, "end": 888, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 29 } }, "object": { "type": "MemberExpression", "start": 868, "end": 882, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 23 } }, "object": { "type": "ThisExpression", "start": 868, "end": 872, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 13 } } }, "property": { "type": "Identifier", "start": 873, "end": 882, "loc": { "start": { "line": 27, "column": 14 }, "end": { "line": 27, "column": 23 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "property": { "type": "Identifier", "start": 883, "end": 888, "loc": { "start": { "line": 27, "column": 24 }, "end": { "line": 27, "column": 29 }, "identifierName": "query" }, "name": "query" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 889, "end": 906, "loc": { "start": { "line": 27, "column": 30 }, "end": { "line": 27, "column": 47 }, "identifierName": "findConstraintSql" }, "name": "findConstraintSql" }, { "type": "Identifier", "start": 908, "end": 915, "loc": { "start": { "line": 27, "column": 49 }, "end": { "line": 27, "column": 56 }, "identifierName": "options" }, "name": "options" } ] }, "property": { "type": "Identifier", "start": 922, "end": 928, "loc": { "start": { "line": 28, "column": 5 }, "end": { "line": 28, "column": 11 }, "identifierName": "spread" }, "name": "spread" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 929, "end": 1239, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 35, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 929, "end": 936, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 19 }, "identifierName": "results" }, "name": "results" } ], "body": { "type": "BlockStatement", "start": 940, "end": 1239, "loc": { "start": { "line": 28, "column": 23 }, "end": { "line": 35, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 948, "end": 1069, "loc": { "start": { "line": 29, "column": 6 }, "end": { "line": 32, "column": 7 } }, "test": { "type": "UnaryExpression", "start": 952, "end": 967, "loc": { "start": { "line": 29, "column": 10 }, "end": { "line": 29, "column": 25 } }, "operator": "!", "prefix": true, "argument": { "type": "MemberExpression", "start": 953, "end": 967, "loc": { "start": { "line": 29, "column": 11 }, "end": { "line": 29, "column": 25 } }, "object": { "type": "Identifier", "start": 953, "end": 960, "loc": { "start": { "line": 29, "column": 11 }, "end": { "line": 29, "column": 18 }, "identifierName": "results" }, "name": "results" }, "property": { "type": "Identifier", "start": 961, "end": 967, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 29, "column": 25 }, "identifierName": "length" }, "name": "length" }, "computed": false }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 969, "end": 1069, "loc": { "start": { "line": 29, "column": 27 }, "end": { "line": 32, "column": 7 } }, "body": [ { "type": "ReturnStatement", "start": 1054, "end": 1061, "loc": { "start": { "line": 31, "column": 8 }, "end": { "line": 31, "column": 15 } }, "argument": null, "leadingComments": [ { "type": "CommentLine", "value": " No default constraint found -- we can cleanly remove the column", "start": 979,