Merge branch 'alima' into dev
This commit is contained in:
@@ -39,7 +39,6 @@ jspm_packages/
|
||||
./.env
|
||||
scratch/
|
||||
./server/controller/api
|
||||
/temp
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
+34
-20
@@ -1,22 +1,36 @@
|
||||
const Sequelize = require("sequelize");
|
||||
const sequelize = require("../../config/sequelize.conf");
|
||||
const Ubicacion = require('../../server/models/tablas/Ubicacion');
|
||||
const progress = require('cli-progress');
|
||||
const colors = require('colors');
|
||||
|
||||
class Ubicacion extends Sequelize.Model {}
|
||||
Ubicacion.init({
|
||||
idUbicacion: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
allowNull: false,
|
||||
},
|
||||
ubicacion: {
|
||||
type: Sequelize.CHAR,
|
||||
allowNull: false,
|
||||
// unique: true
|
||||
},
|
||||
}, {
|
||||
sequelize,
|
||||
tableName: "ubicacion",
|
||||
});
|
||||
const faker = require('faker');
|
||||
faker.locale = "es_MX";
|
||||
|
||||
module.exports = Ubicacion;
|
||||
async function fillUbicacion() {
|
||||
let ubicaciones = require('./ubicaciones');
|
||||
let limit = ubicacion.length;
|
||||
const bar = new progress.SingleBar({
|
||||
format: 'ubicacion |' + colors.cyan('{bar}') + '| {percentage}%' + ' || {value}/{total} records created.',
|
||||
barCompleteChar: '\u2588',
|
||||
barIncompleteChar: '\u2591',
|
||||
hideCursor: true,
|
||||
stopOnComplete: true,
|
||||
barsize: 30,
|
||||
align: 'right'
|
||||
});
|
||||
|
||||
console.log('\n\tFilling out «ubicacion».'.cyan.italic.bold);
|
||||
|
||||
bar.start(limit, 0);
|
||||
for (ubicacion of ubicaciones) {
|
||||
await Ubicacion.create({
|
||||
ubicacion
|
||||
})
|
||||
.catch(() => {
|
||||
bar.stop();
|
||||
throw new Error();
|
||||
});
|
||||
bar.increment();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = fillUbicacion;
|
||||
@@ -0,0 +1,22 @@
|
||||
const Sequelize = require("sequelize");
|
||||
const sequelize = require("../../config/sequelize.conf");
|
||||
|
||||
class Ubicacion extends Sequelize.Model {}
|
||||
Ubicacion.init({
|
||||
idUbicacion: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
allowNull: false,
|
||||
},
|
||||
ubicacion: {
|
||||
type: Sequelize.CHAR,
|
||||
allowNull: false,
|
||||
// unique: true
|
||||
},
|
||||
}, {
|
||||
sequelize,
|
||||
tableName: "ubicacion",
|
||||
});
|
||||
|
||||
module.exports = Ubicacion;
|
||||
Reference in New Issue
Block a user