UNPKG

asciidoctor-liquibase

Version:

Asciidoctor.js extension to render liquibase changesets as entity relationship diagram

67 lines (63 loc) 2.68 kB
// *** WARNING: DO NOT MODIFY *** This is a generated JavaScript source code! // // Generated by LF-ET 2.2.1 (230826a), https://www.lohrfink.de/lfet // From decision table // "/opt/data/github/asciidoctor/asciidoctor-liquibase/lfet/extractor/addColumn.lfet" // 09.09.2023 21:06 // // Changes to this code resulting from refactorings can be synchronised // with LF-ET using the function "Scrapbook Import". // // Prolog Decision Table ----> const { stringify } = require('../utils') function addColumn (element, currentFile, processModel, logger, vfs) { // Prolog Decision Table <---- // Condition B01/01: definition is based on ... format / yaml / yaml definition if (currentFile.endsWith('yaml')) { // Rule R01 ----> // Trace ----> logger.info(`addColumn - 20230909.210655 - 1 / 3 - ${currentFile} - ${stringify(processModel)}`) // Trace <---- // Action A01/01: extract ... / yaml / extract table on yaml definition const tableName = element.addColumn.tableName const table = processModel.tables.get(tableName) const columns = element.addColumn.columns columns.forEach((column) => { const columnDetails = require('./column').extract(column.column, currentFile, logger) table.columns.set(columnDetails.name, columnDetails) }) // Rule R01 <---- // Condition B01/02: definition is based on ... format / xml / xml definition } else if (currentFile.endsWith('xml')) { // Rule R02 ----> // Trace ----> logger.info(`addColumn - 20230909.210655 - 2 / 3 - ${currentFile} - ${stringify(processModel)}`) // Trace <---- // Action A01/02: extract ... / xml / extract on xml definition const tableName = element.$.tableName const table = processModel.tables.get(tableName) const columns = element.column columns.forEach((column) => { const columnDetails = require('./column').extract(column, currentFile, logger) table.columns.set(columnDetails.name, columnDetails) }) // Rule R02 <---- } else { // Rule R03 ----> // Trace ----> logger.info(`addColumn - 20230909.210655 - 3 / 3 - ${currentFile} - ${stringify(processModel)}`) // Trace <---- // Action A02/01: error / X / execute action logger.error(`addColumn - 20230909.210655 - Format for ${currentFile} is not supported.`) // Rule R03 <---- } // Epilog Decision Table ----> } module.exports = { extract: (element, currentFile, processModel, logger, vfs) => { return addColumn(element, currentFile, processModel, logger, vfs) } } // Epilog Decision Table <---- // End of generated JavaScript source code // Generated by LF-ET 2.2.1 (230826a), https://www.lohrfink.de/lfet