UNPKG

asciidoctor-liquibase

Version:

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

52 lines (48 loc) 2.13 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/createIndex.lfet" // 10.09.2023 22:35 // // 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 createIndex (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(`createIndex - 20230910.223507 - 1 / 2 - ${currentFile} - ${stringify(processModel)}`) // Trace <---- // Action A01/01: extract ... / yaml / extract table on yaml definition const tableName = element.createIndex.tableName const indexName = element.createIndex.indexName processModel.tables.get(tableName).indices = new Map() processModel.tables.get(tableName).indices.set(indexName, { columns: [] }) for (let columnIndex = 0; columnIndex < element.createIndex.columns.length; columnIndex++) { processModel.tables.get(tableName).indices.get(indexName).columns.push(element.createIndex.columns[columnIndex].column.name) } // Rule R01 <---- } else { // Rule R02 ----> // Trace ----> logger.info(`createIndex - 20230910.223507 - 2 / 2 - ${currentFile} - ${stringify(processModel)}`) // Trace <---- // Action A02/01: error / X / execute action logger.error(`createIndex - 20230910.223507 - Format for ${currentFile} is not supported.`) // Rule R02 <---- } // Epilog Decision Table ----> } module.exports = { extract: (element, currentFile, processModel, logger, vfs) => { return createIndex(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