Commit 55ac625c authored by Matheus Horstmann's avatar Matheus Horstmann 🐴
Browse files

Add doc


Signed-off-by: Matheus Horstmann's avatarMatheus Horstmann <mch15@inf.ufpr.br>
parent fd30de11
var path = require('path');
var async = require('async');
var app = require(path.resolve(__dirname, '../server/server'));
var ds = app.datasources.ensalamento;
var models = require(path.resolve(__dirname,'../common/models/models.js'))
var lbTables = models.models_lower;
var count = lbTables.length;
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
/**
* Parse old database file to a new instace of Recursodesala.
*
* Discover And Build Models
*
* Discover();
* discoverAndBuildModels();
*
* For each Models: Ask to database the schema and show all data on it
* @public
*/
function discoverAndBuildModels(){
lbTables.forEach(function(table) { /*!<arse old database file to a new instace of Recursodesala. */
var app = require(path.resolve(__dirname, '../server/server'));
var ds = app.datasources.ensalamento;
var models = require(path.resolve(__dirname,'../common/models/models.js'))
var lbTables = models.models_lower;
var count = lbTables.length;
lbTables.forEach(function(table) { /*!<arse old database file to a new instace of Recursodesala. */
ds.discoverAndBuildModels(table, {schema: 'public'}, function(err, models) {
if (err) throw err;
ds.discoverAndBuildModels(table, {schema: 'public'}, function(err, models) {
if (err) throw err;
models[table.capitalize()].find(function(err, model) {
models[table.capitalize()].find(function(err, model) {
if (err) return console.log(err);
if (err) return console.log(err);
if(model.length !== 0)
console.log(model);
});
if(model.length !== 0)
console.log(model);
});
});
count--;
if (count === 0)
ds.disconnect();
});
count--;
if (count === 0)
ds.disconnect();
});
}
discoverAndBuildModels();
var path = require('path');
var app = require(path.resolve(__dirname, '../server/server'));
var ds = app.datasources.ensalamento;
var models = require(path.resolve(__dirname,'../common/models/models.js'))
var lbTables = models.models_lower;
var count = lbTables.length;
lbTables.forEach(function(table) {
ds.discoverSchema(table, {schema: "public"}, function(err, schema) {
if (err) throw err;
var json = JSON.stringify(schema, null, ' ');
console.log(json);
/**
* Discover Schema
*
* discoverSchema();
*
* For each Models: Ask to database the schema and print it
* @public
*/
function discoverSchema(){
var ds = app.datasources.ensalamento;
var models = require(path.resolve(__dirname,'../common/models/models.js'))
var lbTables = models.models_lower;
var count = lbTables.length;
lbTables.forEach(function(table) {
ds.discoverSchema(table, {schema: "public"}, function(err, schema) {
if (err) throw err;
var json = JSON.stringify(schema, null, ' ');
console.log(json);
});
count--;
if (count === 0)
ds.disconnect();
});
count--;
if (count === 0)
ds.disconnect();
});
}
discoverSchema();
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