-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathgenerateScript.js
More file actions
34 lines (29 loc) · 1006 Bytes
/
generateScript.js
File metadata and controls
34 lines (29 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const {
parseDataForEntityLevelScript,
buildEntityLevelAlterScript,
} = require('../helpers/alterScriptHelpers/alterScriptBuilder');
/**
* @typedef {import('../types/coreApplicationTypes').App} App
* @typedef {import('../types/coreApplicationTypes').Logger} Logger
* @typedef {import('../types/coreApplicationTypes').CoreData} CoreData
* @typedef {import('../types/coreApplicationTypes').PluginError} PluginError
**/
/**
* @param data {CoreData}
* @param logger {Logger}
* @param callback {PluginCallback}
* @param app {App}
* */
function generateScript(data, logger, callback, app) {
try {
const parsedData = parseDataForEntityLevelScript(data, app);
const scripts = buildEntityLevelAlterScript(data, app)(parsedData);
callback(null, scripts);
} catch (error) {
logger.log('error', { message: error.message, stack: error.stack }, 'MS SQL Server Forward-Engineering Error');
callback({ message: error.message, stack: error.stack });
}
}
module.exports = {
generateScript,
};