Commit e5b260c0 authored by Matheus Horstmann's avatar Matheus Horstmann 🐴 Committed by Bruno Meyer

#16: Create AutoUpdate

parent f83bf9e2
"use strict";
var async = require('async');
var path = require('path');
var models = require(path.resolve(__dirname,'../common/models/models.js'))
var app = require(path.resolve(__dirname, '../server/server'));
var ds = app.datasources.ensalamento;
var lbTables = [
'User',
'AccessToken',
'ACL','RoleMapping',
'Role',
'Sala',
'Bloco',
'Disciplina',
'Equivalenciadisciplina',
'Evento',
'Turma',
'Recursodesala',
'DisciplinaRecursodesala',
'SalaRecursodesala',
'Tipodesala'
];
var lbTables = models.models;
ds.automigrate(lbTables, function(err) {
if (err) throw err;
......
"use strict";
var models = [
'User',
'AccessToken',
'ACL',
'RoleMapping',
'Role',
'Sala',
'Bloco',
'Disciplina',
'Equivalenciadisciplina',
'Evento',
'Turma',
'Recursodesala',
'SalaRecursodesala',
'DisciplinaRecursodesala',
'Tipodesala'
];
exports.models = models;
"use strict";
var async = require('async');
var path = require('path');
var models = require(path.resolve(__dirname,'../common/models/models.js'))
var models = models.models;
var app = require(path.resolve(__dirname, '../server/server'));
var ds = app.datasources.ensalamento;
var new_models = models.map(function(x){
return x.toLowerCase();
});
ds.isActual(models, function(err, actual) {
console.log('Is actual?: ', actual);
if (!actual) {
ds.autoupdate(models, function(err, result) {
new_models.forEach(function(model){
ds.discoverModelProperties(model, function (err, props) {
console.log(props);
});
});
});
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment