delore-crm-core 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/models.js +6 -3
- package/package.json +1 -1
package/db/models.js
CHANGED
|
@@ -5,8 +5,12 @@ const listModels = [];
|
|
|
5
5
|
const listModelsIn = [];
|
|
6
6
|
const logger = require('../utils/logger.js');
|
|
7
7
|
const listTablesValidDel = [];
|
|
8
|
+
let pathViews = '';
|
|
8
9
|
|
|
9
10
|
const models = {
|
|
11
|
+
setPathViews: function (path) {
|
|
12
|
+
pathViews = path;
|
|
13
|
+
},
|
|
10
14
|
Migration: function () {
|
|
11
15
|
return migration();
|
|
12
16
|
},
|
|
@@ -380,8 +384,7 @@ async function createViews() {
|
|
|
380
384
|
//
|
|
381
385
|
// Lista diretório com as views
|
|
382
386
|
//
|
|
383
|
-
|
|
384
|
-
var files = fs.readdirSync(directoryPath);
|
|
387
|
+
var files = fs.readdirSync(pathViews);
|
|
385
388
|
if (files) {
|
|
386
389
|
for (var i = 0; i < files.length; i++) {
|
|
387
390
|
var file = files[i];
|
|
@@ -394,7 +397,7 @@ async function createViews() {
|
|
|
394
397
|
|
|
395
398
|
if (listViewExist.length == 0) {
|
|
396
399
|
console.log('* * * criando a view ' + viewName);
|
|
397
|
-
var sql = fs.readFileSync(
|
|
400
|
+
var sql = fs.readFileSync(pathViews + '/' + file, 'utf8');
|
|
398
401
|
console.log(sql);
|
|
399
402
|
await sequelize.query(sql);
|
|
400
403
|
}
|