API/api.medcify.app/node_modules/sequelize/lib/dialects/sqlite/query-interface.js.map

8 lines
13 KiB
Plaintext
Raw Normal View History

2022-09-26 06:11:44 +00:00
{
"version": 3,
"sources": ["../../../src/dialects/sqlite/query-interface.js"],
"sourcesContent": ["'use strict';\n\nconst sequelizeErrors = require('../../errors');\nconst QueryTypes = require('../../query-types');\nconst { QueryInterface } = require('../abstract/query-interface');\nconst { cloneDeep } = require('../../utils');\nconst _ = require('lodash');\n\n/**\n * The interface that Sequelize uses to talk with SQLite database\n */\nclass SQLiteQueryInterface extends QueryInterface {\n /**\n * A wrapper that fixes SQLite's inability to remove columns from existing tables.\n * It will create a backup of the table, drop the table afterwards and create a\n * new table with the same name but without the obsolete column.\n *\n * @override\n */\n async removeColumn(tableName, attributeName, options) {\n options = options || {};\n\n const fields = await this.describeTable(tableName, options);\n delete fields[attributeName];\n\n const sql = this.queryGenerator.removeColumnQuery(tableName, fields);\n const subQueries = sql.split(';').filter(q => q !== '');\n\n for (const subQuery of subQueries) await this.sequelize.query(`${subQuery};`, { raw: true, ...options });\n }\n\n /**\n * A wrapper that fixes SQLite's inability to change columns from existing tables.\n * It will create a backup of the table, drop the table afterwards and create a\n * new table with the same name but with a modified version of the respective column.\n *\n * @override\n */\n async changeColumn(tableName, attributeName, dataTypeOrOptions, options) {\n options = options || {};\n\n const fields = await this.describeTable(tableName, options);\n Object.assign(fields[attributeName], this.normalizeAttribute(dataTypeOrOptions));\n\n const sql = this.queryGenerator.removeColumnQuery(tableName, fields);\n const subQueries = sql.split(';').filter(q => q !== '');\n\n for (const subQuery of subQueries) await this.sequelize.query(`${subQuery};`, { raw: true, ...options });\n }\n\n /**\n * A wrapper that fixes SQLite's inability to rename columns from existing tables.\n * It will create a backup of the table, drop the table afterwards and create a\n * new table with the same name but with a renamed version of the respective column.\n *\n * @override\n */\n async renameColumn(tableName, attrNameBefore, attrNameAfter, options) {\n options = options || {};\n const fields = await this.assertTableHasColumn(tableName, attrNameBefore, options);\n\n fields[attrNameAfter] = { ...fields[attrNameBefore] };\n delete fields[attrNameBefore];\n\n const sql = this.queryGenerator.renameColumnQuery(tableName, attrNameBefore, attrNameAfter, fields);\n const subQueries = sql.split(';').filter(q => q !== '');\n\n for (const subQuery of subQueries) await this.sequelize.query(`${subQuery};`, { raw: true, ...options });\n }\n\n /**\n * @override\n */\n async removeConstraint(tableName, constraintName, options) {\n let createTableSql;\n\n const constraints = await this.showConstraint(tableName, constraintName);\n // sqlite can't show only one constraint, so we find here the one to remove\n const constraint = constraints.find(constaint => constaint.constraintName === constraintName);\n\n if (!constraint) {\n throw new sequelizeErrors.UnknownConstraintError({\n message: `Constraint ${constraintName} on table ${tableName} does not exist`,\n constraint: constraintName,\n table: tableName\n });\n }\n createTableSql = constraint.sql;\n constraint.constraintName = this.queryGenerator.quoteIdentifier(constraint.constraintName);\n let constraintSnippet = `, CONSTRAINT ${constraint.constraintName} ${constraint.constraintType} ${constraint.constraintCondition}`;\n\n if (constraint.constraintType === 'FOREIGN KEY') {\n const referenceTableName = this.queryGenerator.quoteTable(constraint.referenceTableName);\n constraint.referenceTableKeys = constraint.referenceTableKeys.map(columnName => this.queryGenerator.quoteIdentifier(columnName));\n const referenceTableKeys = constraint.referenceTableKeys.join
"mappings": ";;;;;;;;;;;;;;;;;;;;AAEA,MAAM,kBAAkB,QAAQ;AAChC,MAAM,aAAa,QAAQ;AAC3B,MAAM,EAAE,mBAAmB,QAAQ;AACnC,MAAM,EAAE,cAAc,QAAQ;AAC9B,MAAM,IAAI,QAAQ;AAKlB,mCAAmC,eAAe;AAAA,QAQ1C,aAAa,WAAW,eAAe,SAAS;AACpD,cAAU,WAAW;AAErB,UAAM,SAAS,MAAM,KAAK,cAAc,WAAW;AACnD,WAAO,OAAO;AAEd,UAAM,MAAM,KAAK,eAAe,kBAAkB,WAAW;AAC7D,UAAM,aAAa,IAAI,MAAM,KAAK,OAAO,OAAK,MAAM;AAEpD,eAAW,YAAY;AAAY,YAAM,KAAK,UAAU,MAAM,GAA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