PATH:
usr
/
local
/
lib
/
node_modules
/
knex-migrator
/
node_modules
/
knex
/
lib
/
dialects
/
oracle
/
schema
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _inherits = _interopRequireDefault(require("inherits")); var _compiler = _interopRequireDefault(require("../../../schema/compiler")); var utils = _interopRequireWildcard(require("../utils")); var _trigger = _interopRequireDefault(require("./trigger")); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Oracle Schema Compiler // ------- function SchemaCompiler_Oracle() { _compiler.default.apply(this, arguments); } (0, _inherits.default)(SchemaCompiler_Oracle, _compiler.default); // Rename a table on the schema. SchemaCompiler_Oracle.prototype.renameTable = function (tableName, to) { const renameTable = _trigger.default.renameTableAndAutoIncrementTrigger(this.client.logger, tableName, to); this.pushQuery(renameTable); }; // Check whether a table exists on the query. SchemaCompiler_Oracle.prototype.hasTable = function (tableName) { this.pushQuery({ sql: 'select TABLE_NAME from USER_TABLES where TABLE_NAME = ' + this.formatter.parameter(tableName), output(resp) { return resp.length > 0; } }); }; // Check whether a column exists on the schema. SchemaCompiler_Oracle.prototype.hasColumn = function (tableName, column) { const sql = `select COLUMN_NAME from USER_TAB_COLUMNS ` + `where TABLE_NAME = ${this.formatter.parameter(tableName)} ` + `and COLUMN_NAME = ${this.formatter.parameter(column)}`; this.pushQuery({ sql, output: resp => resp.length > 0 }); }; SchemaCompiler_Oracle.prototype.dropSequenceIfExists = function (sequenceName) { this.pushQuery(utils.wrapSqlWithCatch(`drop sequence ${this.formatter.wrap(sequenceName)}`, -2289)); }; SchemaCompiler_Oracle.prototype._dropRelatedSequenceIfExists = function (tableName) { // removing the sequence that was possibly generated by increments() column const sequenceName = utils.generateCombinedName(this.client.logger, 'seq', tableName); this.dropSequenceIfExists(sequenceName); }; SchemaCompiler_Oracle.prototype.dropTable = function (tableName) { this.pushQuery(`drop table ${this.formatter.wrap(tableName)}`); // removing the sequence that was possibly generated by increments() column this._dropRelatedSequenceIfExists(tableName); }; SchemaCompiler_Oracle.prototype.dropTableIfExists = function (tableName) { this.pushQuery(utils.wrapSqlWithCatch(`drop table ${this.formatter.wrap(tableName)}`, -942)); // removing the sequence that was possibly generated by increments() column this._dropRelatedSequenceIfExists(tableName); }; var _default = SchemaCompiler_Oracle; exports.default = _default; module.exports = exports.default;
[+]
..
[-] trigger.js
[edit]
[-] tablecompiler.js
[edit]
[-] columncompiler.js
[edit]
[-] columnbuilder.js
[edit]
[-] compiler.js
[edit]