From 4e9c322c193e92c1ccebdbd7b04bc7f66e4568b9 Mon Sep 17 00:00:00 2001 From: Eric Fernandez Date: Thu, 11 Jul 2019 15:49:16 -0300 Subject: [PATCH] no dependency Promise2 --- .gitignore | 2 +- README.md | 2 +- migrations/20181123153918_v0.1.js | 380 +++++++++++++++++------------------ migrations/20181127121352_v0.1.1.js | 24 +-- migrations/20181129105456_v0.2.js | 28 ++- migrations/20181130113831_v0.3.js | 20 +- migrations/20181206105940_v0.1.2.js | 20 +- migrations/20181210132759_v0.4.js | 20 +- migrations/20181211152717_0.4.1.js | 20 +- migrations/20181213153525_0.5.js | 117 ++++++----- migrations/20181217131259_v0.6.js | 36 ++-- migrations/20181217172010_v0.5.1.js | 16 +- migrations/20181218155954_0.6.1.js | 24 +-- migrations/20181221125659_0.6.2.js | 21 +- migrations/20181221173513_v0.6.3.js | 20 +- migrations/20181226120323_v0.6.4.js | 20 +- migrations/20181227171744_v0.6.5.js | 40 ++-- migrations/20181231114424_v0.6.6.js | 60 +++--- migrations/20190102160859_v0.6.7.js | 20 +- migrations/20190107163621_v0.6.8.js | 20 +- migrations/20190108114746_v0.6.9.js | 42 ++-- migrations/20190109123406_v0.6.10.js | 20 +- migrations/20190109123752_v0.6.11.js | 29 ++- migrations/20190110100715_v0.6.12.js | 34 ++-- migrations/20190110152626_v0.6.13.js | 18 +- migrations/20190114160629_v0.6.14.js | 26 +-- migrations/20190118161051_v0.6.15.js | 20 +- migrations/20190121125737_v0.6.16.js | 34 ++-- migrations/20190122165422_v0.6.17.js | 60 +++--- migrations/20190125093429_v0.6.18.js | 20 +- migrations/20190125102735_v0.6.19.js | 40 ++-- migrations/20190131161852_v0.6.20.js | 26 +-- migrations/20190207113109_v0.7.0.js | 12 +- migrations/20190208131322_0.7.1.js | 2 +- migrations/20190212103514_v0.7.2.js | 22 +- migrations/20190215123700_v0.7.3.js | 36 ++-- migrations/20190220100315_v0.7.4.js | 19 +- migrations/20190220121752_v0.7.5.js | 15 +- migrations/20190221092657_v0.7.6.js | 36 ++-- migrations/20190225143232_v0.7.7.js | 4 +- migrations/20190228111345_v0.7.8.js | 2 + migrations/20190311170816_v0.8.0.js | 16 +- migrations/20190412094131_v0.9.0.js | 23 +-- migrations/20190425163004_v0.9.1.js | 22 +- migrations/20190524103556_v0.10.0.js | 58 +++--- migrations/20190611150606_v0.11.0.js | 24 +-- package.json | 7 +- 47 files changed, 711 insertions(+), 866 deletions(-) diff --git a/.gitignore b/.gitignore index c9e601c..71a0b10 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /node_modules /knexfile.js -/package-lock.json \ No newline at end of file +/package-lock.json diff --git a/README.md b/README.md index 87f00a8..c791f3f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Pasos a seguir instalación y primera migración: - Una vez bajado el proyecto correr el siguiente comando en consola si es la primera ve(se debe tener instalado node): -> npm install -g knex && npm install && knex init +> npm run init - Una vez ejecutado el comando se ha creado el archivo `knexfile.js`, configurar la base de datos deseada. - En consola correr el comando > knex migrate:latest --env nombreConfiguracion diff --git a/migrations/20181123153918_v0.1.js b/migrations/20181123153918_v0.1.js index 243ced0..521e454 100644 --- a/migrations/20181123153918_v0.1.js +++ b/migrations/20181123153918_v0.1.js @@ -1,197 +1,194 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.createTable('nota_pedido', function(table) { - table.increments(); - table.integer('bomba'); - table.integer('cotizacion'); - table.string('cuitCliente'); - table.string('domicilioStamp'); - table.integer('estado'); - table.dateTime('fechaCarga'); - table.integer('flete'); - table.integer('fob'); - table.decimal('kilometros', 12, 2); - table.string('nombreCliente'); - table.integer('numeroNotaPedido'); - table.integer('responsabilidadIvaCliente'); - table.integer('sucursal'); - table.decimal('total', 12, 2); - table.bigInteger('idCliente').unsigned(); - table.bigInteger('idCotizacion').unsigned(); - table.bigInteger('idDomicilio').unsigned(); - table.bigInteger('idPrecioCondicion').unsigned(); - table.bigInteger('idProveedor').unsigned(); - table.bigInteger('idRemito').unsigned(); - table.bigInteger('idVendedor').unsigned(); - }).createTable('precios_condiciones', function(table) { - table.increments(); - table.boolean('activo'); - table.string('codigo'); - table.string('descripcion'); - table.string('nombre'); - table.date('vigencia'); - table.bigInteger('idListaPrecio').unsigned(); - }).createTable('plazo_pago', function(table) { - table.increments(); - table.boolean('activo'); - table.integer('dias'); - table.integer('item'); - table.bigInteger('idPreciosCondiciones').unsigned(); - }).createTable('articulo_nota_pedido', function(table) { - table.increments(); - table.decimal('cantidad', 12, 2); - table.string('codigo'); - table.boolean('combustible'); - table.decimal('costoUnitario', 12, 2); - table.string('descripcion'); - table.decimal('exentoUnitario', 12, 2); - table.boolean('facturado'); - table.decimal('impuestoInternoUnitario', 12, 2); - table.decimal('impuestoInterno1Unitario', 12, 2); - table.decimal('impuestoInterno2Unitario', 12, 2); - table.integer('item'); - table.decimal('ivaUnitario', 12, 2); - table.decimal('ivaServicioUnitario', 12, 2); - table.string('nombre'); - table.decimal('precio', 12, 4); - table.decimal('precioLista', 12, 2); - table.integer('sector'); - table.integer('rubro'); - table.decimal('tasaIva', 12, 2); - table.bigInteger('idNotaPedido').unsigned(); - }).createTable('boton', function(table) { - table.increments(); - table.string('accion'); - table.string('app'); - table.string('clase'); - table.string('texto'); - }).createTable('chofer', function(table) { - table.increments(); - table.string('dni'); - table.string('nombre'); - table.string('telefono'); - table.bigInteger('idTransportista').unsigned(); - }).createTable('vehiculo', function(table) { - table.increments(); - table.string('capacidad'); - table.string('cisternado'); - table.string('semi'); - table.string('tractor'); - table.bigInteger('idTransportista').unsigned(); - // TODO: Revisar si en los seeds no inserta por ser nombres de campo demasiado largos. - // table.string('seguimientoSatelitalUrl'); - // table.string('seguimientoSatelitalUsuario'); - // table.string('seguimientoSatelitalClave'); - }).createTable('nota-pedido-plazo', function(table) { - table.increments(); - table.integer('dias').unsigned(); - table.bigInteger('idNotaPedido').unsigned(); - }).createTable('seguimiento', function(table) { - table.increments(); - table.string('actividad'); - table.integer('distancia'); - table.dateTime('fecha'); - table.string('latitud'); - table.string('longitud'); - table.string('observaciones'); - table.integer('orden'); - table.bigInteger('idUsuario').unsigned(); - }).createTable('nota-pedido-estado', function(table) { - table.increments(); - table.integer('estado'); - table.dateTime('fecha'); - table.bigInteger('idNotaPedido').unsigned(); - table.integer('idVendedor').unsigned(); - }).createTable('configuracion_terminal', function(table) { - table.increments(); - table.string('terminalKey'); - table.string('valor'); - table.string('variable'); - }).createTable('remito', function(table) { - table.increments(); - table.boolean('anulado'); - table.integer('asiento'); - table.integer('bomba'); - table.decimal('carga', 12, 2); - table.string('cuitCliente'); - table.integer('cuentaContable'); - table.integer('cuentaMadre'); - table.decimal('descuento', 12, 2); - table.integer('destinoVenta'); - table.string('domicilioStamp'); - table.integer('estado'); - table.dateTime('fechaRemito'); - table.integer('flete'); - table.integer('fob'); - table.decimal('importeExento', 12, 2); - table.decimal('importeImpuestoInterno', 12, 2); - table.decimal('importeImpuestoInterno1', 12, 2); - table.decimal('importeImpuestoInterno2', 12, 2); - table.decimal('importeIva', 12, 2); - table.decimal('importeIvaServicios', 12, 2); - table.decimal('importeNeto', 12, 2); - table.decimal('kilometros', 12, 2); - table.integer('lugar'); - table.string('nombreCliente'); - table.integer('numeroLiquidoProducto'); - table.integer('numeroNotaPedido'); - table.integer('numeroRemito'); - table.integer('operacionTipo'); - table.decimal('percepcion', 12, 2); - table.decimal('percepcionIva', 12, 2); - table.integer('planilla'); - table.integer('sucursal'); - table.decimal('redondeo', 12, 2); - table.integer('responsabilidadIvaCliente'); - table.decimal('total', 12, 2); - table.bigInteger('idVendedor').unsigned(); - table.bigInteger('idProveedor').unsigned(); - table.bigInteger('idDomicilio').unsigned(); - table.bigInteger('idCotizacion').unsigned(); - table.bigInteger('idPrecioCondicion').unsigned(); - table.bigInteger('idHojaRuta').unsigned(); - table.bigInteger('idCliente').unsigned(); - table.string('e_hd'); - table.string('c_hd'); - }).createTable('articulo_remito', function(table) { - table.increments(); - table.decimal('cantidad', 12, 2); - table.string('codigo'); - table.boolean('combustible'); - table.decimal('costoUnitario', 12, 2); - table.string('descripcion'); - table.decimal('exentoUnitario', 12, 2); - table.boolean('facturado'); - table.integer('item'); - table.decimal('impuestoInternoUnitario', 12, 2); - table.decimal('impuestoInterno1Unitario', 12, 2); - table.decimal('impuestoInterno2Unitario', 12, 2); - table.decimal('ivaServicioUnitario', 12, 2); - table.decimal('ivaUnitario', 12, 2); - table.string('nombre'); - table.decimal('precio', 12, 4); - table.decimal('precioLista', 12, 2); - table.integer('sector'); - table.integer('rubro'); - table.decimal('tasaIva', 12, 2); - table.bigInteger('idRemito').unsigned(); - }).createTable('hoja_ruta', function(table) { - table.increments(); - table.dateTime('fechaCreacion'); - table.bigInteger('numeroHojaRuta').unsigned(); - table.integer('sucursal').unsigned(); - table.decimal('tarifaFlete', 12, 2); - table.bigInteger('idTransportista').unsigned(); - table.bigInteger('idChofer').unsigned(); - table.bigInteger('idVehiculo').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema.createTable('nota_pedido', function(table) { + table.increments(); + table.integer('bomba'); + table.integer('cotizacion'); + table.string('cuitCliente'); + table.string('domicilioStamp'); + table.integer('estado'); + table.dateTime('fechaCarga'); + table.integer('flete'); + table.integer('fob'); + table.decimal('kilometros', 12, 2); + table.string('nombreCliente'); + table.integer('numeroNotaPedido'); + table.integer('responsabilidadIvaCliente'); + table.integer('sucursal'); + table.decimal('total', 12, 2); + table.bigInteger('idCliente').unsigned(); + table.bigInteger('idCotizacion').unsigned(); + table.bigInteger('idDomicilio').unsigned(); + table.bigInteger('idPrecioCondicion').unsigned(); + table.bigInteger('idProveedor').unsigned(); + table.bigInteger('idRemito').unsigned(); + table.bigInteger('idVendedor').unsigned(); + }).createTable('precios_condiciones', function(table) { + table.increments(); + table.boolean('activo'); + table.string('codigo'); + table.string('descripcion'); + table.string('nombre'); + table.date('vigencia'); + table.bigInteger('idListaPrecio').unsigned(); + }).createTable('plazo_pago', function(table) { + table.increments(); + table.boolean('activo'); + table.integer('dias'); + table.integer('item'); + table.bigInteger('idPreciosCondiciones').unsigned(); + }).createTable('articulo_nota_pedido', function(table) { + table.increments(); + table.decimal('cantidad', 12, 2); + table.string('codigo'); + table.boolean('combustible'); + table.decimal('costoUnitario', 12, 2); + table.string('descripcion'); + table.decimal('exentoUnitario', 12, 2); + table.boolean('facturado'); + table.decimal('impuestoInternoUnitario', 12, 2); + table.decimal('impuestoInterno1Unitario', 12, 2); + table.decimal('impuestoInterno2Unitario', 12, 2); + table.integer('item'); + table.decimal('ivaUnitario', 12, 2); + table.decimal('ivaServicioUnitario', 12, 2); + table.string('nombre'); + table.decimal('precio', 12, 4); + table.decimal('precioLista', 12, 2); + table.integer('sector'); + table.integer('rubro'); + table.decimal('tasaIva', 12, 2); + table.bigInteger('idNotaPedido').unsigned(); + }).createTable('boton', function(table) { + table.increments(); + table.string('accion'); + table.string('app'); + table.string('clase'); + table.string('texto'); + }).createTable('chofer', function(table) { + table.increments(); + table.string('dni'); + table.string('nombre'); + table.string('telefono'); + table.bigInteger('idTransportista').unsigned(); + }).createTable('vehiculo', function(table) { + table.increments(); + table.string('capacidad'); + table.string('cisternado'); + table.string('semi'); + table.string('tractor'); + table.bigInteger('idTransportista').unsigned(); + // TODO: Revisar si en los seeds no inserta por ser nombres de campo demasiado largos. + // table.string('seguimientoSatelitalUrl'); + // table.string('seguimientoSatelitalUsuario'); + // table.string('seguimientoSatelitalClave'); + }).createTable('nota-pedido-plazo', function(table) { + table.increments(); + table.integer('dias').unsigned(); + table.bigInteger('idNotaPedido').unsigned(); + }).createTable('seguimiento', function(table) { + table.increments(); + table.string('actividad'); + table.integer('distancia'); + table.dateTime('fecha'); + table.string('latitud'); + table.string('longitud'); + table.string('observaciones'); + table.integer('orden'); + table.bigInteger('idUsuario').unsigned(); + }).createTable('nota-pedido-estado', function(table) { + table.increments(); + table.integer('estado'); + table.dateTime('fecha'); + table.bigInteger('idNotaPedido').unsigned(); + table.integer('idVendedor').unsigned(); + }).createTable('configuracion_terminal', function(table) { + table.increments(); + table.string('terminalKey'); + table.string('valor'); + table.string('variable'); + }).createTable('remito', function(table) { + table.increments(); + table.boolean('anulado'); + table.integer('asiento'); + table.integer('bomba'); + table.decimal('carga', 12, 2); + table.string('cuitCliente'); + table.integer('cuentaContable'); + table.integer('cuentaMadre'); + table.decimal('descuento', 12, 2); + table.integer('destinoVenta'); + table.string('domicilioStamp'); + table.integer('estado'); + table.dateTime('fechaRemito'); + table.integer('flete'); + table.integer('fob'); + table.decimal('importeExento', 12, 2); + table.decimal('importeImpuestoInterno', 12, 2); + table.decimal('importeImpuestoInterno1', 12, 2); + table.decimal('importeImpuestoInterno2', 12, 2); + table.decimal('importeIva', 12, 2); + table.decimal('importeIvaServicios', 12, 2); + table.decimal('importeNeto', 12, 2); + table.decimal('kilometros', 12, 2); + table.integer('lugar'); + table.string('nombreCliente'); + table.integer('numeroLiquidoProducto'); + table.integer('numeroNotaPedido'); + table.integer('numeroRemito'); + table.integer('operacionTipo'); + table.decimal('percepcion', 12, 2); + table.decimal('percepcionIva', 12, 2); + table.integer('planilla'); + table.integer('sucursal'); + table.decimal('redondeo', 12, 2); + table.integer('responsabilidadIvaCliente'); + table.decimal('total', 12, 2); + table.bigInteger('idVendedor').unsigned(); + table.bigInteger('idProveedor').unsigned(); + table.bigInteger('idDomicilio').unsigned(); + table.bigInteger('idCotizacion').unsigned(); + table.bigInteger('idPrecioCondicion').unsigned(); + table.bigInteger('idHojaRuta').unsigned(); + table.bigInteger('idCliente').unsigned(); + table.string('e_hd'); + table.string('c_hd'); + }).createTable('articulo_remito', function(table) { + table.increments(); + table.decimal('cantidad', 12, 2); + table.string('codigo'); + table.boolean('combustible'); + table.decimal('costoUnitario', 12, 2); + table.string('descripcion'); + table.decimal('exentoUnitario', 12, 2); + table.boolean('facturado'); + table.integer('item'); + table.decimal('impuestoInternoUnitario', 12, 2); + table.decimal('impuestoInterno1Unitario', 12, 2); + table.decimal('impuestoInterno2Unitario', 12, 2); + table.decimal('ivaServicioUnitario', 12, 2); + table.decimal('ivaUnitario', 12, 2); + table.string('nombre'); + table.decimal('precio', 12, 4); + table.decimal('precioLista', 12, 2); + table.integer('sector'); + table.integer('rubro'); + table.decimal('tasaIva', 12, 2); + table.bigInteger('idRemito').unsigned(); + }).createTable('hoja_ruta', function(table) { + table.increments(); + table.dateTime('fechaCreacion'); + table.bigInteger('numeroHojaRuta').unsigned(); + table.integer('sucursal').unsigned(); + table.decimal('tarifaFlete', 12, 2); + table.bigInteger('idTransportista').unsigned(); + table.bigInteger('idChofer').unsigned(); + table.bigInteger('idVehiculo').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema +exports.down = function(knex) { + return knex.schema .dropTable('nota_pedido') .dropTable('precios_condiciones') .dropTable('plazo_pago') @@ -206,5 +203,4 @@ exports.down = function(knex, Promise) { .dropTable('remito') .dropTable('articulo_remito') .dropTable('hoja_ruta') - ]); }; diff --git a/migrations/20181127121352_v0.1.1.js b/migrations/20181127121352_v0.1.1.js index 560beb3..9a742b6 100644 --- a/migrations/20181127121352_v0.1.1.js +++ b/migrations/20181127121352_v0.1.1.js @@ -1,18 +1,14 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('APAREMP', function(table) { - table.decimal('latitud', 10, 7); - table.decimal('longitud', 10, 7); - }) - ]) +exports.up = function(knex) { + return knex.schema.table('APAREMP', function(table) { + table.decimal('latitud', 10, 7); + table.decimal('longitud', 10, 7); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('APAREMP', function(table) { - table.dropColumn('latitud'); - table.dropColumn('longitud'); - }) - ]) +exports.down = function(knex) { + return knex.schema.table('APAREMP', function(table) { + table.dropColumn('latitud'); + table.dropColumn('longitud'); + }); }; diff --git a/migrations/20181129105456_v0.2.js b/migrations/20181129105456_v0.2.js index b0bacd9..a585302 100644 --- a/migrations/20181129105456_v0.2.js +++ b/migrations/20181129105456_v0.2.js @@ -1,19 +1,15 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('vehiculo', function(table) { - table.boolean('desactivado'); - }).alterTable('chofer', function(table) { - table.boolean('desactivado'); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('vehiculo', function(table) { + table.boolean('desactivado'); + }).alterTable('chofer', function(table) { + table.boolean('desactivado'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('vehiculo', function(table) { - table.dropColumn('desactivado'); - }).alterTable('chofer', function(table) { - table.dropColumn('desactivado'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('vehiculo', function(table) { + table.dropColumn('desactivado'); + }).alterTable('chofer', function(table) { + table.dropColumn('desactivado'); + }); }; diff --git a/migrations/20181130113831_v0.3.js b/migrations/20181130113831_v0.3.js index e9257a0..0f08808 100644 --- a/migrations/20181130113831_v0.3.js +++ b/migrations/20181130113831_v0.3.js @@ -1,15 +1,11 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.createTable('cobrador', function(table) { - table.increments(); - table.string('nombre'); - table.boolean('desactivado'); - }) - ]); +exports.up = function(knex) { + return knex.schema.createTable('cobrador', function(table) { + table.increments(); + table.string('nombre'); + table.boolean('desactivado'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.dropTable('cobrador') - ]); +exports.down = function(knex) { + return knex.schema.dropTable('cobrador'); }; diff --git a/migrations/20181206105940_v0.1.2.js b/migrations/20181206105940_v0.1.2.js index 2af3db8..aeff32d 100644 --- a/migrations/20181206105940_v0.1.2.js +++ b/migrations/20181206105940_v0.1.2.js @@ -1,15 +1,11 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.createTable('remito-plazo', function(table) { - table.increments(); - table.integer('dias').unsigned(); - table.bigInteger('idRemito').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema.createTable('remito-plazo', function(table) { + table.increments(); + table.integer('dias').unsigned(); + table.bigInteger('idRemito').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.dropTable('remito-plazo') - ]); +exports.down = function(knex) { + return knex.schema.dropTable('remito-plazo'); }; diff --git a/migrations/20181210132759_v0.4.js b/migrations/20181210132759_v0.4.js index 06a9a42..5072e1a 100644 --- a/migrations/20181210132759_v0.4.js +++ b/migrations/20181210132759_v0.4.js @@ -1,15 +1,11 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('seguimiento', function(table) { - table.integer('sucursal'); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('seguimiento', function(table) { + table.integer('sucursal'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('seguimiento', function(table) { - table.dropColumn('sucursal'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('seguimiento', function(table) { + table.dropColumn('sucursal'); + }); }; diff --git a/migrations/20181211152717_0.4.1.js b/migrations/20181211152717_0.4.1.js index 7d83715..d018ff4 100644 --- a/migrations/20181211152717_0.4.1.js +++ b/migrations/20181211152717_0.4.1.js @@ -1,16 +1,12 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('ARECIBOS', function(table) { - table.bigInteger('idCobrador').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('ARECIBOS', function(table) { + table.bigInteger('idCobrador').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('ARECIBOS', function(table) { - table.dropColumn('idCobrador'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('ARECIBOS', function(table) { + table.dropColumn('idCobrador'); + }); }; diff --git a/migrations/20181213153525_0.5.js b/migrations/20181213153525_0.5.js index bc5ca58..71f4887 100644 --- a/migrations/20181213153525_0.5.js +++ b/migrations/20181213153525_0.5.js @@ -1,65 +1,60 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('vehiculo', function(table) { - table.string('codigo'); - table.dropColumn('cisternado'); - }) - .createTable('cisterna', function(table) { - table.increments(); - table.string('codigo'); - table.decimal('capacidad', 12, 2); - table.bigInteger('idVehiculo').unsigned(); - table.bigInteger('idUnidadMedida').unsigned(); - table.bigInteger('idCarga').unsigned(); - }) - .createTable('cisterna_carga', function(table) { - table.increments(); - table.decimal('cantidad', 12, 2); - table.bigInteger('codigoArticulo').unsigned(); - table.bigInteger('codigoSectorArticulo').unsigned(); - }) - .createTable('cisterna_movimiento', function(table) { - table.increments(); - table.dateTime('fecha'); - table.decimal('cantidad', 12, 2); - table.string('metodo'); - table.bigInteger('idCisternaCarga').unsigned(); - }) - .createTable('hoja_ruta_movimiento', function(table) { - table.increments(); - table.string('reciboDescarga'); - table.bigInteger('idRemito').unsigned(); - table.bigInteger('idCisternaMovimiento').unsigned(); - table.bigInteger('idSeguimiento').unsigned(); - }) - .table('nota_pedido', function(table) { - table.bigInteger('idSeguimiento').unsigned(); - }) - .table('hoja_ruta', function(table) { - table.bigInteger('idSeguimiento').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema + .table('vehiculo', function(table) { + table.string('codigo'); + table.dropColumn('cisternado'); + }) + .createTable('cisterna', function(table) { + table.increments(); + table.string('codigo'); + table.decimal('capacidad', 12, 2); + table.bigInteger('idVehiculo').unsigned(); + table.bigInteger('idUnidadMedida').unsigned(); + table.bigInteger('idCarga').unsigned(); + }) + .createTable('cisterna_carga', function(table) { + table.increments(); + table.decimal('cantidad', 12, 2); + table.bigInteger('codigoArticulo').unsigned(); + table.bigInteger('codigoSectorArticulo').unsigned(); + }) + .createTable('cisterna_movimiento', function(table) { + table.increments(); + table.dateTime('fecha'); + table.decimal('cantidad', 12, 2); + table.string('metodo'); + table.bigInteger('idCisternaCarga').unsigned(); + }) + .createTable('hoja_ruta_movimiento', function(table) { + table.increments(); + table.string('reciboDescarga'); + table.bigInteger('idRemito').unsigned(); + table.bigInteger('idCisternaMovimiento').unsigned(); + table.bigInteger('idSeguimiento').unsigned(); + }) + .table('nota_pedido', function(table) { + table.bigInteger('idSeguimiento').unsigned(); + }) + .table('hoja_ruta', function(table) { + table.bigInteger('idSeguimiento').unsigned(); + }) }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('vehiculo', function(table) { - table.string('cisternado'); - table.dropColumn('codigo'); - }) - .table('nota_pedido', function(table) { - table.dropColumn('idSeguimiento'); - }) - .table('hoja_ruta', function(table) { - table.dropColumn('idSeguimiento'); - }) - .dropTable('cisterna') - .dropTable('cisterna_carga') - .dropTable('cisterna_movimiento') - .dropTable('hoja_ruta_movimiento') - - ]); +exports.down = function(knex) { + return knex.schema + .table('vehiculo', function(table) { + table.string('cisternado'); + table.dropColumn('codigo'); + }) + .table('nota_pedido', function(table) { + table.dropColumn('idSeguimiento'); + }) + .table('hoja_ruta', function(table) { + table.dropColumn('idSeguimiento'); + }) + .dropTable('cisterna') + .dropTable('cisterna_carga') + .dropTable('cisterna_movimiento') + .dropTable('hoja_ruta_movimiento') }; diff --git a/migrations/20181217131259_v0.6.js b/migrations/20181217131259_v0.6.js index ab1a5ef..6adfde7 100644 --- a/migrations/20181217131259_v0.6.js +++ b/migrations/20181217131259_v0.6.js @@ -1,24 +1,20 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .raw("ALTER TABLE ARTICULOS ADD id INT IDENTITY(1,1)") - .table('cisterna_carga', function(table) { - table.dropColumn('codigoArticulo'); - table.dropColumn('codigoSectorArticulo'); - table.bigInteger('idProducto').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema + .raw("ALTER TABLE ARTICULOS ADD id INT IDENTITY(1,1)") + .table('cisterna_carga', function(table) { + table.dropColumn('codigoArticulo'); + table.dropColumn('codigoSectorArticulo'); + table.bigInteger('idProducto').unsigned(); + }) }; exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('ARTICULOS', function(table) { - table.dropColumn('id'); - }).table('cisterna_carga', function(table) { - table.dropColumn('idProducto'); - table.bigInteger('codigoArticulo').unsigned(); - table.bigInteger('codigoSectorArticulo').unsigned(); - }) - ]); + return knex.schema + .table('ARTICULOS', function(table) { + table.dropColumn('id'); + }).table('cisterna_carga', function(table) { + table.dropColumn('idProducto'); + table.bigInteger('codigoArticulo').unsigned(); + table.bigInteger('codigoSectorArticulo').unsigned(); + }); }; diff --git a/migrations/20181217172010_v0.5.1.js b/migrations/20181217172010_v0.5.1.js index d7a481d..66cb9f9 100644 --- a/migrations/20181217172010_v0.5.1.js +++ b/migrations/20181217172010_v0.5.1.js @@ -1,15 +1,11 @@ exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('cisterna', function(table) { - table.boolean('desactivado'); - }) - ]) + return knex.schema.table('cisterna', function(table) { + table.boolean('desactivado'); + }); }; exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('cisterna', function(table) { - table.dropColumn('desactivado'); - }) - ]) + return knex.schema.table('cisterna', function(table) { + table.dropColumn('desactivado'); + }); }; diff --git a/migrations/20181218155954_0.6.1.js b/migrations/20181218155954_0.6.1.js index d72ea39..5fa96ef 100644 --- a/migrations/20181218155954_0.6.1.js +++ b/migrations/20181218155954_0.6.1.js @@ -1,19 +1,15 @@ exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .raw("ALTER TABLE ARECIBOS ADD id INT IDENTITY(1,1)") - .table('ARECIBOS', function(table) { - table.bigInteger('idSeguimiento').unsigned(); - }) - ]); + return knex.schema + .raw("ALTER TABLE ARECIBOS ADD id INT IDENTITY(1,1)") + .table('ARECIBOS', function(table) { + table.bigInteger('idSeguimiento').unsigned(); + }); }; exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('ARECIBOS', function(table) { - table.dropColumn('id'); - table.dropColumn('idSeguimiento'); - }) - ]); + return knex.schema + .table('ARECIBOS', function(table) { + table.dropColumn('id'); + table.dropColumn('idSeguimiento'); + }); }; diff --git a/migrations/20181221125659_0.6.2.js b/migrations/20181221125659_0.6.2.js index 7ace886..ec8ae3d 100644 --- a/migrations/20181221125659_0.6.2.js +++ b/migrations/20181221125659_0.6.2.js @@ -1,16 +1,15 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('precios_condiciones', function(table) { +exports.up = function(knex) { + return knex.schema + .table('precios_condiciones', function(table) { table.dropColumn('idListaPrecio') - }).raw("ALTER TABLE precios_condiciones ADD idListaPrecio char(4)") - ]) + }) + .raw("ALTER TABLE precios_condiciones ADD idListaPrecio char(4)"); + }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('precios_condiciones', function(table) { - table.dropColumn('idListaPrecio') - }) - ]); +exports.down = function(knex) { + return knex.schema.table('precios_condiciones', function(table) { + table.dropColumn('idListaPrecio') + }); }; diff --git a/migrations/20181221173513_v0.6.3.js b/migrations/20181221173513_v0.6.3.js index 4c89d4b..5695996 100644 --- a/migrations/20181221173513_v0.6.3.js +++ b/migrations/20181221173513_v0.6.3.js @@ -1,15 +1,11 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('articulo_nota_pedido', function(table) { - table.bigint('idArticulo').unsigned(); - }) - ]) +exports.up = function(knex) { + return knex.schema.table('articulo_nota_pedido', function(table) { + table.bigint('idArticulo').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('articulo_nota_pedido', function(table) { - table.dropColumn('idArticulo'); - }) - ]) +exports.down = function(knex) { + return knex.schema.table('articulo_nota_pedido', function(table) { + table.dropColumn('idArticulo'); + }); }; diff --git a/migrations/20181226120323_v0.6.4.js b/migrations/20181226120323_v0.6.4.js index 1e52b35..1405d1e 100644 --- a/migrations/20181226120323_v0.6.4.js +++ b/migrations/20181226120323_v0.6.4.js @@ -1,15 +1,11 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('articulo_remito', function(table) { - table.bigint('idArticulo').unsigned(); - }) - ]) +exports.up = function(knex) { + return knex.schema.table('articulo_remito', function(table) { + table.bigint('idArticulo').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('articulo_remito', function(table) { - table.dropColumn('idArticulo'); - }) - ]) +exports.down = function(knex) { + return knex.schema.table('articulo_remito', function(table) { + table.dropColumn('idArticulo'); + }); }; diff --git a/migrations/20181227171744_v0.6.5.js b/migrations/20181227171744_v0.6.5.js index dc55bd3..047aa14 100644 --- a/migrations/20181227171744_v0.6.5.js +++ b/migrations/20181227171744_v0.6.5.js @@ -1,25 +1,21 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('cisterna_movimiento', function(table) { - table.bigint('idRemito').unsigned(); - }).table('remito', function(table) { - table.bigint('idUsuarioProceso').unsigned(); - }).table('vehiculo', function(table) { - table.bigint('idUsuarioProceso').unsigned(); - }) - ]) +exports.up = function(knex) { + return knex.schema + .table('cisterna_movimiento', function(table) { + table.bigint('idRemito').unsigned(); + }).table('remito', function(table) { + table.bigint('idUsuarioProceso').unsigned(); + }).table('vehiculo', function(table) { + table.bigint('idUsuarioProceso').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('cisterna_movimiento', function(table) { - table.dropColumn('idRemito'); - }).table('remito', function(table) { - table.dropColumn('idUsuarioProceso'); - }).table('vehiculo', function(table) { - table.dropColumn('idUsuarioProceso'); - }) - ]) +exports.down = function(knex) { + return knex.schema + .table('cisterna_movimiento', function(table) { + table.dropColumn('idRemito'); + }).table('remito', function(table) { + table.dropColumn('idUsuarioProceso'); + }).table('vehiculo', function(table) { + table.dropColumn('idUsuarioProceso'); + }); }; diff --git a/migrations/20181231114424_v0.6.6.js b/migrations/20181231114424_v0.6.6.js index db69a1b..97fb98e 100644 --- a/migrations/20181231114424_v0.6.6.js +++ b/migrations/20181231114424_v0.6.6.js @@ -1,36 +1,32 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .createTable('a_punto_descarga', function(table) { - table.increments(); - table.bigInteger('id_cliente'); - table.bigInteger('id_da_config_0'); - table.string('descripcion'); - table.string('latitud'); - table.string('longitud'); - table.boolean('desactivado'); - }) - .table('CLIENTES', function(table) { - table.boolean('ES_PROS'); - }) - .createTable('nota_pedido_punto_descarga', function(table) { - table.increments(); - table.bigInteger('idPuntoDescarga').unsigned(); - table.bigInteger('idNotaPedido').unsigned(); - table.bigInteger('idProducto').unsigned(); - table.decimal('cantidad', 12, 2); - }) - ]); +exports.up = function(knex) { + return knex.schema + .createTable('a_punto_descarga', function(table) { + table.increments(); + table.bigInteger('id_cliente'); + table.bigInteger('id_da_config_0'); + table.string('descripcion'); + table.string('latitud'); + table.string('longitud'); + table.boolean('desactivado'); + }) + .table('CLIENTES', function(table) { + table.boolean('ES_PROS'); + }) + .createTable('nota_pedido_punto_descarga', function(table) { + table.increments(); + table.bigInteger('idPuntoDescarga').unsigned(); + table.bigInteger('idNotaPedido').unsigned(); + table.bigInteger('idProducto').unsigned(); + table.decimal('cantidad', 12, 2); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .dropTable('a_punto_descarga') - .table('CLIENTES', function(table) { - table.dropColumn('ES_PROS'); - }) - .dropTable('nota_pedido_punto_descarga') - ]); +exports.down = function(knex) { + return knex.schema + .dropTable('a_punto_descarga') + .table('CLIENTES', function(table) { + table.dropColumn('ES_PROS'); + }) + .dropTable('nota_pedido_punto_descarga'); }; diff --git a/migrations/20190102160859_v0.6.7.js b/migrations/20190102160859_v0.6.7.js index 3c925d9..a963e50 100644 --- a/migrations/20190102160859_v0.6.7.js +++ b/migrations/20190102160859_v0.6.7.js @@ -1,15 +1,11 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('cisterna_movimiento', function(table) { - table.boolean('anulado'); - }) - ]) +exports.up = function(knex) { + return knex.schema.table('cisterna_movimiento', function(table) { + table.boolean('anulado'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('cisterna_movimiento', function(table) { - table.dropColumn('anulado'); - }) - ]) +exports.down = function(knex) { + return knex.schema.table('cisterna_movimiento', function(table) { + table.dropColumn('anulado'); + }); }; diff --git a/migrations/20190107163621_v0.6.8.js b/migrations/20190107163621_v0.6.8.js index 3fed659..64e4bac 100644 --- a/migrations/20190107163621_v0.6.8.js +++ b/migrations/20190107163621_v0.6.8.js @@ -1,16 +1,12 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('VENDEDORES', function(table) { - table.boolean('ES_COBRADOR'); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('VENDEDORES', function(table) { + table.boolean('ES_COBRADOR'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('VENDEDORES', function(table) { - table.dropColumn('ES_COBRADOR'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('VENDEDORES', function(table) { + table.dropColumn('ES_COBRADOR'); + }); }; diff --git a/migrations/20190108114746_v0.6.9.js b/migrations/20190108114746_v0.6.9.js index 7bc2d8f..906fad0 100644 --- a/migrations/20190108114746_v0.6.9.js +++ b/migrations/20190108114746_v0.6.9.js @@ -1,26 +1,22 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('cisterna', function(table) { - table.dropColumn('idCarga'); - }) - .table('cisterna_carga', function(table) { - table.bigInteger('idCisterna').unsigned(); - table.date('fechaReparto'); - }) - ]) +exports.up = function(knex) { + return knex.schema + .table('cisterna', function(table) { + table.dropColumn('idCarga'); + }) + .table('cisterna_carga', function(table) { + table.bigInteger('idCisterna').unsigned(); + table.date('fechaReparto'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('cisterna', function(table) { - table.bigInteger('idCarga'); - }) - .table('cisterna_carga', function(table) { - table - .dropColumn('idCisterna') - .dropColumn('fechaReparto'); - }) - ]) +exports.down = function(knex) { + return knex.schema + .table('cisterna', function(table) { + table.bigInteger('idCarga'); + }) + .table('cisterna_carga', function(table) { + table + .dropColumn('idCisterna') + .dropColumn('fechaReparto'); + }); }; diff --git a/migrations/20190109123406_v0.6.10.js b/migrations/20190109123406_v0.6.10.js index 7b23dd7..41c5657 100644 --- a/migrations/20190109123406_v0.6.10.js +++ b/migrations/20190109123406_v0.6.10.js @@ -1,16 +1,12 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('VENDEDORES', function(table) { - table.boolean('desactivado'); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('VENDEDORES', function(table) { + table.boolean('desactivado'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('VENDEDORES', function(table) { - table.dropColumn('desactivado'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('VENDEDORES', function(table) { + table.dropColumn('desactivado'); + }); }; diff --git a/migrations/20190109123752_v0.6.11.js b/migrations/20190109123752_v0.6.11.js index 8d34945..219492a 100644 --- a/migrations/20190109123752_v0.6.11.js +++ b/migrations/20190109123752_v0.6.11.js @@ -1,7 +1,7 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.createTable('login', function(table) { +exports.up = function(knex) { + return knex.schema + .createTable('login', function(table) { table.increments(); table.string('username'); table.string('password'); @@ -10,19 +10,16 @@ exports.up = function(knex, Promise) { table.bigInteger('idLogin').unsigned(); }).table('chofer', function(table) { table.bigInteger('idLogin').unsigned(); - }) - ]); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .dropTable('login') - .table('vendedores', function(table) { - table.dropColumn('idLogin'); - }) - .table('chofer', function(table) { - table.dropColumn('idLogin'); - }) - ]); +exports.down = function(knex) { + return knex.schema + .dropTable('login') + .table('vendedores', function(table) { + table.dropColumn('idLogin'); + }) + .table('chofer', function(table) { + table.dropColumn('idLogin'); + }); }; diff --git a/migrations/20190110100715_v0.6.12.js b/migrations/20190110100715_v0.6.12.js index ccc6147..ce64d4a 100644 --- a/migrations/20190110100715_v0.6.12.js +++ b/migrations/20190110100715_v0.6.12.js @@ -1,24 +1,20 @@ exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('vehiculo', function(table) { - table.dropColumn('idUsuarioProceso'); - }) - .table('cisterna_carga', function(table) { - table.bigInteger('idUsuarioProceso'); - table.boolean('confirmado'); - }) - ]) + return knex.schema + .table('vehiculo', function(table) { + table.dropColumn('idUsuarioProceso'); + }) + .table('cisterna_carga', function(table) { + table.bigInteger('idUsuarioProceso'); + table.boolean('confirmado'); + }); }; exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('vehiculo', function(table) { - table.bigint('idUsuarioProceso').unsigned(); - }) - .table('cisterna_carga', function(table) { - table.dropColumns('idUsuarioProceso', 'confirmado'); - }) - ]) + return knex.schema + .table('vehiculo', function(table) { + table.bigint('idUsuarioProceso').unsigned(); + }) + .table('cisterna_carga', function(table) { + table.dropColumns('idUsuarioProceso', 'confirmado'); + }); }; diff --git a/migrations/20190110152626_v0.6.13.js b/migrations/20190110152626_v0.6.13.js index da8b2db..852ffa1 100644 --- a/migrations/20190110152626_v0.6.13.js +++ b/migrations/20190110152626_v0.6.13.js @@ -1,16 +1,14 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('login', function(table) { +exports.up = function(knex) { + return knex.schema + .table('login', function(table) { table.dateTime('ultimoLogin'); table.string('token'); - }) - ]) + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('login', function(table) { +exports.down = function(knex) { + return knex.schema + .table('login', function(table) { table.dropColumns('ultimoLogin', 'token'); - }) - ]); + }); }; diff --git a/migrations/20190114160629_v0.6.14.js b/migrations/20190114160629_v0.6.14.js index 4ea78b7..22fbef8 100644 --- a/migrations/20190114160629_v0.6.14.js +++ b/migrations/20190114160629_v0.6.14.js @@ -1,19 +1,15 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('hoja_ruta', function(table) { - //0=disponible 1=asignado 2=terminado - table.integer('estado').unsigned(); - table.date('fechaReparto'); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('hoja_ruta', function(table) { + //0=disponible 1=asignado 2=terminado + table.integer('estado').unsigned(); + table.date('fechaReparto'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('hoja_ruta', function(table) { - table.dropColumn('estado'); - table.dropColumn('fechaReparto'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('hoja_ruta', function(table) { + table.dropColumn('estado'); + table.dropColumn('fechaReparto'); + }) }; diff --git a/migrations/20190118161051_v0.6.15.js b/migrations/20190118161051_v0.6.15.js index 27c4918..f833b71 100644 --- a/migrations/20190118161051_v0.6.15.js +++ b/migrations/20190118161051_v0.6.15.js @@ -1,17 +1,13 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.createTable('tipo_documento', function(table) { - table.integer('id').unsigned().primary(); - table.string('descripcion'); - table.string('orden'); - table.boolean('activo'); - }) - ]) +exports.up = function(knex) { + return knex.schema.createTable('tipo_documento', function(table) { + table.integer('id').unsigned().primary(); + table.string('descripcion'); + table.string('orden'); + table.boolean('activo'); + }); }; exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.dropTable('tipo_documento') - ]); + return knex.schema.dropTable('tipo_documento'); }; diff --git a/migrations/20190121125737_v0.6.16.js b/migrations/20190121125737_v0.6.16.js index 20e20ff..48c99f2 100644 --- a/migrations/20190121125737_v0.6.16.js +++ b/migrations/20190121125737_v0.6.16.js @@ -1,22 +1,18 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('articulo_remito', function(table) { - table.integer('cantidadDescargada'); - }).table('remito', function(table) { - table.boolean('rechazado'); - table.string('motivoRechazo'); - }) - ]) +exports.up = function(knex) { + return knex.schema + .table('articulo_remito', function(table) { + table.integer('cantidadDescargada'); + }).table('remito', function(table) { + table.boolean('rechazado'); + table.string('motivoRechazo'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('articulo_remito', function(table) { - table.dropColumn('cantidadDescargada'); - }).table('remito', function(table) { - table.dropColumns('rechazado', 'motivoRechazo'); - }) - ]) +exports.down = function(knex) { + return knex.schema + .table('articulo_remito', function(table) { + table.dropColumn('cantidadDescargada'); + }).table('remito', function(table) { + table.dropColumns('rechazado', 'motivoRechazo'); + }); }; diff --git a/migrations/20190122165422_v0.6.17.js b/migrations/20190122165422_v0.6.17.js index 900103f..8a999ab 100644 --- a/migrations/20190122165422_v0.6.17.js +++ b/migrations/20190122165422_v0.6.17.js @@ -1,35 +1,31 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('hoja_ruta', function(table) { - table.decimal('kmInicialVehiculo', 18, 4); - table.decimal('kmFinalVehiculo', 18, 4) - table.decimal('aforadorInicialVehiculo', 18, 4); - table.decimal('aforadorFinalVehiculo', 18, 4) - table.decimal('cantidadDescargaPorGravedad', 18, 4); - table.decimal('litrosDescargadosPorGravedad', 18, 4); - table.decimal('litrosCombustibleParaMovilidad', 18, 4); - table.string('precintoBocaUno'); - table.string('precintoBocaDos'); - table.string('precintoBocaTres'); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('hoja_ruta', function(table) { + table.decimal('kmInicialVehiculo', 18, 4); + table.decimal('kmFinalVehiculo', 18, 4) + table.decimal('aforadorInicialVehiculo', 18, 4); + table.decimal('aforadorFinalVehiculo', 18, 4) + table.decimal('cantidadDescargaPorGravedad', 18, 4); + table.decimal('litrosDescargadosPorGravedad', 18, 4); + table.decimal('litrosCombustibleParaMovilidad', 18, 4); + table.string('precintoBocaUno'); + table.string('precintoBocaDos'); + table.string('precintoBocaTres'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('hoja_ruta', function(table) { - table.dropColumns( - 'kmInicialVehiculo', - 'kmFinalVehiculo', - 'aforadorInicialVehiculo', - 'aforadorFinalVehiculo', - 'cantidadDescargaPorGravedad', - 'litrosDescargadosPorGravedad', - 'litrosCombustibleParaMovilidad', - 'precintoBocaUno', - 'precintoBocaDos', - 'precintoBocaTres' - ); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('hoja_ruta', function(table) { + table.dropColumns( + 'kmInicialVehiculo', + 'kmFinalVehiculo', + 'aforadorInicialVehiculo', + 'aforadorFinalVehiculo', + 'cantidadDescargaPorGravedad', + 'litrosDescargadosPorGravedad', + 'litrosCombustibleParaMovilidad', + 'precintoBocaUno', + 'precintoBocaDos', + 'precintoBocaTres' + ); + }); }; diff --git a/migrations/20190125093429_v0.6.18.js b/migrations/20190125093429_v0.6.18.js index ccd78a7..074e3b5 100644 --- a/migrations/20190125093429_v0.6.18.js +++ b/migrations/20190125093429_v0.6.18.js @@ -1,16 +1,12 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('chofer', function(table) { - table.bigInteger('idTipoDocumento').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('chofer', function(table) { + table.bigInteger('idTipoDocumento').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('chofer', function(table) { - table.dropColumn('idTipoDocumento'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('chofer', function(table) { + table.dropColumn('idTipoDocumento'); + }); }; diff --git a/migrations/20190125102735_v0.6.19.js b/migrations/20190125102735_v0.6.19.js index 35a66f0..2ff3b96 100644 --- a/migrations/20190125102735_v0.6.19.js +++ b/migrations/20190125102735_v0.6.19.js @@ -1,26 +1,22 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('VENDEDORES', function(table) { - //Puede ser 1=vendedor, 2=cobrador, 3=ambos - table.integer('rol'); - table.decimal('comisionCobrador', 12, 2); - }) - .table('CLIENTES', function(table) { - table.bigInteger('idCobrador').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema + .table('VENDEDORES', function(table) { + //Puede ser 1=vendedor, 2=cobrador, 3=ambos + table.integer('rol'); + table.decimal('comisionCobrador', 12, 2); + }) + .table('CLIENTES', function(table) { + table.bigInteger('idCobrador').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('VENDEDORES', function(table) { - table.dropColumns('rol', 'comisionCobrador'); - }) - .table('CLIENTES', function(table) { - table.dropColumn('idCobrador'); - }) - ]); +exports.down = function(knex) { + return knex.schema + .table('VENDEDORES', function(table) { + table.dropColumns('rol', 'comisionCobrador'); + }) + .table('CLIENTES', function(table) { + table.dropColumn('idCobrador'); + }); }; diff --git a/migrations/20190131161852_v0.6.20.js b/migrations/20190131161852_v0.6.20.js index 89da68d..9ee2f48 100644 --- a/migrations/20190131161852_v0.6.20.js +++ b/migrations/20190131161852_v0.6.20.js @@ -1,18 +1,14 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .raw("ALTER TABLE ADETREC ADD id INT IDENTITY(1,1)") - .table('ADETREC', function(table) { - table.bigInteger('idArecibos'); - }) - ]); +exports.up = function(knex) { + return knex.schema + .raw("ALTER TABLE ADETREC ADD id INT IDENTITY(1,1)") + .table('ADETREC', function(table) { + table.bigInteger('idArecibos'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('ADETREC', function(table) { - table.dropColumns('id', 'idArecibos'); - }) - ]); +exports.down = function(knex) { + return knex.schema + .table('ADETREC', function(table) { + table.dropColumns('id', 'idArecibos'); + }); }; diff --git a/migrations/20190207113109_v0.7.0.js b/migrations/20190207113109_v0.7.0.js index 7ea0143..2c5ee78 100644 --- a/migrations/20190207113109_v0.7.0.js +++ b/migrations/20190207113109_v0.7.0.js @@ -1,11 +1,7 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.raw('UPDATE VENDEDORES SET desactivado = 0, rol = 1') - ]); +exports.up = function(knex) { + return knex.schema.raw('UPDATE VENDEDORES SET desactivado = 0, rol = 1'); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.raw('UPDATE VENDEDORES SET desactivado = null, rol = null') - ]); +exports.down = function(knex) { + return knex.schema.raw('UPDATE VENDEDORES SET desactivado = null, rol = null'); }; diff --git a/migrations/20190208131322_0.7.1.js b/migrations/20190208131322_0.7.1.js index 8acb7f3..4b975ee 100644 --- a/migrations/20190208131322_0.7.1.js +++ b/migrations/20190208131322_0.7.1.js @@ -1,4 +1,4 @@ -exports.up = function(knex, Promise) { +exports.up = function(knex) { return knex.schema.table('AVENDCLI', function(table) { table.string('domicilio'); table.bigInteger('idLocalidad').unsigned(); diff --git a/migrations/20190212103514_v0.7.2.js b/migrations/20190212103514_v0.7.2.js index cf5c242..3710254 100644 --- a/migrations/20190212103514_v0.7.2.js +++ b/migrations/20190212103514_v0.7.2.js @@ -1,17 +1,13 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.table('seguimiento', function(table) { - //KM RECORRIDOS DESDE EL PUNTO ANTERIOR O DESDE LA EMPRESA - table.decimal('kmRecorridos', 18, 4); - }) - ]); +exports.up = function(knex) { + return knex.schema.table('seguimiento', function(table) { + //KM RECORRIDOS DESDE EL PUNTO ANTERIOR O DESDE LA EMPRESA + table.decimal('kmRecorridos', 18, 4); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('seguimiento', function(table) { - table.dropColumn('kmRecorridos'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('seguimiento', function(table) { + table.dropColumn('kmRecorridos'); + }); }; diff --git a/migrations/20190215123700_v0.7.3.js b/migrations/20190215123700_v0.7.3.js index 58357cf..3230f97 100644 --- a/migrations/20190215123700_v0.7.3.js +++ b/migrations/20190215123700_v0.7.3.js @@ -1,24 +1,20 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('nota_pedido', function(table) { - table.string('observaciones'); - }) - .table('remito', function(table) { - table.string('observaciones'); - }) - ]); +exports.up = function(knex) { + return knex.schema + .table('nota_pedido', function(table) { + table.string('observaciones'); + }) + .table('remito', function(table) { + table.string('observaciones'); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('nota_pedido', function(table) { - table.dropColumn('observaciones'); - }) - .table('remito', function(table) { - table.dropColumn('observaciones'); - }) - ]); +exports.down = function(knex) { + return knex.schema + .table('nota_pedido', function(table) { + table.dropColumn('observaciones'); + }) + .table('remito', function(table) { + table.dropColumn('observaciones'); + }); }; diff --git a/migrations/20190220100315_v0.7.4.js b/migrations/20190220100315_v0.7.4.js index e4ba9c5..fa9d43d 100644 --- a/migrations/20190220100315_v0.7.4.js +++ b/migrations/20190220100315_v0.7.4.js @@ -1,6 +1,5 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.raw( +exports.up = function(knex) { + return knex.schema.raw( "if not exists (SELECT * FROM dbo.sysobjects where id = object_id("+ "N'dbo.[ACOBYPAG_VENCIMIENTOS]') and OBJECTPROPERTY(id, N'IsTable') = 1) begin "+ "CREATE TABLE ACOBYPAG_VENCIMIENTOS(" + @@ -129,14 +128,12 @@ exports.up = function(knex, Promise) { "INNER JOIN ACOBYPAG B ON A.CYV = B.CYV AND A.TIP=B.TIP AND A.TCO=B.TCO AND A.SUC=B.SUC AND A.NCO=B.NCO " + "INNER JOIN AMAEFACT C ON A.CYV = C.CYV AND A.TIP=C.TIP AND A.TCO=C.TCO AND A.SUC=C.SUC AND A.NCO=C.NCO" + " ')" - ) - ]) + ); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.dropTable('ACOBYPAG_VENCIMIENTOS') - .raw("DROP VIEW [VI_ACOBYPAG_AMAEFACT]") - .raw("DROP VIEW [VI_ACOBYPAG_VENCIMIENTOS]") - ]) +exports.down = function(knex) { + return knex.schema + .dropTable('ACOBYPAG_VENCIMIENTOS') + .raw("DROP VIEW [VI_ACOBYPAG_AMAEFACT]") + .raw("DROP VIEW [VI_ACOBYPAG_VENCIMIENTOS]"); }; diff --git a/migrations/20190220121752_v0.7.5.js b/migrations/20190220121752_v0.7.5.js index 150b953..8809446 100644 --- a/migrations/20190220121752_v0.7.5.js +++ b/migrations/20190220121752_v0.7.5.js @@ -1,17 +1,12 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.createTable('adetrec_observaciones', function(table) { +exports.up = function(knex) { + return knex.schema.createTable('adetrec_observaciones', function(table) { table.increments(); table.string('observacion'); table.bigInteger('idAdetrec').unsigned(); - }) - ]); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .dropTable('adetrec_observaciones') - ]); +exports.down = function(knex) { + return knex.schema.dropTable('adetrec_observaciones'); }; diff --git a/migrations/20190221092657_v0.7.6.js b/migrations/20190221092657_v0.7.6.js index a89015e..3f0232e 100644 --- a/migrations/20190221092657_v0.7.6.js +++ b/migrations/20190221092657_v0.7.6.js @@ -1,24 +1,20 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('seguimiento', function(table) { - table.bigInteger('idVisita').unsigned(); - }) - .createTable('visita', function(table) { - table.increments(); - table.bigInteger('idCliente').unsigned(); - table.bigInteger('idVisitante').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema + .table('seguimiento', function(table) { + table.bigInteger('idVisita').unsigned(); + }) + .createTable('visita', function(table) { + table.increments(); + table.bigInteger('idCliente').unsigned(); + table.bigInteger('idVisitante').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('seguimiento', function(table) { - table.dropColumn('idVisita'); - }) - .dropTable('visita') - ]); +exports.down = function(knex) { + return knex.schema + .table('seguimiento', function(table) { + table.dropColumn('idVisita'); + }) + .dropTable('visita'); }; diff --git a/migrations/20190225143232_v0.7.7.js b/migrations/20190225143232_v0.7.7.js index 5bcfef9..b107059 100644 --- a/migrations/20190225143232_v0.7.7.js +++ b/migrations/20190225143232_v0.7.7.js @@ -1,12 +1,12 @@ -exports.up = function(knex, Promise) { +exports.up = function(knex) { return knex.schema .table('seguimiento', function(table) { table.dropColumn('idUsuario'); }); }; -exports.down = function(knex, Promise) { +exports.down = function(knex) { return knex.schema .table('seguimiento', function(table) { table.bigInteger('idUsuario').unsigned(); diff --git a/migrations/20190228111345_v0.7.8.js b/migrations/20190228111345_v0.7.8.js index f36aa94..6a8bb38 100644 --- a/migrations/20190228111345_v0.7.8.js +++ b/migrations/20190228111345_v0.7.8.js @@ -34,6 +34,8 @@ exports.up = function(knex, Promise) { }; exports.down = function(knex, Promise) { + + //PARA HACER FUNCIONAR ESTE ROLLBACK HAY QUE ELIMINAR MANUALMENTE LAS COLUMNAS return knex.schema .table('articulo_nota_pedido', function(table) { table.dropColumns('netoUnitario', 'costoUnitario', 'exentoUnitario', diff --git a/migrations/20190311170816_v0.8.0.js b/migrations/20190311170816_v0.8.0.js index dc2a455..17993c3 100644 --- a/migrations/20190311170816_v0.8.0.js +++ b/migrations/20190311170816_v0.8.0.js @@ -1,23 +1,19 @@ const md5 = require('md5'); -exports.up = function(knex, Promise) { +exports.up = function(knex) { return knex.schema .table('APAREMP', function(table) { table.string('idEmpresa'); }).then(function() { - return Promise.all([ - knex('APAREMP').update({ idEmpresa: md5(new Date().getTime())}) - ]); + return knex('APAREMP').update({ idEmpresa: md5(new Date().getTime())}); }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.table('APAREMP', function(table) { - table.dropColumn('idEmpresa'); - }) - ]); +exports.down = function(knex) { + return knex.schema.table('APAREMP', function(table) { + table.dropColumn('idEmpresa'); + }); }; diff --git a/migrations/20190412094131_v0.9.0.js b/migrations/20190412094131_v0.9.0.js index 5b5dbb3..b87973b 100644 --- a/migrations/20190412094131_v0.9.0.js +++ b/migrations/20190412094131_v0.9.0.js @@ -1,18 +1,13 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .createTable('remito_punto_descarga', function(table) { - table.increments(); - table.bigInteger('idPuntoDescarga').unsigned(); - table.bigInteger('idRemito').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema + .createTable('remito_punto_descarga', function(table) { + table.increments(); + table.bigInteger('idPuntoDescarga').unsigned(); + table.bigInteger('idRemito').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .dropTable('remito_punto_descarga') - ]); +exports.down = function(knex) { + return knex.schema.dropTable('remito_punto_descarga'); }; diff --git a/migrations/20190425163004_v0.9.1.js b/migrations/20190425163004_v0.9.1.js index b939ea8..ea9cb62 100644 --- a/migrations/20190425163004_v0.9.1.js +++ b/migrations/20190425163004_v0.9.1.js @@ -1,17 +1,13 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema.createTable('parametros', function(table) { - table.increments(); - table.string('modulo'); - table.string('jsonText', [4000]); - table.string('jsonText2', [4000]); - }) - ]); +exports.up = function(knex) { + return knex.schema.createTable('parametros', function(table) { + table.increments(); + table.string('modulo'); + table.string('jsonText', [4000]); + table.string('jsonText2', [4000]); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema.dropTable('parametros') - ]); +exports.down = function(knex) { + return knex.schema.dropTable('parametros'); }; diff --git a/migrations/20190524103556_v0.10.0.js b/migrations/20190524103556_v0.10.0.js index 8267579..9edb4e9 100644 --- a/migrations/20190524103556_v0.10.0.js +++ b/migrations/20190524103556_v0.10.0.js @@ -1,37 +1,33 @@ -exports.up = function (knex, Promise) { - return Promise.all([ - knex.schema - .table('nota_pedido', function (table) { - table.bigInteger('idListaPrecio').unsigned(); - table.dropColumn('idPrecioCondicion'); - }) - .table('plazo_pago', function (table) { - table.bigInteger('idCliente').unsigned(); - table.dropColumn('idPreciosCondiciones'); +exports.up = function (knex) { + return knex.schema + .table('nota_pedido', function (table) { + table.bigInteger('idListaPrecio').unsigned(); + table.dropColumn('idPrecioCondicion'); + }) + .table('plazo_pago', function (table) { + table.bigInteger('idCliente').unsigned(); + table.dropColumn('idPreciosCondiciones'); - }) - .table('remito', function (table) { - table.bigInteger('idListaPrecio').unsigned(); - table.dropColumn('idPrecioCondicion'); - }) - ]); + }) + .table('remito', function (table) { + table.bigInteger('idListaPrecio').unsigned(); + table.dropColumn('idPrecioCondicion'); + }); }; exports.down = function (knex, Promise) { - return Promise.all([ - knex.schema - .table('nota_pedido', function (table) { - table.dropColumn('idListaPrecio'); - table.bigInteger('idPrecioCondicion').unsigned(); - }) - .table('plazo_pago', function (table) { - table.dropColumn('idCliente'); - table.bigInteger('idPreciosCondiciones').unsigned(); - }) - .table('remito', function (table) { - table.dropColumn('idListaPrecio'); - table.bigInteger('idPrecioCondicion').unsigned(); - }) - ]); + return knex.schema + .table('nota_pedido', function (table) { + table.dropColumn('idListaPrecio'); + table.bigInteger('idPrecioCondicion').unsigned(); + }) + .table('plazo_pago', function (table) { + table.dropColumn('idCliente'); + table.bigInteger('idPreciosCondiciones').unsigned(); + }) + .table('remito', function (table) { + table.dropColumn('idListaPrecio'); + table.bigInteger('idPrecioCondicion').unsigned(); + }); }; diff --git a/migrations/20190611150606_v0.11.0.js b/migrations/20190611150606_v0.11.0.js index 6c46fdb..d2de483 100644 --- a/migrations/20190611150606_v0.11.0.js +++ b/migrations/20190611150606_v0.11.0.js @@ -1,18 +1,14 @@ -exports.up = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('hoja_ruta', function (table) { - table.bigInteger('abierta').unsigned(); - }) - ]); +exports.up = function(knex) { + return knex.schema + .table('hoja_ruta', function (table) { + table.bigInteger('abierta').unsigned(); + }); }; -exports.down = function(knex, Promise) { - return Promise.all([ - knex.schema - .table('hoja_ruta', function (table) { - table.dropColumn('abierta'); - }) - ]); +exports.down = function(knex) { + return knex.schema + .table('hoja_ruta', function (table) { + table.dropColumn('abierta'); + }); }; diff --git a/package.json b/package.json index 58ff661..25e9af1 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,15 @@ "description": "Paquetes de migraciones", "main": "knexfile.js", "dependencies": { - "knex": "^0.18.2", + "bluebird": "^3.5.5", + "knex": "^0.18.3", + "md5": "^2.2.1", "mssql": "^5.1.0" }, "devDependencies": {}, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "init": "npm install -g knex && npm install && knex init" }, "repository": { "type": "git", -- 1.9.1