knex/lib/dialects/oracle/schema/internal/incrementUtils.js
Kyler Nelson 82f43d53ab
Support Object Names Greater than 30 Characters for Oracle DB Versions 12.2 and Greater (#5197)
Co-authored-by: Drew Royster <drew.124@gmail.com>
Co-authored-by: Kendra Bryant <kendraa@utahcounty.gov>
Co-authored-by: Matt Bailey <bailey.matthewr@gmail.com>
2023-10-17 02:31:38 +03:00

23 lines
692 B
JavaScript

const Trigger = require('./trigger');
// helper function for pushAdditional in increments() and bigincrements()
function createAutoIncrementTriggerAndSequence(columnCompiler) {
const trigger = new Trigger(columnCompiler.client.version);
// TODO Add warning that sequence etc is created
columnCompiler.pushAdditional(function () {
const tableName = this.tableCompiler.tableNameRaw;
const schemaName = this.tableCompiler.schemaNameRaw;
const createTriggerSQL = trigger.createAutoIncrementTrigger(
this.client.logger,
tableName,
schemaName
);
this.pushQuery(createTriggerSQL);
});
}
module.exports = {
createAutoIncrementTriggerAndSequence,
};