Commit 4e9c322c193e92c1ccebdbd7b04bc7f66e4568b9
1 parent
9c007cca2d
Exists in
master
no dependency Promise2
Showing
47 changed files
with
711 additions
and
866 deletions
Show diff stats
.gitignore
1 | /node_modules | 1 | /node_modules |
2 | /knexfile.js | 2 | /knexfile.js |
3 | /package-lock.json | ||
3 | /package-lock.json |
README.md
1 | #MIGRACIÓN DE SISTEMA BACKOFFICE MEDIANTE SCRIPTS | 1 | #MIGRACIÓN DE SISTEMA BACKOFFICE MEDIANTE SCRIPTS |
2 | 2 | ||
3 | Pasos a seguir instalación y primera migración: | 3 | Pasos a seguir instalación y primera migración: |
4 | 4 | ||
5 | - Una vez bajado el proyecto correr el siguiente comando en consola si es la primera ve(se debe tener instalado node): | 5 | - Una vez bajado el proyecto correr el siguiente comando en consola si es la primera ve(se debe tener instalado node): |
6 | > npm install -g knex && npm install && knex init | 6 | > npm run init |
7 | - Una vez ejecutado el comando se ha creado el archivo `knexfile.js`, configurar la base de datos deseada. | 7 | - Una vez ejecutado el comando se ha creado el archivo `knexfile.js`, configurar la base de datos deseada. |
8 | - En consola correr el comando | 8 | - En consola correr el comando |
9 | > knex migrate:latest --env nombreConfiguracion | 9 | > knex migrate:latest --env nombreConfiguracion |
10 | 10 |
migrations/20181123153918_v0.1.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.createTable('nota_pedido', function(table) { |
4 | knex.schema.createTable('nota_pedido', function(table) { | 4 | table.increments(); |
5 | table.increments(); | 5 | table.integer('bomba'); |
6 | table.integer('bomba'); | 6 | table.integer('cotizacion'); |
7 | table.integer('cotizacion'); | 7 | table.string('cuitCliente'); |
8 | table.string('cuitCliente'); | 8 | table.string('domicilioStamp'); |
9 | table.string('domicilioStamp'); | 9 | table.integer('estado'); |
10 | table.integer('estado'); | 10 | table.dateTime('fechaCarga'); |
11 | table.dateTime('fechaCarga'); | 11 | table.integer('flete'); |
12 | table.integer('flete'); | 12 | table.integer('fob'); |
13 | table.integer('fob'); | 13 | table.decimal('kilometros', 12, 2); |
14 | table.decimal('kilometros', 12, 2); | 14 | table.string('nombreCliente'); |
15 | table.string('nombreCliente'); | 15 | table.integer('numeroNotaPedido'); |
16 | table.integer('numeroNotaPedido'); | 16 | table.integer('responsabilidadIvaCliente'); |
17 | table.integer('responsabilidadIvaCliente'); | 17 | table.integer('sucursal'); |
18 | table.integer('sucursal'); | 18 | table.decimal('total', 12, 2); |
19 | table.decimal('total', 12, 2); | 19 | table.bigInteger('idCliente').unsigned(); |
20 | table.bigInteger('idCliente').unsigned(); | 20 | table.bigInteger('idCotizacion').unsigned(); |
21 | table.bigInteger('idCotizacion').unsigned(); | 21 | table.bigInteger('idDomicilio').unsigned(); |
22 | table.bigInteger('idDomicilio').unsigned(); | 22 | table.bigInteger('idPrecioCondicion').unsigned(); |
23 | table.bigInteger('idPrecioCondicion').unsigned(); | 23 | table.bigInteger('idProveedor').unsigned(); |
24 | table.bigInteger('idProveedor').unsigned(); | 24 | table.bigInteger('idRemito').unsigned(); |
25 | table.bigInteger('idRemito').unsigned(); | 25 | table.bigInteger('idVendedor').unsigned(); |
26 | table.bigInteger('idVendedor').unsigned(); | 26 | }).createTable('precios_condiciones', function(table) { |
27 | }).createTable('precios_condiciones', function(table) { | 27 | table.increments(); |
28 | table.increments(); | 28 | table.boolean('activo'); |
29 | table.boolean('activo'); | 29 | table.string('codigo'); |
30 | table.string('codigo'); | 30 | table.string('descripcion'); |
31 | table.string('descripcion'); | 31 | table.string('nombre'); |
32 | table.string('nombre'); | 32 | table.date('vigencia'); |
33 | table.date('vigencia'); | 33 | table.bigInteger('idListaPrecio').unsigned(); |
34 | table.bigInteger('idListaPrecio').unsigned(); | 34 | }).createTable('plazo_pago', function(table) { |
35 | }).createTable('plazo_pago', function(table) { | 35 | table.increments(); |
36 | table.increments(); | 36 | table.boolean('activo'); |
37 | table.boolean('activo'); | 37 | table.integer('dias'); |
38 | table.integer('dias'); | 38 | table.integer('item'); |
39 | table.integer('item'); | 39 | table.bigInteger('idPreciosCondiciones').unsigned(); |
40 | table.bigInteger('idPreciosCondiciones').unsigned(); | 40 | }).createTable('articulo_nota_pedido', function(table) { |
41 | }).createTable('articulo_nota_pedido', function(table) { | 41 | table.increments(); |
42 | table.increments(); | 42 | table.decimal('cantidad', 12, 2); |
43 | table.decimal('cantidad', 12, 2); | 43 | table.string('codigo'); |
44 | table.string('codigo'); | 44 | table.boolean('combustible'); |
45 | table.boolean('combustible'); | 45 | table.decimal('costoUnitario', 12, 2); |
46 | table.decimal('costoUnitario', 12, 2); | 46 | table.string('descripcion'); |
47 | table.string('descripcion'); | 47 | table.decimal('exentoUnitario', 12, 2); |
48 | table.decimal('exentoUnitario', 12, 2); | 48 | table.boolean('facturado'); |
49 | table.boolean('facturado'); | 49 | table.decimal('impuestoInternoUnitario', 12, 2); |
50 | table.decimal('impuestoInternoUnitario', 12, 2); | 50 | table.decimal('impuestoInterno1Unitario', 12, 2); |
51 | table.decimal('impuestoInterno1Unitario', 12, 2); | 51 | table.decimal('impuestoInterno2Unitario', 12, 2); |
52 | table.decimal('impuestoInterno2Unitario', 12, 2); | 52 | table.integer('item'); |
53 | table.integer('item'); | 53 | table.decimal('ivaUnitario', 12, 2); |
54 | table.decimal('ivaUnitario', 12, 2); | 54 | table.decimal('ivaServicioUnitario', 12, 2); |
55 | table.decimal('ivaServicioUnitario', 12, 2); | 55 | table.string('nombre'); |
56 | table.string('nombre'); | 56 | table.decimal('precio', 12, 4); |
57 | table.decimal('precio', 12, 4); | 57 | table.decimal('precioLista', 12, 2); |
58 | table.decimal('precioLista', 12, 2); | 58 | table.integer('sector'); |
59 | table.integer('sector'); | 59 | table.integer('rubro'); |
60 | table.integer('rubro'); | 60 | table.decimal('tasaIva', 12, 2); |
61 | table.decimal('tasaIva', 12, 2); | 61 | table.bigInteger('idNotaPedido').unsigned(); |
62 | table.bigInteger('idNotaPedido').unsigned(); | 62 | }).createTable('boton', function(table) { |
63 | }).createTable('boton', function(table) { | 63 | table.increments(); |
64 | table.increments(); | 64 | table.string('accion'); |
65 | table.string('accion'); | 65 | table.string('app'); |
66 | table.string('app'); | 66 | table.string('clase'); |
67 | table.string('clase'); | 67 | table.string('texto'); |
68 | table.string('texto'); | 68 | }).createTable('chofer', function(table) { |
69 | }).createTable('chofer', function(table) { | 69 | table.increments(); |
70 | table.increments(); | 70 | table.string('dni'); |
71 | table.string('dni'); | 71 | table.string('nombre'); |
72 | table.string('nombre'); | 72 | table.string('telefono'); |
73 | table.string('telefono'); | 73 | table.bigInteger('idTransportista').unsigned(); |
74 | table.bigInteger('idTransportista').unsigned(); | 74 | }).createTable('vehiculo', function(table) { |
75 | }).createTable('vehiculo', function(table) { | 75 | table.increments(); |
76 | table.increments(); | 76 | table.string('capacidad'); |
77 | table.string('capacidad'); | 77 | table.string('cisternado'); |
78 | table.string('cisternado'); | 78 | table.string('semi'); |
79 | table.string('semi'); | 79 | table.string('tractor'); |
80 | table.string('tractor'); | 80 | table.bigInteger('idTransportista').unsigned(); |
81 | table.bigInteger('idTransportista').unsigned(); | 81 | // TODO: Revisar si en los seeds no inserta por ser nombres de campo demasiado largos. |
82 | // TODO: Revisar si en los seeds no inserta por ser nombres de campo demasiado largos. | 82 | // table.string('seguimientoSatelitalUrl'); |
83 | // table.string('seguimientoSatelitalUrl'); | 83 | // table.string('seguimientoSatelitalUsuario'); |
84 | // table.string('seguimientoSatelitalUsuario'); | 84 | // table.string('seguimientoSatelitalClave'); |
85 | // table.string('seguimientoSatelitalClave'); | 85 | }).createTable('nota-pedido-plazo', function(table) { |
86 | }).createTable('nota-pedido-plazo', function(table) { | 86 | table.increments(); |
87 | table.increments(); | 87 | table.integer('dias').unsigned(); |
88 | table.integer('dias').unsigned(); | 88 | table.bigInteger('idNotaPedido').unsigned(); |
89 | table.bigInteger('idNotaPedido').unsigned(); | 89 | }).createTable('seguimiento', function(table) { |
90 | }).createTable('seguimiento', function(table) { | 90 | table.increments(); |
91 | table.increments(); | 91 | table.string('actividad'); |
92 | table.string('actividad'); | 92 | table.integer('distancia'); |
93 | table.integer('distancia'); | 93 | table.dateTime('fecha'); |
94 | table.dateTime('fecha'); | 94 | table.string('latitud'); |
95 | table.string('latitud'); | 95 | table.string('longitud'); |
96 | table.string('longitud'); | 96 | table.string('observaciones'); |
97 | table.string('observaciones'); | 97 | table.integer('orden'); |
98 | table.integer('orden'); | 98 | table.bigInteger('idUsuario').unsigned(); |
99 | table.bigInteger('idUsuario').unsigned(); | 99 | }).createTable('nota-pedido-estado', function(table) { |
100 | }).createTable('nota-pedido-estado', function(table) { | 100 | table.increments(); |
101 | table.increments(); | 101 | table.integer('estado'); |
102 | table.integer('estado'); | 102 | table.dateTime('fecha'); |
103 | table.dateTime('fecha'); | 103 | table.bigInteger('idNotaPedido').unsigned(); |
104 | table.bigInteger('idNotaPedido').unsigned(); | 104 | table.integer('idVendedor').unsigned(); |
105 | table.integer('idVendedor').unsigned(); | 105 | }).createTable('configuracion_terminal', function(table) { |
106 | }).createTable('configuracion_terminal', function(table) { | 106 | table.increments(); |
107 | table.increments(); | 107 | table.string('terminalKey'); |
108 | table.string('terminalKey'); | 108 | table.string('valor'); |
109 | table.string('valor'); | 109 | table.string('variable'); |
110 | table.string('variable'); | 110 | }).createTable('remito', function(table) { |
111 | }).createTable('remito', function(table) { | 111 | table.increments(); |
112 | table.increments(); | 112 | table.boolean('anulado'); |
113 | table.boolean('anulado'); | 113 | table.integer('asiento'); |
114 | table.integer('asiento'); | 114 | table.integer('bomba'); |
115 | table.integer('bomba'); | 115 | table.decimal('carga', 12, 2); |
116 | table.decimal('carga', 12, 2); | 116 | table.string('cuitCliente'); |
117 | table.string('cuitCliente'); | 117 | table.integer('cuentaContable'); |
118 | table.integer('cuentaContable'); | 118 | table.integer('cuentaMadre'); |
119 | table.integer('cuentaMadre'); | 119 | table.decimal('descuento', 12, 2); |
120 | table.decimal('descuento', 12, 2); | 120 | table.integer('destinoVenta'); |
121 | table.integer('destinoVenta'); | 121 | table.string('domicilioStamp'); |
122 | table.string('domicilioStamp'); | 122 | table.integer('estado'); |
123 | table.integer('estado'); | 123 | table.dateTime('fechaRemito'); |
124 | table.dateTime('fechaRemito'); | 124 | table.integer('flete'); |
125 | table.integer('flete'); | 125 | table.integer('fob'); |
126 | table.integer('fob'); | 126 | table.decimal('importeExento', 12, 2); |
127 | table.decimal('importeExento', 12, 2); | 127 | table.decimal('importeImpuestoInterno', 12, 2); |
128 | table.decimal('importeImpuestoInterno', 12, 2); | 128 | table.decimal('importeImpuestoInterno1', 12, 2); |
129 | table.decimal('importeImpuestoInterno1', 12, 2); | 129 | table.decimal('importeImpuestoInterno2', 12, 2); |
130 | table.decimal('importeImpuestoInterno2', 12, 2); | 130 | table.decimal('importeIva', 12, 2); |
131 | table.decimal('importeIva', 12, 2); | 131 | table.decimal('importeIvaServicios', 12, 2); |
132 | table.decimal('importeIvaServicios', 12, 2); | 132 | table.decimal('importeNeto', 12, 2); |
133 | table.decimal('importeNeto', 12, 2); | 133 | table.decimal('kilometros', 12, 2); |
134 | table.decimal('kilometros', 12, 2); | 134 | table.integer('lugar'); |
135 | table.integer('lugar'); | 135 | table.string('nombreCliente'); |
136 | table.string('nombreCliente'); | 136 | table.integer('numeroLiquidoProducto'); |
137 | table.integer('numeroLiquidoProducto'); | 137 | table.integer('numeroNotaPedido'); |
138 | table.integer('numeroNotaPedido'); | 138 | table.integer('numeroRemito'); |
139 | table.integer('numeroRemito'); | 139 | table.integer('operacionTipo'); |
140 | table.integer('operacionTipo'); | 140 | table.decimal('percepcion', 12, 2); |
141 | table.decimal('percepcion', 12, 2); | 141 | table.decimal('percepcionIva', 12, 2); |
142 | table.decimal('percepcionIva', 12, 2); | 142 | table.integer('planilla'); |
143 | table.integer('planilla'); | 143 | table.integer('sucursal'); |
144 | table.integer('sucursal'); | 144 | table.decimal('redondeo', 12, 2); |
145 | table.decimal('redondeo', 12, 2); | 145 | table.integer('responsabilidadIvaCliente'); |
146 | table.integer('responsabilidadIvaCliente'); | 146 | table.decimal('total', 12, 2); |
147 | table.decimal('total', 12, 2); | 147 | table.bigInteger('idVendedor').unsigned(); |
148 | table.bigInteger('idVendedor').unsigned(); | 148 | table.bigInteger('idProveedor').unsigned(); |
149 | table.bigInteger('idProveedor').unsigned(); | 149 | table.bigInteger('idDomicilio').unsigned(); |
150 | table.bigInteger('idDomicilio').unsigned(); | 150 | table.bigInteger('idCotizacion').unsigned(); |
151 | table.bigInteger('idCotizacion').unsigned(); | 151 | table.bigInteger('idPrecioCondicion').unsigned(); |
152 | table.bigInteger('idPrecioCondicion').unsigned(); | 152 | table.bigInteger('idHojaRuta').unsigned(); |
153 | table.bigInteger('idHojaRuta').unsigned(); | 153 | table.bigInteger('idCliente').unsigned(); |
154 | table.bigInteger('idCliente').unsigned(); | 154 | table.string('e_hd'); |
155 | table.string('e_hd'); | 155 | table.string('c_hd'); |
156 | table.string('c_hd'); | 156 | }).createTable('articulo_remito', function(table) { |
157 | }).createTable('articulo_remito', function(table) { | 157 | table.increments(); |
158 | table.increments(); | 158 | table.decimal('cantidad', 12, 2); |
159 | table.decimal('cantidad', 12, 2); | 159 | table.string('codigo'); |
160 | table.string('codigo'); | 160 | table.boolean('combustible'); |
161 | table.boolean('combustible'); | 161 | table.decimal('costoUnitario', 12, 2); |
162 | table.decimal('costoUnitario', 12, 2); | 162 | table.string('descripcion'); |
163 | table.string('descripcion'); | 163 | table.decimal('exentoUnitario', 12, 2); |
164 | table.decimal('exentoUnitario', 12, 2); | 164 | table.boolean('facturado'); |
165 | table.boolean('facturado'); | 165 | table.integer('item'); |
166 | table.integer('item'); | 166 | table.decimal('impuestoInternoUnitario', 12, 2); |
167 | table.decimal('impuestoInternoUnitario', 12, 2); | 167 | table.decimal('impuestoInterno1Unitario', 12, 2); |
168 | table.decimal('impuestoInterno1Unitario', 12, 2); | 168 | table.decimal('impuestoInterno2Unitario', 12, 2); |
169 | table.decimal('impuestoInterno2Unitario', 12, 2); | 169 | table.decimal('ivaServicioUnitario', 12, 2); |
170 | table.decimal('ivaServicioUnitario', 12, 2); | 170 | table.decimal('ivaUnitario', 12, 2); |
171 | table.decimal('ivaUnitario', 12, 2); | 171 | table.string('nombre'); |
172 | table.string('nombre'); | 172 | table.decimal('precio', 12, 4); |
173 | table.decimal('precio', 12, 4); | 173 | table.decimal('precioLista', 12, 2); |
174 | table.decimal('precioLista', 12, 2); | 174 | table.integer('sector'); |
175 | table.integer('sector'); | 175 | table.integer('rubro'); |
176 | table.integer('rubro'); | 176 | table.decimal('tasaIva', 12, 2); |
177 | table.decimal('tasaIva', 12, 2); | 177 | table.bigInteger('idRemito').unsigned(); |
178 | table.bigInteger('idRemito').unsigned(); | 178 | }).createTable('hoja_ruta', function(table) { |
179 | }).createTable('hoja_ruta', function(table) { | 179 | table.increments(); |
180 | table.increments(); | 180 | table.dateTime('fechaCreacion'); |
181 | table.dateTime('fechaCreacion'); | 181 | table.bigInteger('numeroHojaRuta').unsigned(); |
182 | table.bigInteger('numeroHojaRuta').unsigned(); | 182 | table.integer('sucursal').unsigned(); |
183 | table.integer('sucursal').unsigned(); | 183 | table.decimal('tarifaFlete', 12, 2); |
184 | table.decimal('tarifaFlete', 12, 2); | 184 | table.bigInteger('idTransportista').unsigned(); |
185 | table.bigInteger('idTransportista').unsigned(); | 185 | table.bigInteger('idChofer').unsigned(); |
186 | table.bigInteger('idChofer').unsigned(); | 186 | table.bigInteger('idVehiculo').unsigned(); |
187 | table.bigInteger('idVehiculo').unsigned(); | 187 | }); |
188 | }) | ||
189 | ]); | ||
190 | }; | 188 | }; |
191 | 189 | ||
192 | exports.down = function(knex, Promise) { | 190 | exports.down = function(knex) { |
193 | return Promise.all([ | 191 | return knex.schema |
194 | knex.schema | ||
195 | .dropTable('nota_pedido') | 192 | .dropTable('nota_pedido') |
196 | .dropTable('precios_condiciones') | 193 | .dropTable('precios_condiciones') |
197 | .dropTable('plazo_pago') | 194 | .dropTable('plazo_pago') |
198 | .dropTable('articulo_nota_pedido') | 195 | .dropTable('articulo_nota_pedido') |
199 | .dropTable('boton') | 196 | .dropTable('boton') |
200 | .dropTable('chofer') | 197 | .dropTable('chofer') |
201 | .dropTable('vehiculo') | 198 | .dropTable('vehiculo') |
202 | .dropTable('nota-pedido-plazo') | 199 | .dropTable('nota-pedido-plazo') |
203 | .dropTable('seguimiento') | 200 | .dropTable('seguimiento') |
204 | .dropTable('nota-pedido-estado') | 201 | .dropTable('nota-pedido-estado') |
205 | .dropTable('configuracion_terminal') | 202 | .dropTable('configuracion_terminal') |
206 | .dropTable('remito') | 203 | .dropTable('remito') |
207 | .dropTable('articulo_remito') | 204 | .dropTable('articulo_remito') |
208 | .dropTable('hoja_ruta') | 205 | .dropTable('hoja_ruta') |
209 | ]); | ||
210 | }; | 206 | }; |
211 | 207 |
migrations/20181127121352_v0.1.1.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.table('APAREMP', function(table) { |
4 | knex.schema.table('APAREMP', function(table) { | 4 | table.decimal('latitud', 10, 7); |
5 | table.decimal('latitud', 10, 7); | 5 | table.decimal('longitud', 10, 7); |
6 | table.decimal('longitud', 10, 7); | 6 | }); |
7 | }) | ||
8 | ]) | ||
9 | }; | 7 | }; |
10 | 8 | ||
11 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
12 | return Promise.all([ | 10 | return knex.schema.table('APAREMP', function(table) { |
13 | knex.schema.table('APAREMP', function(table) { | 11 | table.dropColumn('latitud'); |
14 | table.dropColumn('latitud'); | 12 | table.dropColumn('longitud'); |
15 | table.dropColumn('longitud'); | 13 | }); |
16 | }) | ||
17 | ]) | ||
18 | }; | 14 | }; |
19 | 15 |
migrations/20181129105456_v0.2.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.table('vehiculo', function(table) { |
3 | knex.schema.table('vehiculo', function(table) { | 3 | table.boolean('desactivado'); |
4 | table.boolean('desactivado'); | 4 | }).alterTable('chofer', function(table) { |
5 | }).alterTable('chofer', function(table) { | 5 | table.boolean('desactivado'); |
6 | table.boolean('desactivado'); | 6 | }); |
7 | }) | ||
8 | ]); | ||
9 | }; | 7 | }; |
10 | 8 | ||
11 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
12 | return Promise.all([ | 10 | return knex.schema.table('vehiculo', function(table) { |
13 | knex.schema.table('vehiculo', function(table) { | 11 | table.dropColumn('desactivado'); |
14 | table.dropColumn('desactivado'); | 12 | }).alterTable('chofer', function(table) { |
15 | }).alterTable('chofer', function(table) { | 13 | table.dropColumn('desactivado'); |
16 | table.dropColumn('desactivado'); | 14 | }); |
17 | }) | ||
18 | ]); | ||
19 | }; | 15 | }; |
20 | 16 |
migrations/20181130113831_v0.3.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.createTable('cobrador', function(table) { |
3 | knex.schema.createTable('cobrador', function(table) { | 3 | table.increments(); |
4 | table.increments(); | 4 | table.string('nombre'); |
5 | table.string('nombre'); | 5 | table.boolean('desactivado'); |
6 | table.boolean('desactivado'); | 6 | }); |
7 | }) | ||
8 | ]); | ||
9 | }; | 7 | }; |
10 | 8 | ||
11 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
12 | return Promise.all([ | 10 | return knex.schema.dropTable('cobrador'); |
13 | knex.schema.dropTable('cobrador') | ||
14 | ]); | ||
15 | }; | 11 | }; |
16 | 12 |
migrations/20181206105940_v0.1.2.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.createTable('remito-plazo', function(table) { |
3 | knex.schema.createTable('remito-plazo', function(table) { | 3 | table.increments(); |
4 | table.increments(); | 4 | table.integer('dias').unsigned(); |
5 | table.integer('dias').unsigned(); | 5 | table.bigInteger('idRemito').unsigned(); |
6 | table.bigInteger('idRemito').unsigned(); | 6 | }); |
7 | }) | ||
8 | ]); | ||
9 | }; | 7 | }; |
10 | 8 | ||
11 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
12 | return Promise.all([ | 10 | return knex.schema.dropTable('remito-plazo'); |
13 | knex.schema.dropTable('remito-plazo') | ||
14 | ]); | ||
15 | }; | 11 | }; |
16 | 12 |
migrations/20181210132759_v0.4.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.table('seguimiento', function(table) { |
3 | knex.schema.table('seguimiento', function(table) { | 3 | table.integer('sucursal'); |
4 | table.integer('sucursal'); | 4 | }); |
5 | }) | ||
6 | ]); | ||
7 | }; | 5 | }; |
8 | 6 | ||
9 | exports.down = function(knex, Promise) { | 7 | exports.down = function(knex) { |
10 | return Promise.all([ | 8 | return knex.schema.table('seguimiento', function(table) { |
11 | knex.schema.table('seguimiento', function(table) { | 9 | table.dropColumn('sucursal'); |
12 | table.dropColumn('sucursal'); | 10 | }); |
13 | }) | ||
14 | ]); | ||
15 | }; | 11 | }; |
16 | 12 |
migrations/20181211152717_0.4.1.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.table('ARECIBOS', function(table) { |
3 | knex.schema.table('ARECIBOS', function(table) { | 3 | table.bigInteger('idCobrador').unsigned(); |
4 | table.bigInteger('idCobrador').unsigned(); | 4 | }); |
5 | }) | ||
6 | ]); | ||
7 | 5 | ||
8 | }; | 6 | }; |
9 | 7 | ||
10 | exports.down = function(knex, Promise) { | 8 | exports.down = function(knex) { |
11 | return Promise.all([ | 9 | return knex.schema.table('ARECIBOS', function(table) { |
12 | knex.schema.table('ARECIBOS', function(table) { | 10 | table.dropColumn('idCobrador'); |
13 | table.dropColumn('idCobrador'); | 11 | }); |
14 | }) | ||
15 | ]); | ||
16 | }; | 12 | }; |
17 | 13 |
migrations/20181213153525_0.5.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema | 4 | .table('vehiculo', function(table) { |
5 | .table('vehiculo', function(table) { | 5 | table.string('codigo'); |
6 | table.string('codigo'); | 6 | table.dropColumn('cisternado'); |
7 | table.dropColumn('cisternado'); | 7 | }) |
8 | }) | 8 | .createTable('cisterna', function(table) { |
9 | .createTable('cisterna', function(table) { | 9 | table.increments(); |
10 | table.increments(); | 10 | table.string('codigo'); |
11 | table.string('codigo'); | 11 | table.decimal('capacidad', 12, 2); |
12 | table.decimal('capacidad', 12, 2); | 12 | table.bigInteger('idVehiculo').unsigned(); |
13 | table.bigInteger('idVehiculo').unsigned(); | 13 | table.bigInteger('idUnidadMedida').unsigned(); |
14 | table.bigInteger('idUnidadMedida').unsigned(); | 14 | table.bigInteger('idCarga').unsigned(); |
15 | table.bigInteger('idCarga').unsigned(); | 15 | }) |
16 | }) | 16 | .createTable('cisterna_carga', function(table) { |
17 | .createTable('cisterna_carga', function(table) { | 17 | table.increments(); |
18 | table.increments(); | 18 | table.decimal('cantidad', 12, 2); |
19 | table.decimal('cantidad', 12, 2); | 19 | table.bigInteger('codigoArticulo').unsigned(); |
20 | table.bigInteger('codigoArticulo').unsigned(); | 20 | table.bigInteger('codigoSectorArticulo').unsigned(); |
21 | table.bigInteger('codigoSectorArticulo').unsigned(); | 21 | }) |
22 | }) | 22 | .createTable('cisterna_movimiento', function(table) { |
23 | .createTable('cisterna_movimiento', function(table) { | 23 | table.increments(); |
24 | table.increments(); | 24 | table.dateTime('fecha'); |
25 | table.dateTime('fecha'); | 25 | table.decimal('cantidad', 12, 2); |
26 | table.decimal('cantidad', 12, 2); | 26 | table.string('metodo'); |
27 | table.string('metodo'); | 27 | table.bigInteger('idCisternaCarga').unsigned(); |
28 | table.bigInteger('idCisternaCarga').unsigned(); | 28 | }) |
29 | }) | 29 | .createTable('hoja_ruta_movimiento', function(table) { |
30 | .createTable('hoja_ruta_movimiento', function(table) { | 30 | table.increments(); |
31 | table.increments(); | 31 | table.string('reciboDescarga'); |
32 | table.string('reciboDescarga'); | 32 | table.bigInteger('idRemito').unsigned(); |
33 | table.bigInteger('idRemito').unsigned(); | 33 | table.bigInteger('idCisternaMovimiento').unsigned(); |
34 | table.bigInteger('idCisternaMovimiento').unsigned(); | 34 | table.bigInteger('idSeguimiento').unsigned(); |
35 | table.bigInteger('idSeguimiento').unsigned(); | 35 | }) |
36 | }) | 36 | .table('nota_pedido', function(table) { |
37 | .table('nota_pedido', function(table) { | 37 | table.bigInteger('idSeguimiento').unsigned(); |
38 | table.bigInteger('idSeguimiento').unsigned(); | 38 | }) |
39 | }) | 39 | .table('hoja_ruta', function(table) { |
40 | .table('hoja_ruta', function(table) { | 40 | table.bigInteger('idSeguimiento').unsigned(); |
41 | table.bigInteger('idSeguimiento').unsigned(); | 41 | }) |
42 | }) | ||
43 | ]); | ||
44 | }; | 42 | }; |
45 | 43 | ||
46 | exports.down = function(knex, Promise) { | 44 | exports.down = function(knex) { |
47 | return Promise.all([ | 45 | return knex.schema |
48 | knex.schema | 46 | .table('vehiculo', function(table) { |
49 | .table('vehiculo', function(table) { | 47 | table.string('cisternado'); |
50 | table.string('cisternado'); | 48 | table.dropColumn('codigo'); |
51 | table.dropColumn('codigo'); | 49 | }) |
52 | }) | 50 | .table('nota_pedido', function(table) { |
53 | .table('nota_pedido', function(table) { | 51 | table.dropColumn('idSeguimiento'); |
54 | table.dropColumn('idSeguimiento'); | 52 | }) |
55 | }) | 53 | .table('hoja_ruta', function(table) { |
56 | .table('hoja_ruta', function(table) { | 54 | table.dropColumn('idSeguimiento'); |
57 | table.dropColumn('idSeguimiento'); | 55 | }) |
58 | }) | 56 | .dropTable('cisterna') |
59 | .dropTable('cisterna') | 57 | .dropTable('cisterna_carga') |
60 | .dropTable('cisterna_carga') | 58 | .dropTable('cisterna_movimiento') |
61 | .dropTable('cisterna_movimiento') | 59 | .dropTable('hoja_ruta_movimiento') |
62 | .dropTable('hoja_ruta_movimiento') | ||
63 | |||
64 | ]); | ||
65 | }; | 60 | }; |
66 | 61 |
migrations/20181217131259_v0.6.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema |
3 | knex.schema | 3 | .raw("ALTER TABLE ARTICULOS ADD id INT IDENTITY(1,1)") |
4 | .raw("ALTER TABLE ARTICULOS ADD id INT IDENTITY(1,1)") | 4 | .table('cisterna_carga', function(table) { |
5 | .table('cisterna_carga', function(table) { | 5 | table.dropColumn('codigoArticulo'); |
6 | table.dropColumn('codigoArticulo'); | 6 | table.dropColumn('codigoSectorArticulo'); |
7 | table.dropColumn('codigoSectorArticulo'); | 7 | table.bigInteger('idProducto').unsigned(); |
8 | table.bigInteger('idProducto').unsigned(); | 8 | }) |
9 | }) | ||
10 | ]); | ||
11 | }; | 9 | }; |
12 | 10 | ||
13 | exports.down = function(knex, Promise) { | 11 | exports.down = function(knex, Promise) { |
14 | return Promise.all([ | 12 | return knex.schema |
15 | knex.schema | 13 | .table('ARTICULOS', function(table) { |
16 | .table('ARTICULOS', function(table) { | 14 | table.dropColumn('id'); |
17 | table.dropColumn('id'); | 15 | }).table('cisterna_carga', function(table) { |
18 | }).table('cisterna_carga', function(table) { | 16 | table.dropColumn('idProducto'); |
19 | table.dropColumn('idProducto'); | 17 | table.bigInteger('codigoArticulo').unsigned(); |
20 | table.bigInteger('codigoArticulo').unsigned(); | 18 | table.bigInteger('codigoSectorArticulo').unsigned(); |
21 | table.bigInteger('codigoSectorArticulo').unsigned(); | 19 | }); |
22 | }) | ||
23 | ]); | ||
24 | }; | 20 | }; |
25 | 21 |
migrations/20181217172010_v0.5.1.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex, Promise) { |
2 | return Promise.all([ | 2 | return knex.schema.table('cisterna', function(table) { |
3 | knex.schema.table('cisterna', function(table) { | 3 | table.boolean('desactivado'); |
4 | table.boolean('desactivado'); | 4 | }); |
5 | }) | ||
6 | ]) | ||
7 | }; | 5 | }; |
8 | 6 | ||
9 | exports.down = function(knex, Promise) { | 7 | exports.down = function(knex, Promise) { |
10 | return Promise.all([ | 8 | return knex.schema.table('cisterna', function(table) { |
11 | knex.schema.table('cisterna', function(table) { | 9 | table.dropColumn('desactivado'); |
12 | table.dropColumn('desactivado'); | 10 | }); |
13 | }) | ||
14 | ]) | ||
15 | }; | 11 | }; |
16 | 12 |
migrations/20181218155954_0.6.1.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex, Promise) { |
2 | return Promise.all([ | 2 | return knex.schema |
3 | knex.schema | 3 | .raw("ALTER TABLE ARECIBOS ADD id INT IDENTITY(1,1)") |
4 | .raw("ALTER TABLE ARECIBOS ADD id INT IDENTITY(1,1)") | 4 | .table('ARECIBOS', function(table) { |
5 | .table('ARECIBOS', function(table) { | 5 | table.bigInteger('idSeguimiento').unsigned(); |
6 | table.bigInteger('idSeguimiento').unsigned(); | 6 | }); |
7 | }) | ||
8 | ]); | ||
9 | }; | 7 | }; |
10 | 8 | ||
11 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex, Promise) { |
12 | return Promise.all([ | 10 | return knex.schema |
13 | knex.schema | 11 | .table('ARECIBOS', function(table) { |
14 | .table('ARECIBOS', function(table) { | 12 | table.dropColumn('id'); |
15 | table.dropColumn('id'); | 13 | table.dropColumn('idSeguimiento'); |
16 | table.dropColumn('idSeguimiento'); | 14 | }); |
17 | }) | ||
18 | ]); | ||
19 | }; | 15 | }; |
20 | 16 |
migrations/20181221125659_0.6.2.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema.table('precios_condiciones', function(table) { | 4 | .table('precios_condiciones', function(table) { |
5 | table.dropColumn('idListaPrecio') | 5 | table.dropColumn('idListaPrecio') |
6 | }).raw("ALTER TABLE precios_condiciones ADD idListaPrecio char(4)") | 6 | }) |
7 | ]) | 7 | .raw("ALTER TABLE precios_condiciones ADD idListaPrecio char(4)"); |
8 | |||
8 | }; | 9 | }; |
9 | 10 | ||
10 | exports.down = function(knex, Promise) { | 11 | exports.down = function(knex) { |
11 | return Promise.all([ | 12 | return knex.schema.table('precios_condiciones', function(table) { |
12 | knex.schema.table('precios_condiciones', function(table) { | 13 | table.dropColumn('idListaPrecio') |
13 | table.dropColumn('idListaPrecio') | 14 | }); |
14 | }) | ||
15 | ]); | ||
16 | }; | 15 | }; |
migrations/20181221173513_v0.6.3.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.table('articulo_nota_pedido', function(table) { |
3 | knex.schema.table('articulo_nota_pedido', function(table) { | 3 | table.bigint('idArticulo').unsigned(); |
4 | table.bigint('idArticulo').unsigned(); | 4 | }); |
5 | }) | ||
6 | ]) | ||
7 | }; | 5 | }; |
8 | 6 | ||
9 | exports.down = function(knex, Promise) { | 7 | exports.down = function(knex) { |
10 | return Promise.all([ | 8 | return knex.schema.table('articulo_nota_pedido', function(table) { |
11 | knex.schema.table('articulo_nota_pedido', function(table) { | 9 | table.dropColumn('idArticulo'); |
12 | table.dropColumn('idArticulo'); | 10 | }); |
13 | }) | ||
14 | ]) | ||
15 | }; | 11 | }; |
16 | 12 |
migrations/20181226120323_v0.6.4.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.table('articulo_remito', function(table) { |
3 | knex.schema.table('articulo_remito', function(table) { | 3 | table.bigint('idArticulo').unsigned(); |
4 | table.bigint('idArticulo').unsigned(); | 4 | }); |
5 | }) | ||
6 | ]) | ||
7 | }; | 5 | }; |
8 | 6 | ||
9 | exports.down = function(knex, Promise) { | 7 | exports.down = function(knex) { |
10 | return Promise.all([ | 8 | return knex.schema.table('articulo_remito', function(table) { |
11 | knex.schema.table('articulo_remito', function(table) { | 9 | table.dropColumn('idArticulo'); |
12 | table.dropColumn('idArticulo'); | 10 | }); |
13 | }) | ||
14 | ]) | ||
15 | }; | 11 | }; |
16 | 12 |
migrations/20181227171744_v0.6.5.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema |
3 | knex.schema | 3 | .table('cisterna_movimiento', function(table) { |
4 | .table('cisterna_movimiento', function(table) { | 4 | table.bigint('idRemito').unsigned(); |
5 | table.bigint('idRemito').unsigned(); | 5 | }).table('remito', function(table) { |
6 | }).table('remito', function(table) { | 6 | table.bigint('idUsuarioProceso').unsigned(); |
7 | table.bigint('idUsuarioProceso').unsigned(); | 7 | }).table('vehiculo', function(table) { |
8 | }).table('vehiculo', function(table) { | 8 | table.bigint('idUsuarioProceso').unsigned(); |
9 | table.bigint('idUsuarioProceso').unsigned(); | 9 | }); |
10 | }) | ||
11 | ]) | ||
12 | }; | 10 | }; |
13 | 11 | ||
14 | exports.down = function(knex, Promise) { | 12 | exports.down = function(knex) { |
15 | return Promise.all([ | 13 | return knex.schema |
16 | knex.schema | 14 | .table('cisterna_movimiento', function(table) { |
17 | .table('cisterna_movimiento', function(table) { | 15 | table.dropColumn('idRemito'); |
18 | table.dropColumn('idRemito'); | 16 | }).table('remito', function(table) { |
19 | }).table('remito', function(table) { | 17 | table.dropColumn('idUsuarioProceso'); |
20 | table.dropColumn('idUsuarioProceso'); | 18 | }).table('vehiculo', function(table) { |
21 | }).table('vehiculo', function(table) { | 19 | table.dropColumn('idUsuarioProceso'); |
22 | table.dropColumn('idUsuarioProceso'); | 20 | }); |
23 | }) | ||
24 | ]) | ||
25 | }; | 21 | }; |
26 | 22 |
migrations/20181231114424_v0.6.6.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema | 4 | .createTable('a_punto_descarga', function(table) { |
5 | .createTable('a_punto_descarga', function(table) { | 5 | table.increments(); |
6 | table.increments(); | 6 | table.bigInteger('id_cliente'); |
7 | table.bigInteger('id_cliente'); | 7 | table.bigInteger('id_da_config_0'); |
8 | table.bigInteger('id_da_config_0'); | 8 | table.string('descripcion'); |
9 | table.string('descripcion'); | 9 | table.string('latitud'); |
10 | table.string('latitud'); | 10 | table.string('longitud'); |
11 | table.string('longitud'); | 11 | table.boolean('desactivado'); |
12 | table.boolean('desactivado'); | 12 | }) |
13 | }) | 13 | .table('CLIENTES', function(table) { |
14 | .table('CLIENTES', function(table) { | 14 | table.boolean('ES_PROS'); |
15 | table.boolean('ES_PROS'); | 15 | }) |
16 | }) | 16 | .createTable('nota_pedido_punto_descarga', function(table) { |
17 | .createTable('nota_pedido_punto_descarga', function(table) { | 17 | table.increments(); |
18 | table.increments(); | 18 | table.bigInteger('idPuntoDescarga').unsigned(); |
19 | table.bigInteger('idPuntoDescarga').unsigned(); | 19 | table.bigInteger('idNotaPedido').unsigned(); |
20 | table.bigInteger('idNotaPedido').unsigned(); | 20 | table.bigInteger('idProducto').unsigned(); |
21 | table.bigInteger('idProducto').unsigned(); | 21 | table.decimal('cantidad', 12, 2); |
22 | table.decimal('cantidad', 12, 2); | 22 | }); |
23 | }) | ||
24 | ]); | ||
25 | }; | 23 | }; |
26 | 24 | ||
27 | exports.down = function(knex, Promise) { | 25 | exports.down = function(knex) { |
28 | return Promise.all([ | 26 | return knex.schema |
29 | knex.schema | 27 | .dropTable('a_punto_descarga') |
30 | .dropTable('a_punto_descarga') | 28 | .table('CLIENTES', function(table) { |
31 | .table('CLIENTES', function(table) { | 29 | table.dropColumn('ES_PROS'); |
32 | table.dropColumn('ES_PROS'); | 30 | }) |
33 | }) | 31 | .dropTable('nota_pedido_punto_descarga'); |
34 | .dropTable('nota_pedido_punto_descarga') | ||
35 | ]); | ||
36 | }; | 32 | }; |
37 | 33 |
migrations/20190102160859_v0.6.7.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.table('cisterna_movimiento', function(table) { |
3 | knex.schema.table('cisterna_movimiento', function(table) { | 3 | table.boolean('anulado'); |
4 | table.boolean('anulado'); | 4 | }); |
5 | }) | ||
6 | ]) | ||
7 | }; | 5 | }; |
8 | 6 | ||
9 | exports.down = function(knex, Promise) { | 7 | exports.down = function(knex) { |
10 | return Promise.all([ | 8 | return knex.schema.table('cisterna_movimiento', function(table) { |
11 | knex.schema.table('cisterna_movimiento', function(table) { | 9 | table.dropColumn('anulado'); |
12 | table.dropColumn('anulado'); | 10 | }); |
13 | }) | ||
14 | ]) | ||
15 | }; | 11 | }; |
16 | 12 |
migrations/20190107163621_v0.6.8.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.table('VENDEDORES', function(table) { |
4 | knex.schema.table('VENDEDORES', function(table) { | 4 | table.boolean('ES_COBRADOR'); |
5 | table.boolean('ES_COBRADOR'); | 5 | }); |
6 | }) | ||
7 | ]); | ||
8 | }; | 6 | }; |
9 | 7 | ||
10 | exports.down = function(knex, Promise) { | 8 | exports.down = function(knex) { |
11 | return Promise.all([ | 9 | return knex.schema.table('VENDEDORES', function(table) { |
12 | knex.schema.table('VENDEDORES', function(table) { | 10 | table.dropColumn('ES_COBRADOR'); |
13 | table.dropColumn('ES_COBRADOR'); | 11 | }); |
14 | }) | ||
15 | ]); | ||
16 | }; | 12 | }; |
17 | 13 |
migrations/20190108114746_v0.6.9.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema |
3 | knex.schema | 3 | .table('cisterna', function(table) { |
4 | .table('cisterna', function(table) { | 4 | table.dropColumn('idCarga'); |
5 | table.dropColumn('idCarga'); | 5 | }) |
6 | }) | 6 | .table('cisterna_carga', function(table) { |
7 | .table('cisterna_carga', function(table) { | 7 | table.bigInteger('idCisterna').unsigned(); |
8 | table.bigInteger('idCisterna').unsigned(); | 8 | table.date('fechaReparto'); |
9 | table.date('fechaReparto'); | 9 | }); |
10 | }) | ||
11 | ]) | ||
12 | }; | 10 | }; |
13 | 11 | ||
14 | exports.down = function(knex, Promise) { | 12 | exports.down = function(knex) { |
15 | return Promise.all([ | 13 | return knex.schema |
16 | knex.schema | 14 | .table('cisterna', function(table) { |
17 | .table('cisterna', function(table) { | 15 | table.bigInteger('idCarga'); |
18 | table.bigInteger('idCarga'); | 16 | }) |
19 | }) | 17 | .table('cisterna_carga', function(table) { |
20 | .table('cisterna_carga', function(table) { | 18 | table |
21 | table | 19 | .dropColumn('idCisterna') |
22 | .dropColumn('idCisterna') | 20 | .dropColumn('fechaReparto'); |
23 | .dropColumn('fechaReparto'); | 21 | }); |
24 | }) | ||
25 | ]) | ||
26 | }; | 22 | }; |
27 | 23 |
migrations/20190109123406_v0.6.10.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.table('VENDEDORES', function(table) { |
4 | knex.schema.table('VENDEDORES', function(table) { | 4 | table.boolean('desactivado'); |
5 | table.boolean('desactivado'); | 5 | }); |
6 | }) | ||
7 | ]); | ||
8 | }; | 6 | }; |
9 | 7 | ||
10 | exports.down = function(knex, Promise) { | 8 | exports.down = function(knex) { |
11 | return Promise.all([ | 9 | return knex.schema.table('VENDEDORES', function(table) { |
12 | knex.schema.table('VENDEDORES', function(table) { | 10 | table.dropColumn('desactivado'); |
13 | table.dropColumn('desactivado'); | 11 | }); |
14 | }) | ||
15 | ]); | ||
16 | }; | 12 | }; |
17 | 13 |
migrations/20190109123752_v0.6.11.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema.createTable('login', function(table) { | 4 | .createTable('login', function(table) { |
5 | table.increments(); | 5 | table.increments(); |
6 | table.string('username'); | 6 | table.string('username'); |
7 | table.string('password'); | 7 | table.string('password'); |
8 | table.boolean('activo'); | 8 | table.boolean('activo'); |
9 | }).table('VENDEDORES', function(table) { | 9 | }).table('VENDEDORES', function(table) { |
10 | table.bigInteger('idLogin').unsigned(); | 10 | table.bigInteger('idLogin').unsigned(); |
11 | }).table('chofer', function(table) { | 11 | }).table('chofer', function(table) { |
12 | table.bigInteger('idLogin').unsigned(); | 12 | table.bigInteger('idLogin').unsigned(); |
13 | }) | 13 | }); |
14 | ]); | ||
15 | }; | 14 | }; |
16 | 15 | ||
17 | exports.down = function(knex, Promise) { | 16 | exports.down = function(knex) { |
18 | return Promise.all([ | 17 | return knex.schema |
19 | knex.schema | 18 | .dropTable('login') |
20 | .dropTable('login') | 19 | .table('vendedores', function(table) { |
21 | .table('vendedores', function(table) { | 20 | table.dropColumn('idLogin'); |
22 | table.dropColumn('idLogin'); | 21 | }) |
23 | }) | 22 | .table('chofer', function(table) { |
24 | .table('chofer', function(table) { | 23 | table.dropColumn('idLogin'); |
25 | table.dropColumn('idLogin'); | 24 | }); |
26 | }) | ||
27 | ]); | ||
28 | }; | 25 | }; |
29 | 26 |
migrations/20190110100715_v0.6.12.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex, Promise) { |
2 | return Promise.all([ | 2 | return knex.schema |
3 | knex.schema | 3 | .table('vehiculo', function(table) { |
4 | .table('vehiculo', function(table) { | 4 | table.dropColumn('idUsuarioProceso'); |
5 | table.dropColumn('idUsuarioProceso'); | 5 | }) |
6 | }) | 6 | .table('cisterna_carga', function(table) { |
7 | .table('cisterna_carga', function(table) { | 7 | table.bigInteger('idUsuarioProceso'); |
8 | table.bigInteger('idUsuarioProceso'); | 8 | table.boolean('confirmado'); |
9 | table.boolean('confirmado'); | 9 | }); |
10 | }) | ||
11 | ]) | ||
12 | }; | 10 | }; |
13 | 11 | ||
14 | exports.down = function(knex, Promise) { | 12 | exports.down = function(knex, Promise) { |
15 | return Promise.all([ | 13 | return knex.schema |
16 | knex.schema | 14 | .table('vehiculo', function(table) { |
17 | .table('vehiculo', function(table) { | 15 | table.bigint('idUsuarioProceso').unsigned(); |
18 | table.bigint('idUsuarioProceso').unsigned(); | 16 | }) |
19 | }) | 17 | .table('cisterna_carga', function(table) { |
20 | .table('cisterna_carga', function(table) { | 18 | table.dropColumns('idUsuarioProceso', 'confirmado'); |
21 | table.dropColumns('idUsuarioProceso', 'confirmado'); | 19 | }); |
22 | }) | ||
23 | ]) | ||
24 | }; | 20 | }; |
25 | 21 |
migrations/20190110152626_v0.6.13.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema |
3 | knex.schema.table('login', function(table) { | 3 | .table('login', function(table) { |
4 | table.dateTime('ultimoLogin'); | 4 | table.dateTime('ultimoLogin'); |
5 | table.string('token'); | 5 | table.string('token'); |
6 | }) | 6 | }); |
7 | ]) | ||
8 | }; | 7 | }; |
9 | 8 | ||
10 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
11 | return Promise.all([ | 10 | return knex.schema |
12 | knex.schema.table('login', function(table) { | 11 | .table('login', function(table) { |
13 | table.dropColumns('ultimoLogin', 'token'); | 12 | table.dropColumns('ultimoLogin', 'token'); |
14 | }) | 13 | }); |
15 | ]); | ||
16 | }; | 14 | }; |
17 | 15 |
migrations/20190114160629_v0.6.14.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.table('hoja_ruta', function(table) { |
4 | knex.schema.table('hoja_ruta', function(table) { | 4 | //0=disponible 1=asignado 2=terminado |
5 | //0=disponible 1=asignado 2=terminado | 5 | table.integer('estado').unsigned(); |
6 | table.integer('estado').unsigned(); | 6 | table.date('fechaReparto'); |
7 | table.date('fechaReparto'); | 7 | }); |
8 | }) | ||
9 | ]); | ||
10 | }; | 8 | }; |
11 | 9 | ||
12 | exports.down = function(knex, Promise) { | 10 | exports.down = function(knex) { |
13 | return Promise.all([ | 11 | return knex.schema.table('hoja_ruta', function(table) { |
14 | knex.schema.table('hoja_ruta', function(table) { | 12 | table.dropColumn('estado'); |
15 | table.dropColumn('estado'); | 13 | table.dropColumn('fechaReparto'); |
16 | table.dropColumn('fechaReparto'); | 14 | }) |
17 | }) | ||
18 | ]); | ||
19 | }; | 15 | }; |
20 | 16 |
migrations/20190118161051_v0.6.15.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.createTable('tipo_documento', function(table) { |
4 | knex.schema.createTable('tipo_documento', function(table) { | 4 | table.integer('id').unsigned().primary(); |
5 | table.integer('id').unsigned().primary(); | 5 | table.string('descripcion'); |
6 | table.string('descripcion'); | 6 | table.string('orden'); |
7 | table.string('orden'); | 7 | table.boolean('activo'); |
8 | table.boolean('activo'); | 8 | }); |
9 | }) | ||
10 | ]) | ||
11 | }; | 9 | }; |
12 | 10 | ||
13 | exports.down = function(knex, Promise) { | 11 | exports.down = function(knex, Promise) { |
14 | return Promise.all([ | 12 | return knex.schema.dropTable('tipo_documento'); |
15 | knex.schema.dropTable('tipo_documento') | ||
16 | ]); | ||
17 | }; | 13 | }; |
18 | 14 |
migrations/20190121125737_v0.6.16.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema |
3 | knex.schema | 3 | .table('articulo_remito', function(table) { |
4 | .table('articulo_remito', function(table) { | 4 | table.integer('cantidadDescargada'); |
5 | table.integer('cantidadDescargada'); | 5 | }).table('remito', function(table) { |
6 | }).table('remito', function(table) { | 6 | table.boolean('rechazado'); |
7 | table.boolean('rechazado'); | 7 | table.string('motivoRechazo'); |
8 | table.string('motivoRechazo'); | 8 | }); |
9 | }) | ||
10 | ]) | ||
11 | }; | 9 | }; |
12 | 10 | ||
13 | exports.down = function(knex, Promise) { | 11 | exports.down = function(knex) { |
14 | return Promise.all([ | 12 | return knex.schema |
15 | knex.schema | 13 | .table('articulo_remito', function(table) { |
16 | .table('articulo_remito', function(table) { | 14 | table.dropColumn('cantidadDescargada'); |
17 | table.dropColumn('cantidadDescargada'); | 15 | }).table('remito', function(table) { |
18 | }).table('remito', function(table) { | 16 | table.dropColumns('rechazado', 'motivoRechazo'); |
19 | table.dropColumns('rechazado', 'motivoRechazo'); | 17 | }); |
20 | }) | ||
21 | ]) | ||
22 | }; | 18 | }; |
23 | 19 |
migrations/20190122165422_v0.6.17.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.table('hoja_ruta', function(table) { |
3 | knex.schema.table('hoja_ruta', function(table) { | 3 | table.decimal('kmInicialVehiculo', 18, 4); |
4 | table.decimal('kmInicialVehiculo', 18, 4); | 4 | table.decimal('kmFinalVehiculo', 18, 4) |
5 | table.decimal('kmFinalVehiculo', 18, 4) | 5 | table.decimal('aforadorInicialVehiculo', 18, 4); |
6 | table.decimal('aforadorInicialVehiculo', 18, 4); | 6 | table.decimal('aforadorFinalVehiculo', 18, 4) |
7 | table.decimal('aforadorFinalVehiculo', 18, 4) | 7 | table.decimal('cantidadDescargaPorGravedad', 18, 4); |
8 | table.decimal('cantidadDescargaPorGravedad', 18, 4); | 8 | table.decimal('litrosDescargadosPorGravedad', 18, 4); |
9 | table.decimal('litrosDescargadosPorGravedad', 18, 4); | 9 | table.decimal('litrosCombustibleParaMovilidad', 18, 4); |
10 | table.decimal('litrosCombustibleParaMovilidad', 18, 4); | 10 | table.string('precintoBocaUno'); |
11 | table.string('precintoBocaUno'); | 11 | table.string('precintoBocaDos'); |
12 | table.string('precintoBocaDos'); | 12 | table.string('precintoBocaTres'); |
13 | table.string('precintoBocaTres'); | 13 | }); |
14 | }) | ||
15 | ]); | ||
16 | }; | 14 | }; |
17 | 15 | ||
18 | exports.down = function(knex, Promise) { | 16 | exports.down = function(knex) { |
19 | return Promise.all([ | 17 | return knex.schema.table('hoja_ruta', function(table) { |
20 | knex.schema.table('hoja_ruta', function(table) { | 18 | table.dropColumns( |
21 | table.dropColumns( | 19 | 'kmInicialVehiculo', |
22 | 'kmInicialVehiculo', | 20 | 'kmFinalVehiculo', |
23 | 'kmFinalVehiculo', | 21 | 'aforadorInicialVehiculo', |
24 | 'aforadorInicialVehiculo', | 22 | 'aforadorFinalVehiculo', |
25 | 'aforadorFinalVehiculo', | 23 | 'cantidadDescargaPorGravedad', |
26 | 'cantidadDescargaPorGravedad', | 24 | 'litrosDescargadosPorGravedad', |
27 | 'litrosDescargadosPorGravedad', | 25 | 'litrosCombustibleParaMovilidad', |
28 | 'litrosCombustibleParaMovilidad', | 26 | 'precintoBocaUno', |
29 | 'precintoBocaUno', | 27 | 'precintoBocaDos', |
30 | 'precintoBocaDos', | 28 | 'precintoBocaTres' |
31 | 'precintoBocaTres' | 29 | ); |
32 | ); | 30 | }); |
33 | }) | ||
34 | ]); | ||
35 | }; | 31 | }; |
36 | 32 |
migrations/20190125093429_v0.6.18.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.table('chofer', function(table) { |
4 | knex.schema.table('chofer', function(table) { | 4 | table.bigInteger('idTipoDocumento').unsigned(); |
5 | table.bigInteger('idTipoDocumento').unsigned(); | 5 | }); |
6 | }) | ||
7 | ]); | ||
8 | }; | 6 | }; |
9 | 7 | ||
10 | exports.down = function(knex, Promise) { | 8 | exports.down = function(knex) { |
11 | return Promise.all([ | 9 | return knex.schema.table('chofer', function(table) { |
12 | knex.schema.table('chofer', function(table) { | 10 | table.dropColumn('idTipoDocumento'); |
13 | table.dropColumn('idTipoDocumento'); | 11 | }); |
14 | }) | ||
15 | ]); | ||
16 | }; | 12 | }; |
17 | 13 |
migrations/20190125102735_v0.6.19.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema | 4 | .table('VENDEDORES', function(table) { |
5 | .table('VENDEDORES', function(table) { | 5 | //Puede ser 1=vendedor, 2=cobrador, 3=ambos |
6 | //Puede ser 1=vendedor, 2=cobrador, 3=ambos | 6 | table.integer('rol'); |
7 | table.integer('rol'); | 7 | table.decimal('comisionCobrador', 12, 2); |
8 | table.decimal('comisionCobrador', 12, 2); | 8 | }) |
9 | }) | 9 | .table('CLIENTES', function(table) { |
10 | .table('CLIENTES', function(table) { | 10 | table.bigInteger('idCobrador').unsigned(); |
11 | table.bigInteger('idCobrador').unsigned(); | 11 | }); |
12 | }) | ||
13 | ]); | ||
14 | }; | 12 | }; |
15 | 13 | ||
16 | exports.down = function(knex, Promise) { | 14 | exports.down = function(knex) { |
17 | return Promise.all([ | 15 | return knex.schema |
18 | knex.schema | 16 | .table('VENDEDORES', function(table) { |
19 | .table('VENDEDORES', function(table) { | 17 | table.dropColumns('rol', 'comisionCobrador'); |
20 | table.dropColumns('rol', 'comisionCobrador'); | 18 | }) |
21 | }) | 19 | .table('CLIENTES', function(table) { |
22 | .table('CLIENTES', function(table) { | 20 | table.dropColumn('idCobrador'); |
23 | table.dropColumn('idCobrador'); | 21 | }); |
24 | }) | ||
25 | ]); | ||
26 | }; | 22 | }; |
27 | 23 |
migrations/20190131161852_v0.6.20.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema |
3 | knex.schema | 3 | .raw("ALTER TABLE ADETREC ADD id INT IDENTITY(1,1)") |
4 | .raw("ALTER TABLE ADETREC ADD id INT IDENTITY(1,1)") | 4 | .table('ADETREC', function(table) { |
5 | .table('ADETREC', function(table) { | 5 | table.bigInteger('idArecibos'); |
6 | table.bigInteger('idArecibos'); | 6 | }); |
7 | }) | ||
8 | ]); | ||
9 | }; | 7 | }; |
10 | 8 | ||
11 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
12 | return Promise.all([ | 10 | return knex.schema |
13 | knex.schema | 11 | .table('ADETREC', function(table) { |
14 | .table('ADETREC', function(table) { | 12 | table.dropColumns('id', 'idArecibos'); |
15 | table.dropColumns('id', 'idArecibos'); | 13 | }); |
16 | }) | ||
17 | ]); | ||
18 | }; | 14 | }; |
19 | 15 |
migrations/20190207113109_v0.7.0.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.raw('UPDATE VENDEDORES SET desactivado = 0, rol = 1'); |
3 | knex.schema.raw('UPDATE VENDEDORES SET desactivado = 0, rol = 1') | ||
4 | ]); | ||
5 | }; | 3 | }; |
6 | 4 | ||
7 | exports.down = function(knex, Promise) { | 5 | exports.down = function(knex) { |
8 | return Promise.all([ | 6 | return knex.schema.raw('UPDATE VENDEDORES SET desactivado = null, rol = null'); |
9 | knex.schema.raw('UPDATE VENDEDORES SET desactivado = null, rol = null') | ||
10 | ]); | ||
11 | }; | 7 | }; |
12 | 8 |
migrations/20190208131322_0.7.1.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return knex.schema.table('AVENDCLI', function(table) { | 2 | return knex.schema.table('AVENDCLI', function(table) { |
3 | table.string('domicilio'); | 3 | table.string('domicilio'); |
4 | table.bigInteger('idLocalidad').unsigned(); | 4 | table.bigInteger('idLocalidad').unsigned(); |
5 | table.bigInteger('idProvincia').unsigned(); | 5 | table.bigInteger('idProvincia').unsigned(); |
6 | table.integer('codigoPostal').unsigned(); | 6 | table.integer('codigoPostal').unsigned(); |
7 | table.string('telefono'); | 7 | table.string('telefono'); |
8 | table.integer('dni'); | 8 | table.integer('dni'); |
9 | table.boolean('desactivado').notNullable().defaultTo(0); | 9 | table.boolean('desactivado').notNullable().defaultTo(0); |
10 | table.tinyint('turno').notNullable().defaultTo(0); | 10 | table.tinyint('turno').notNullable().defaultTo(0); |
11 | //Puede ser 1=vendedor, 2=cobrador, 3=ambos | 11 | //Puede ser 1=vendedor, 2=cobrador, 3=ambos |
12 | table.integer('rol').notNullable().defaultTo(1); | 12 | table.integer('rol').notNullable().defaultTo(1); |
13 | table.bigInteger('idLogin').unsigned(); | 13 | table.bigInteger('idLogin').unsigned(); |
14 | table.decimal('comisionVendedor', 12, 2).notNullable().defaultTo(0); | 14 | table.decimal('comisionVendedor', 12, 2).notNullable().defaultTo(0); |
15 | table.decimal('comisionCobrador', 12, 2).notNullable().defaultTo(0); | 15 | table.decimal('comisionCobrador', 12, 2).notNullable().defaultTo(0); |
16 | }).raw("ALTER TABLE AVENDCLI ADD id INT IDENTITY(1,1)") | 16 | }).raw("ALTER TABLE AVENDCLI ADD id INT IDENTITY(1,1)") |
17 | }; | 17 | }; |
18 | 18 | ||
19 | exports.down = function(knex, Promise) { | 19 | exports.down = function(knex, Promise) { |
20 | // PARA HACER FUNCIONAR ESTE ROLLBACK HAY QUE BORRAR MANUALMENTE LAS CONSTRAINS QUE SE | 20 | // PARA HACER FUNCIONAR ESTE ROLLBACK HAY QUE BORRAR MANUALMENTE LAS CONSTRAINS QUE SE |
21 | // CREAN PARA SER VALORES POR DEFECTO | 21 | // CREAN PARA SER VALORES POR DEFECTO |
22 | return knex.schema.table('AVENDCLI', function(table) { | 22 | return knex.schema.table('AVENDCLI', function(table) { |
23 | table.dropColumns( | 23 | table.dropColumns( |
24 | 'id', | 24 | 'id', |
25 | 'domicilio', | 25 | 'domicilio', |
26 | 'idLocalidad', | 26 | 'idLocalidad', |
27 | 'idProvincia', | 27 | 'idProvincia', |
28 | 'codigoPostal', | 28 | 'codigoPostal', |
29 | 'telefono', | 29 | 'telefono', |
30 | 'dni', | 30 | 'dni', |
31 | 'idLogin', | 31 | 'idLogin', |
32 | 'desactivado', | 32 | 'desactivado', |
33 | 'turno', | 33 | 'turno', |
34 | 'rol', | 34 | 'rol', |
35 | 'comisionVendedor', | 35 | 'comisionVendedor', |
36 | 'comisionCobrador' | 36 | 'comisionCobrador' |
37 | ); | 37 | ); |
38 | }) | 38 | }) |
39 | }; | 39 | }; |
40 | 40 |
migrations/20190212103514_v0.7.2.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.table('seguimiento', function(table) { |
4 | knex.schema.table('seguimiento', function(table) { | 4 | //KM RECORRIDOS DESDE EL PUNTO ANTERIOR O DESDE LA EMPRESA |
5 | //KM RECORRIDOS DESDE EL PUNTO ANTERIOR O DESDE LA EMPRESA | 5 | table.decimal('kmRecorridos', 18, 4); |
6 | table.decimal('kmRecorridos', 18, 4); | 6 | }); |
7 | }) | ||
8 | ]); | ||
9 | }; | 7 | }; |
10 | 8 | ||
11 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
12 | return Promise.all([ | 10 | return knex.schema.table('seguimiento', function(table) { |
13 | knex.schema.table('seguimiento', function(table) { | 11 | table.dropColumn('kmRecorridos'); |
14 | table.dropColumn('kmRecorridos'); | 12 | }); |
15 | }) | ||
16 | ]); | ||
17 | }; | 13 | }; |
18 | 14 |
migrations/20190215123700_v0.7.3.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema | 4 | .table('nota_pedido', function(table) { |
5 | .table('nota_pedido', function(table) { | 5 | table.string('observaciones'); |
6 | table.string('observaciones'); | 6 | }) |
7 | }) | 7 | .table('remito', function(table) { |
8 | .table('remito', function(table) { | 8 | table.string('observaciones'); |
9 | table.string('observaciones'); | 9 | }); |
10 | }) | ||
11 | ]); | ||
12 | }; | 10 | }; |
13 | 11 | ||
14 | exports.down = function(knex, Promise) { | 12 | exports.down = function(knex) { |
15 | return Promise.all([ | 13 | return knex.schema |
16 | knex.schema | 14 | .table('nota_pedido', function(table) { |
17 | .table('nota_pedido', function(table) { | 15 | table.dropColumn('observaciones'); |
18 | table.dropColumn('observaciones'); | 16 | }) |
19 | }) | 17 | .table('remito', function(table) { |
20 | .table('remito', function(table) { | 18 | table.dropColumn('observaciones'); |
21 | table.dropColumn('observaciones'); | 19 | }); |
22 | }) | ||
23 | ]); | ||
24 | }; | 20 | }; |
25 | 21 |
migrations/20190220100315_v0.7.4.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex) { |
2 | return Promise.all([ | 2 | return knex.schema.raw( |
3 | knex.schema.raw( | ||
4 | "if not exists (SELECT * FROM dbo.sysobjects where id = object_id("+ | 3 | "if not exists (SELECT * FROM dbo.sysobjects where id = object_id("+ |
5 | "N'dbo.[ACOBYPAG_VENCIMIENTOS]') and OBJECTPROPERTY(id, N'IsTable') = 1) begin "+ | 4 | "N'dbo.[ACOBYPAG_VENCIMIENTOS]') and OBJECTPROPERTY(id, N'IsTable') = 1) begin "+ |
6 | "CREATE TABLE ACOBYPAG_VENCIMIENTOS(" + | 5 | "CREATE TABLE ACOBYPAG_VENCIMIENTOS(" + |
7 | "[CYV] [char](1) NOT NULL," + | 6 | "[CYV] [char](1) NOT NULL," + |
8 | "[COD] [int] NOT NULL," + | 7 | "[COD] [int] NOT NULL," + |
9 | "[FEP] [smalldatetime] NOT NULL," + | 8 | "[FEP] [smalldatetime] NOT NULL," + |
10 | "[TIP] [char](1) NOT NULL," + | 9 | "[TIP] [char](1) NOT NULL," + |
11 | "[TCO] [char](2) NOT NULL," + | 10 | "[TCO] [char](2) NOT NULL," + |
12 | "[SUC] [int] NOT NULL," + | 11 | "[SUC] [int] NOT NULL," + |
13 | "[NCO] [bigint] NOT NULL," + | 12 | "[NCO] [bigint] NOT NULL," + |
14 | "[NCU] [bigint] NOT NULL," + | 13 | "[NCU] [bigint] NOT NULL," + |
15 | "[IPA] [money] NOT NULL," + | 14 | "[IPA] [money] NOT NULL," + |
16 | "[SAL] [money] NOT NULL," + | 15 | "[SAL] [money] NOT NULL," + |
17 | "[TCA] [money] NOT NULL," + | 16 | "[TCA] [money] NOT NULL," + |
18 | "[ZONA] [int] NOT NULL," + | 17 | "[ZONA] [int] NOT NULL," + |
19 | "[FPA] [char](1) NOT NULL," + | 18 | "[FPA] [char](1) NOT NULL," + |
20 | "[REC] [bigint] NOT NULL," + | 19 | "[REC] [bigint] NOT NULL," + |
21 | "[REP] [bigint] NOT NULL," + | 20 | "[REP] [bigint] NOT NULL," + |
22 | "[FER] [smalldatetime] NULL," + | 21 | "[FER] [smalldatetime] NULL," + |
23 | "[REM] [bigint] NOT NULL," + | 22 | "[REM] [bigint] NOT NULL," + |
24 | "[FRE] [smalldatetime] NULL," + | 23 | "[FRE] [smalldatetime] NULL," + |
25 | "[PRO] [char](1) NOT NULL," + | 24 | "[PRO] [char](1) NOT NULL," + |
26 | "[FEV] [datetime] NULL," + | 25 | "[FEV] [datetime] NULL," + |
27 | "[ANU] [char](1) NOT NULL," + | 26 | "[ANU] [char](1) NOT NULL," + |
28 | "[CCU] [int] NOT NULL," + | 27 | "[CCU] [int] NOT NULL," + |
29 | "[UCU] [int] NOT NULL," + | 28 | "[UCU] [int] NOT NULL," + |
30 | "[PLA] [int] NOT NULL," + | 29 | "[PLA] [int] NOT NULL," + |
31 | "[LUG] [int] NOT NULL," + | 30 | "[LUG] [int] NOT NULL," + |
32 | "[PFA] [char](1) NOT NULL," + | 31 | "[PFA] [char](1) NOT NULL," + |
33 | "[RES] [int] NOT NULL," + | 32 | "[RES] [int] NOT NULL," + |
34 | "[LEG] [varchar](15) NOT NULL," + | 33 | "[LEG] [varchar](15) NOT NULL," + |
35 | "[CTA] [int] NOT NULL," + | 34 | "[CTA] [int] NOT NULL," + |
36 | "[FAR] [bit] NOT NULL," + | 35 | "[FAR] [bit] NOT NULL," + |
37 | "[HOS] [varchar](1) NOT NULL," + | 36 | "[HOS] [varchar](1) NOT NULL," + |
38 | "[E_HD] [varchar](8) NOT NULL," + | 37 | "[E_HD] [varchar](8) NOT NULL," + |
39 | "[C_HD] [varchar](1) NOT NULL," + | 38 | "[C_HD] [varchar](1) NOT NULL," + |
40 | "[DIC_SEL] [int] NOT NULL," + | 39 | "[DIC_SEL] [int] NOT NULL," + |
41 | "[SALDO_CALC] [money] NOT NULL," + | 40 | "[SALDO_CALC] [money] NOT NULL," + |
42 | "[IDLP] [varchar](1) NOT NULL," + | 41 | "[IDLP] [varchar](1) NOT NULL," + |
43 | "[ES_CANJE] [bit] NOT NULL," + | 42 | "[ES_CANJE] [bit] NOT NULL," + |
44 | "[CAMBIO_APLICADO] [varchar](50) NOT NULL," + | 43 | "[CAMBIO_APLICADO] [varchar](50) NOT NULL," + |
45 | "[TIPO_CANJE] [bit] NOT NULL," + | 44 | "[TIPO_CANJE] [bit] NOT NULL," + |
46 | "[ORD_COM] [int] NOT NULL," + | 45 | "[ORD_COM] [int] NOT NULL," + |
47 | "[NATHB] [varchar](1) NOT NULL," + | 46 | "[NATHB] [varchar](1) NOT NULL," + |
48 | "CONSTRAINT [PK_ACOBYPAG_VENCIMIENTOS] PRIMARY KEY CLUSTERED" + | 47 | "CONSTRAINT [PK_ACOBYPAG_VENCIMIENTOS] PRIMARY KEY CLUSTERED" + |
49 | "(" + | 48 | "(" + |
50 | "[CYV] ASC," + | 49 | "[CYV] ASC," + |
51 | "[COD] ASC," + | 50 | "[COD] ASC," + |
52 | "[FEP] ASC," + | 51 | "[FEP] ASC," + |
53 | "[TIP] ASC," + | 52 | "[TIP] ASC," + |
54 | "[TCO] ASC," + | 53 | "[TCO] ASC," + |
55 | "[SUC] ASC," + | 54 | "[SUC] ASC," + |
56 | "[NCO] ASC," + | 55 | "[NCO] ASC," + |
57 | "[NCU] ASC" + | 56 | "[NCU] ASC" + |
58 | ")WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]" + | 57 | ")WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]" + |
59 | ") ON [PRIMARY]" + | 58 | ") ON [PRIMARY]" + |
60 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_IPA] DEFAULT ((0)) FOR [IPA]" + | 59 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_IPA] DEFAULT ((0)) FOR [IPA]" + |
61 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_SAL] DEFAULT ((0)) FOR [SAL]" + | 60 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_SAL] DEFAULT ((0)) FOR [SAL]" + |
62 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_TCA] DEFAULT ((1)) FOR [TCA]" + | 61 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_TCA] DEFAULT ((1)) FOR [TCA]" + |
63 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_ZONA] DEFAULT (' ') FOR [ZONA]" + | 62 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_ZONA] DEFAULT (' ') FOR [ZONA]" + |
64 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_FPA] DEFAULT ((1)) FOR [FPA]" + | 63 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_FPA] DEFAULT ((1)) FOR [FPA]" + |
65 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_REC] DEFAULT ((0)) FOR [REC]" + | 64 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_REC] DEFAULT ((0)) FOR [REC]" + |
66 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_REP] DEFAULT ((0)) FOR [REP]" + | 65 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_REP] DEFAULT ((0)) FOR [REP]" + |
67 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_REM] DEFAULT ((0)) FOR [REM]" + | 66 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_REM] DEFAULT ((0)) FOR [REM]" + |
68 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_PRO] DEFAULT ('N') FOR [PRO]" + | 67 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_PRO] DEFAULT ('N') FOR [PRO]" + |
69 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_ANU] DEFAULT (' ') FOR [ANU]" + | 68 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_ANU] DEFAULT (' ') FOR [ANU]" + |
70 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_CCU] DEFAULT ((0)) FOR [CCU]" + | 69 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_CCU] DEFAULT ((0)) FOR [CCU]" + |
71 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_UCU] DEFAULT ((0)) FOR [UCU]" + | 70 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_UCU] DEFAULT ((0)) FOR [UCU]" + |
72 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_PLA] DEFAULT ((0)) FOR [PLA]" + | 71 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_PLA] DEFAULT ((0)) FOR [PLA]" + |
73 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_LUG] DEFAULT ((0)) FOR [LUG]" + | 72 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_LUG] DEFAULT ((0)) FOR [LUG]" + |
74 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_PFA] DEFAULT ('N') FOR [PFA]" + | 73 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_PFA] DEFAULT ('N') FOR [PFA]" + |
75 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_RES] DEFAULT ((0)) FOR [RES]" + | 74 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_RES] DEFAULT ((0)) FOR [RES]" + |
76 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_LEG] DEFAULT ('') FOR [LEG]" + | 75 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_LEG] DEFAULT ('') FOR [LEG]" + |
77 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_CTA] DEFAULT ((0)) FOR [CTA]" + | 76 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_CTA] DEFAULT ((0)) FOR [CTA]" + |
78 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_FAR] DEFAULT ((0)) FOR [FAR]" + | 77 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF_ACOBYPAG_VENCIMIENTOS_FAR] DEFAULT ((0)) FOR [FAR]" + |
79 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF__ACOBYPAG_VENCIMIENTOS__HOS__383BDA07] DEFAULT ('') FOR [HOS]" + | 78 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF__ACOBYPAG_VENCIMIENTOS__HOS__383BDA07] DEFAULT ('') FOR [HOS]" + |
80 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF__ACOBYPAG_VENCIMIENTOS__E_HD__50D27DA7] DEFAULT ('') FOR [E_HD]" + | 79 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF__ACOBYPAG_VENCIMIENTOS__E_HD__50D27DA7] DEFAULT ('') FOR [E_HD]" + |
81 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF__ACOBYPAG_VENCIMIENTOS__C_HD__51C6A1E0] DEFAULT ('') FOR [C_HD]" + | 80 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD CONSTRAINT [DF__ACOBYPAG_VENCIMIENTOS__C_HD__51C6A1E0] DEFAULT ('') FOR [C_HD]" + |
82 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [DIC_SEL]" + | 81 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [DIC_SEL]" + |
83 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [SALDO_CALC]" + | 82 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [SALDO_CALC]" + |
84 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ('') FOR [IDLP]" + | 83 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ('') FOR [IDLP]" + |
85 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [ES_CANJE]" + | 84 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [ES_CANJE]" + |
86 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ('') FOR [CAMBIO_APLICADO]" + | 85 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ('') FOR [CAMBIO_APLICADO]" + |
87 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [TIPO_CANJE]" + | 86 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [TIPO_CANJE]" + |
88 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [ORD_COM]" + | 87 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ((0)) FOR [ORD_COM]" + |
89 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ('') FOR [NATHB]" + | 88 | "ALTER TABLE ACOBYPAG_VENCIMIENTOS ADD DEFAULT ('') FOR [NATHB]" + |
90 | " end" | 89 | " end" |
91 | ).raw( | 90 | ).raw( |
92 | "if OBJECT_ID('[dbo].[VI_ACOBYPAG_AMAEFACT]') is not null "+ | 91 | "if OBJECT_ID('[dbo].[VI_ACOBYPAG_AMAEFACT]') is not null "+ |
93 | "begin " + | 92 | "begin " + |
94 | "drop view VI_ACOBYPAG_AMAEFACT "+ | 93 | "drop view VI_ACOBYPAG_AMAEFACT "+ |
95 | "end " + | 94 | "end " + |
96 | "execute(' " + | 95 | "execute(' " + |
97 | "CREATE VIEW [VI_ACOBYPAG_AMAEFACT]" + | 96 | "CREATE VIEW [VI_ACOBYPAG_AMAEFACT]" + |
98 | "AS " + | 97 | "AS " + |
99 | "SELECT A.*, A.FEP as FECHA_COMPROBANTE, C.ID_MONEDA AS MONEDA,C.COTIZACION AS COTIZACION," + | 98 | "SELECT A.*, A.FEP as FECHA_COMPROBANTE, C.ID_MONEDA AS MONEDA,C.COTIZACION AS COTIZACION," + |
100 | "B.COD AS CODIGO_CLIENTE,B.NOM AS NOMBRE_CLIENTE,B.DOM AS DOMICILIO_CLIENTE,B.LOC AS LOCALIDAD,B.PCI AS PROVINCIA,B.CPO AS CODIGO_POSTAL," + | 99 | "B.COD AS CODIGO_CLIENTE,B.NOM AS NOMBRE_CLIENTE,B.DOM AS DOMICILIO_CLIENTE,B.LOC AS LOCALIDAD,B.PCI AS PROVINCIA,B.CPO AS CODIGO_POSTAL," + |
101 | "C.NET AS NETO," + | 100 | "C.NET AS NETO," + |
102 | "C.NEE AS NETO_EXENTO," + | 101 | "C.NEE AS NETO_EXENTO," + |
103 | "C.IRI + C.IRS AS IVA," + | 102 | "C.IRI + C.IRS AS IVA," + |
104 | "C.IMI + C.IMI2 + C.IMI3 AS IMPUESTOS_INTERNOS," + | 103 | "C.IMI + C.IMI2 + C.IMI3 AS IMPUESTOS_INTERNOS," + |
105 | "C.PER AS PERCEPCION_IIBB," + | 104 | "C.PER AS PERCEPCION_IIBB," + |
106 | "C.PER_IVA AS PERCECPION_IVA," + | 105 | "C.PER_IVA AS PERCECPION_IVA," + |
107 | "C.TOT AS TOTAL " + | 106 | "C.TOT AS TOTAL " + |
108 | "FROM ACOBYPAG A " + | 107 | "FROM ACOBYPAG A " + |
109 | "FULL OUTER 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 " + | 108 | "FULL OUTER 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 " + |
110 | "INNER JOIN CLIENTES B ON A.COD=B.COD"+ | 109 | "INNER JOIN CLIENTES B ON A.COD=B.COD"+ |
111 | " ')" | 110 | " ')" |
112 | ).raw( | 111 | ).raw( |
113 | "if OBJECT_ID('[dbo].[VI_ACOBYPAG_VENCIMIENTOS]') is not null "+ | 112 | "if OBJECT_ID('[dbo].[VI_ACOBYPAG_VENCIMIENTOS]') is not null "+ |
114 | "begin " + | 113 | "begin " + |
115 | "drop view VI_ACOBYPAG_VENCIMIENTOS "+ | 114 | "drop view VI_ACOBYPAG_VENCIMIENTOS "+ |
116 | "end " + | 115 | "end " + |
117 | "execute(' " + | 116 | "execute(' " + |
118 | "CREATE VIEW [VI_ACOBYPAG_VENCIMIENTOS]" + | 117 | "CREATE VIEW [VI_ACOBYPAG_VENCIMIENTOS]" + |
119 | "AS " + | 118 | "AS " + |
120 | "SELECT A.*,B.FEP AS FECHA_COMPROBANTE,C.ID_MONEDA AS MONEDA,C.COTIZACION AS COTIZACION," + | 119 | "SELECT A.*,B.FEP AS FECHA_COMPROBANTE,C.ID_MONEDA AS MONEDA,C.COTIZACION AS COTIZACION," + |
121 | "C.NET AS NETO," + | 120 | "C.NET AS NETO," + |
122 | "C.NEE AS NETO_EXENTO," + | 121 | "C.NEE AS NETO_EXENTO," + |
123 | "C.IRI + C.IRS AS IVA," + | 122 | "C.IRI + C.IRS AS IVA," + |
124 | "C.IMI + C.IMI2 + C.IMI3 AS IMPUESTOS_INTERNOS," + | 123 | "C.IMI + C.IMI2 + C.IMI3 AS IMPUESTOS_INTERNOS," + |
125 | "C.PER AS PERCEPCION_IIBB," + | 124 | "C.PER AS PERCEPCION_IIBB," + |
126 | "C.PER_IVA AS PERCECPION_IVA," + | 125 | "C.PER_IVA AS PERCECPION_IVA," + |
127 | "C.TOT AS TOTAL " + | 126 | "C.TOT AS TOTAL " + |
128 | "FROM ACOBYPAG_VENCIMIENTOS A " + | 127 | "FROM ACOBYPAG_VENCIMIENTOS A " + |
129 | "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 " + | 128 | "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 " + |
130 | "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" + | 129 | "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" + |
131 | " ')" | 130 | " ')" |
132 | ) | 131 | ); |
133 | ]) | ||
134 | }; | 132 | }; |
135 | 133 | ||
136 | exports.down = function(knex, Promise) { | 134 | exports.down = function(knex) { |
137 | return Promise.all([ | 135 | return knex.schema |
138 | knex.schema.dropTable('ACOBYPAG_VENCIMIENTOS') | 136 | .dropTable('ACOBYPAG_VENCIMIENTOS') |
139 | .raw("DROP VIEW [VI_ACOBYPAG_AMAEFACT]") | 137 | .raw("DROP VIEW [VI_ACOBYPAG_AMAEFACT]") |
140 | .raw("DROP VIEW [VI_ACOBYPAG_VENCIMIENTOS]") | 138 | .raw("DROP VIEW [VI_ACOBYPAG_VENCIMIENTOS]"); |
141 | ]) | ||
142 | }; | 139 | }; |
143 | 140 |
migrations/20190220121752_v0.7.5.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.createTable('adetrec_observaciones', function(table) { |
4 | knex.schema.createTable('adetrec_observaciones', function(table) { | ||
5 | table.increments(); | 4 | table.increments(); |
6 | table.string('observacion'); | 5 | table.string('observacion'); |
7 | table.bigInteger('idAdetrec').unsigned(); | 6 | table.bigInteger('idAdetrec').unsigned(); |
8 | }) | 7 | }); |
9 | ]); | ||
10 | }; | 8 | }; |
11 | 9 | ||
12 | exports.down = function(knex, Promise) { | 10 | exports.down = function(knex) { |
13 | return Promise.all([ | 11 | return knex.schema.dropTable('adetrec_observaciones'); |
14 | knex.schema | ||
15 | .dropTable('adetrec_observaciones') | ||
16 | ]); | ||
17 | }; | 12 | }; |
18 | 13 |
migrations/20190221092657_v0.7.6.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema | 4 | .table('seguimiento', function(table) { |
5 | .table('seguimiento', function(table) { | 5 | table.bigInteger('idVisita').unsigned(); |
6 | table.bigInteger('idVisita').unsigned(); | 6 | }) |
7 | }) | 7 | .createTable('visita', function(table) { |
8 | .createTable('visita', function(table) { | 8 | table.increments(); |
9 | table.increments(); | 9 | table.bigInteger('idCliente').unsigned(); |
10 | table.bigInteger('idCliente').unsigned(); | 10 | table.bigInteger('idVisitante').unsigned(); |
11 | table.bigInteger('idVisitante').unsigned(); | 11 | }); |
12 | }) | ||
13 | ]); | ||
14 | }; | 12 | }; |
15 | 13 | ||
16 | exports.down = function(knex, Promise) { | 14 | exports.down = function(knex) { |
17 | return Promise.all([ | 15 | return knex.schema |
18 | knex.schema | 16 | .table('seguimiento', function(table) { |
19 | .table('seguimiento', function(table) { | 17 | table.dropColumn('idVisita'); |
20 | table.dropColumn('idVisita'); | 18 | }) |
21 | }) | 19 | .dropTable('visita'); |
22 | .dropTable('visita') | ||
23 | ]); | ||
24 | }; | 20 | }; |
25 | 21 |
migrations/20190225143232_v0.7.7.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return knex.schema | 3 | return knex.schema |
4 | .table('seguimiento', function(table) { | 4 | .table('seguimiento', function(table) { |
5 | table.dropColumn('idUsuario'); | 5 | table.dropColumn('idUsuario'); |
6 | }); | 6 | }); |
7 | }; | 7 | }; |
8 | 8 | ||
9 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
10 | return knex.schema | 10 | return knex.schema |
11 | .table('seguimiento', function(table) { | 11 | .table('seguimiento', function(table) { |
12 | table.bigInteger('idUsuario').unsigned(); | 12 | table.bigInteger('idUsuario').unsigned(); |
13 | }); | 13 | }); |
14 | }; | 14 | }; |
15 | 15 |
migrations/20190228111345_v0.7.8.js
1 | exports.up = function(knex, Promise) { | 1 | exports.up = function(knex, Promise) { |
2 | return knex.schema | 2 | return knex.schema |
3 | .table('articulo_nota_pedido', function(table) { | 3 | .table('articulo_nota_pedido', function(table) { |
4 | table.dropColumns( | 4 | table.dropColumns( |
5 | 'costoUnitario', 'exentoUnitario', 'impuestoInternoUnitario', | 5 | 'costoUnitario', 'exentoUnitario', 'impuestoInternoUnitario', |
6 | 'impuestoInterno1Unitario', 'impuestoInterno2Unitario', 'ivaServicioUnitario', | 6 | 'impuestoInterno1Unitario', 'impuestoInterno2Unitario', 'ivaServicioUnitario', |
7 | 'ivaUnitario', 'tasaIva'); | 7 | 'ivaUnitario', 'tasaIva'); |
8 | }).table('articulo_nota_pedido', function(table) { | 8 | }).table('articulo_nota_pedido', function(table) { |
9 | table.decimal('netoUnitario', 14, 4); | 9 | table.decimal('netoUnitario', 14, 4); |
10 | table.decimal('costoUnitario', 14, 4); | 10 | table.decimal('costoUnitario', 14, 4); |
11 | table.decimal('exentoUnitario', 14, 4); | 11 | table.decimal('exentoUnitario', 14, 4); |
12 | table.decimal('impuestoInternoUnitario', 14, 4); | 12 | table.decimal('impuestoInternoUnitario', 14, 4); |
13 | table.decimal('impuestoInterno1Unitario', 14, 4); | 13 | table.decimal('impuestoInterno1Unitario', 14, 4); |
14 | table.decimal('impuestoInterno2Unitario', 14, 4); | 14 | table.decimal('impuestoInterno2Unitario', 14, 4); |
15 | table.decimal('ivaServicioUnitario', 14, 4); | 15 | table.decimal('ivaServicioUnitario', 14, 4); |
16 | table.decimal('ivaUnitario', 14, 4); | 16 | table.decimal('ivaUnitario', 14, 4); |
17 | table.decimal('tasaIva', 14, 4); | 17 | table.decimal('tasaIva', 14, 4); |
18 | }).table('articulo_remito', function(table) { | 18 | }).table('articulo_remito', function(table) { |
19 | table.dropColumns( | 19 | table.dropColumns( |
20 | 'costoUnitario', 'exentoUnitario', 'impuestoInternoUnitario', | 20 | 'costoUnitario', 'exentoUnitario', 'impuestoInternoUnitario', |
21 | 'impuestoInterno1Unitario', 'impuestoInterno2Unitario', 'ivaServicioUnitario', | 21 | 'impuestoInterno1Unitario', 'impuestoInterno2Unitario', 'ivaServicioUnitario', |
22 | 'ivaUnitario', 'tasaIva'); | 22 | 'ivaUnitario', 'tasaIva'); |
23 | }).table('articulo_remito', function(table) { | 23 | }).table('articulo_remito', function(table) { |
24 | table.decimal('netoUnitario', 14, 4); | 24 | table.decimal('netoUnitario', 14, 4); |
25 | table.decimal('costoUnitario', 14, 4); | 25 | table.decimal('costoUnitario', 14, 4); |
26 | table.decimal('exentoUnitario', 14, 4); | 26 | table.decimal('exentoUnitario', 14, 4); |
27 | table.decimal('impuestoInternoUnitario', 14, 4); | 27 | table.decimal('impuestoInternoUnitario', 14, 4); |
28 | table.decimal('impuestoInterno1Unitario', 14, 4); | 28 | table.decimal('impuestoInterno1Unitario', 14, 4); |
29 | table.decimal('impuestoInterno2Unitario', 14, 4); | 29 | table.decimal('impuestoInterno2Unitario', 14, 4); |
30 | table.decimal('ivaServicioUnitario', 14, 4); | 30 | table.decimal('ivaServicioUnitario', 14, 4); |
31 | table.decimal('ivaUnitario', 14, 4); | 31 | table.decimal('ivaUnitario', 14, 4); |
32 | table.decimal('tasaIva', 14, 4); | 32 | table.decimal('tasaIva', 14, 4); |
33 | }) | 33 | }) |
34 | }; | 34 | }; |
35 | 35 | ||
36 | exports.down = function(knex, Promise) { | 36 | exports.down = function(knex, Promise) { |
37 | |||
38 | //PARA HACER FUNCIONAR ESTE ROLLBACK HAY QUE ELIMINAR MANUALMENTE LAS COLUMNAS | ||
37 | return knex.schema | 39 | return knex.schema |
38 | .table('articulo_nota_pedido', function(table) { | 40 | .table('articulo_nota_pedido', function(table) { |
39 | table.dropColumns('netoUnitario', 'costoUnitario', 'exentoUnitario', | 41 | table.dropColumns('netoUnitario', 'costoUnitario', 'exentoUnitario', |
40 | 'impuestoInternoUnitario', 'impuestoInterno1Unitario', 'impuestoInterno2Unitario', | 42 | 'impuestoInternoUnitario', 'impuestoInterno1Unitario', 'impuestoInterno2Unitario', |
41 | 'ivaServicioUnitario', 'ivaUnitario', 'tasaIva'); | 43 | 'ivaServicioUnitario', 'ivaUnitario', 'tasaIva'); |
42 | table.decimal('costoUnitario', 12, 2); | 44 | table.decimal('costoUnitario', 12, 2); |
43 | table.decimal('exentoUnitario', 12, 2); | 45 | table.decimal('exentoUnitario', 12, 2); |
44 | table.decimal('impuestoInternoUnitario', 12, 2); | 46 | table.decimal('impuestoInternoUnitario', 12, 2); |
45 | table.decimal('impuestoInterno1Unitario', 12, 2); | 47 | table.decimal('impuestoInterno1Unitario', 12, 2); |
46 | table.decimal('impuestoInterno2Unitario', 12, 2); | 48 | table.decimal('impuestoInterno2Unitario', 12, 2); |
47 | table.decimal('ivaServicioUnitario', 12, 2); | 49 | table.decimal('ivaServicioUnitario', 12, 2); |
48 | table.decimal('ivaUnitario', 12, 2); | 50 | table.decimal('ivaUnitario', 12, 2); |
49 | table.decimal('tasaIva', 12, 2); | 51 | table.decimal('tasaIva', 12, 2); |
50 | }).table('articulo_remito', function(table) { | 52 | }).table('articulo_remito', function(table) { |
51 | table.dropColumns('netoUnitario', 'costoUnitario', 'exentoUnitario', | 53 | table.dropColumns('netoUnitario', 'costoUnitario', 'exentoUnitario', |
52 | 'impuestoInternoUnitario', 'impuestoInterno1Unitario', 'impuestoInterno2Unitario', | 54 | 'impuestoInternoUnitario', 'impuestoInterno1Unitario', 'impuestoInterno2Unitario', |
53 | 'ivaServicioUnitario', 'ivaUnitario', 'tasaIva'); | 55 | 'ivaServicioUnitario', 'ivaUnitario', 'tasaIva'); |
54 | table.decimal('costoUnitario', 12, 2); | 56 | table.decimal('costoUnitario', 12, 2); |
55 | table.decimal('exentoUnitario', 12, 2); | 57 | table.decimal('exentoUnitario', 12, 2); |
56 | table.decimal('impuestoInternoUnitario', 12, 2); | 58 | table.decimal('impuestoInternoUnitario', 12, 2); |
57 | table.decimal('impuestoInterno1Unitario', 12, 2); | 59 | table.decimal('impuestoInterno1Unitario', 12, 2); |
58 | table.decimal('impuestoInterno2Unitario', 12, 2); | 60 | table.decimal('impuestoInterno2Unitario', 12, 2); |
59 | table.decimal('ivaServicioUnitario', 12, 2); | 61 | table.decimal('ivaServicioUnitario', 12, 2); |
60 | table.decimal('ivaUnitario', 12, 2); | 62 | table.decimal('ivaUnitario', 12, 2); |
61 | table.decimal('tasaIva', 12, 2); | 63 | table.decimal('tasaIva', 12, 2); |
62 | }) | 64 | }) |
63 | }; | 65 | }; |
64 | 66 |
migrations/20190311170816_v0.8.0.js
1 | const md5 = require('md5'); | 1 | const md5 = require('md5'); |
2 | 2 | ||
3 | exports.up = function(knex, Promise) { | 3 | exports.up = function(knex) { |
4 | 4 | ||
5 | return knex.schema | 5 | return knex.schema |
6 | .table('APAREMP', function(table) { | 6 | .table('APAREMP', function(table) { |
7 | 7 | ||
8 | table.string('idEmpresa'); | 8 | table.string('idEmpresa'); |
9 | }).then(function() { | 9 | }).then(function() { |
10 | return Promise.all([ | 10 | return knex('APAREMP').update({ idEmpresa: md5(new Date().getTime())}); |
11 | knex('APAREMP').update({ idEmpresa: md5(new Date().getTime())}) | ||
12 | ]); | ||
13 | }); | 11 | }); |
14 | 12 | ||
15 | }; | 13 | }; |
16 | 14 | ||
17 | exports.down = function(knex, Promise) { | 15 | exports.down = function(knex) { |
18 | return Promise.all([ | 16 | return knex.schema.table('APAREMP', function(table) { |
19 | knex.schema.table('APAREMP', function(table) { | 17 | table.dropColumn('idEmpresa'); |
20 | table.dropColumn('idEmpresa'); | 18 | }); |
21 | }) | ||
22 | ]); | ||
23 | }; | 19 | }; |
24 | 20 |
migrations/20190412094131_v0.9.0.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema | 4 | .createTable('remito_punto_descarga', function(table) { |
5 | .createTable('remito_punto_descarga', function(table) { | 5 | table.increments(); |
6 | table.increments(); | 6 | table.bigInteger('idPuntoDescarga').unsigned(); |
7 | table.bigInteger('idPuntoDescarga').unsigned(); | 7 | table.bigInteger('idRemito').unsigned(); |
8 | table.bigInteger('idRemito').unsigned(); | 8 | }); |
9 | }) | ||
10 | ]); | ||
11 | }; | 9 | }; |
12 | 10 | ||
13 | exports.down = function(knex, Promise) { | 11 | exports.down = function(knex) { |
14 | return Promise.all([ | 12 | return knex.schema.dropTable('remito_punto_descarga'); |
15 | knex.schema | ||
16 | .dropTable('remito_punto_descarga') | ||
17 | ]); | ||
18 | }; | 13 | }; |
19 | 14 |
migrations/20190425163004_v0.9.1.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema.createTable('parametros', function(table) { |
4 | knex.schema.createTable('parametros', function(table) { | 4 | table.increments(); |
5 | table.increments(); | 5 | table.string('modulo'); |
6 | table.string('modulo'); | 6 | table.string('jsonText', [4000]); |
7 | table.string('jsonText', [4000]); | 7 | table.string('jsonText2', [4000]); |
8 | table.string('jsonText2', [4000]); | 8 | }); |
9 | }) | ||
10 | ]); | ||
11 | }; | 9 | }; |
12 | 10 | ||
13 | exports.down = function(knex, Promise) { | 11 | exports.down = function(knex) { |
14 | return Promise.all([ | 12 | return knex.schema.dropTable('parametros'); |
15 | knex.schema.dropTable('parametros') | ||
16 | ]); | ||
17 | }; | 13 | }; |
18 | 14 |
migrations/20190524103556_v0.10.0.js
1 | 1 | ||
2 | exports.up = function (knex, Promise) { | 2 | exports.up = function (knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema | 4 | .table('nota_pedido', function (table) { |
5 | .table('nota_pedido', function (table) { | 5 | table.bigInteger('idListaPrecio').unsigned(); |
6 | table.bigInteger('idListaPrecio').unsigned(); | 6 | table.dropColumn('idPrecioCondicion'); |
7 | table.dropColumn('idPrecioCondicion'); | 7 | }) |
8 | }) | 8 | .table('plazo_pago', function (table) { |
9 | .table('plazo_pago', function (table) { | 9 | table.bigInteger('idCliente').unsigned(); |
10 | table.bigInteger('idCliente').unsigned(); | 10 | table.dropColumn('idPreciosCondiciones'); |
11 | table.dropColumn('idPreciosCondiciones'); | ||
12 | 11 | ||
13 | }) | 12 | }) |
14 | .table('remito', function (table) { | 13 | .table('remito', function (table) { |
15 | table.bigInteger('idListaPrecio').unsigned(); | 14 | table.bigInteger('idListaPrecio').unsigned(); |
16 | table.dropColumn('idPrecioCondicion'); | 15 | table.dropColumn('idPrecioCondicion'); |
17 | }) | 16 | }); |
18 | ]); | ||
19 | }; | 17 | }; |
20 | 18 | ||
21 | exports.down = function (knex, Promise) { | 19 | exports.down = function (knex, Promise) { |
22 | return Promise.all([ | 20 | return knex.schema |
23 | knex.schema | 21 | .table('nota_pedido', function (table) { |
24 | .table('nota_pedido', function (table) { | 22 | table.dropColumn('idListaPrecio'); |
25 | table.dropColumn('idListaPrecio'); | 23 | table.bigInteger('idPrecioCondicion').unsigned(); |
26 | table.bigInteger('idPrecioCondicion').unsigned(); | 24 | }) |
27 | }) | 25 | .table('plazo_pago', function (table) { |
28 | .table('plazo_pago', function (table) { | 26 | table.dropColumn('idCliente'); |
29 | table.dropColumn('idCliente'); | 27 | table.bigInteger('idPreciosCondiciones').unsigned(); |
30 | table.bigInteger('idPreciosCondiciones').unsigned(); | 28 | }) |
31 | }) | 29 | .table('remito', function (table) { |
32 | .table('remito', function (table) { | 30 | table.dropColumn('idListaPrecio'); |
33 | table.dropColumn('idListaPrecio'); | 31 | table.bigInteger('idPrecioCondicion').unsigned(); |
34 | table.bigInteger('idPrecioCondicion').unsigned(); | 32 | }); |
35 | }) | ||
36 | ]); | ||
37 | }; | 33 | }; |
38 | 34 |
migrations/20190611150606_v0.11.0.js
1 | 1 | ||
2 | exports.up = function(knex, Promise) { | 2 | exports.up = function(knex) { |
3 | return Promise.all([ | 3 | return knex.schema |
4 | knex.schema | 4 | .table('hoja_ruta', function (table) { |
5 | .table('hoja_ruta', function (table) { | 5 | table.bigInteger('abierta').unsigned(); |
6 | table.bigInteger('abierta').unsigned(); | 6 | }); |
7 | }) | ||
8 | ]); | ||
9 | }; | 7 | }; |
10 | 8 | ||
11 | exports.down = function(knex, Promise) { | 9 | exports.down = function(knex) { |
12 | return Promise.all([ | 10 | return knex.schema |
13 | knex.schema | 11 | .table('hoja_ruta', function (table) { |
14 | .table('hoja_ruta', function (table) { | 12 | table.dropColumn('abierta'); |
15 | table.dropColumn('abierta'); | 13 | }); |
16 | }) | ||
17 | ]); | ||
18 | }; | 14 | }; |
19 | 15 |
package.json
1 | { | 1 | { |
2 | "name": "backoffice", | 2 | "name": "backoffice", |
3 | "version": "1.0.0", | 3 | "version": "1.0.0", |
4 | "description": "Paquetes de migraciones", | 4 | "description": "Paquetes de migraciones", |
5 | "main": "knexfile.js", | 5 | "main": "knexfile.js", |
6 | "dependencies": { | 6 | "dependencies": { |
7 | "knex": "^0.18.2", | 7 | "bluebird": "^3.5.5", |
8 | "knex": "^0.18.3", | ||
9 | "md5": "^2.2.1", | ||
8 | "mssql": "^5.1.0" | 10 | "mssql": "^5.1.0" |
9 | }, | 11 | }, |
10 | "devDependencies": {}, | 12 | "devDependencies": {}, |
11 | "scripts": { | 13 | "scripts": { |
12 | "test": "echo \"Error: no test specified\" && exit 1" | 14 | "test": "echo \"Error: no test specified\" && exit 1", |
15 | "init": "npm install -g knex && npm install && knex init" | ||
13 | }, | 16 | }, |
14 | "repository": { | 17 | "repository": { |
15 | "type": "git", | 18 | "type": "git", |
16 | "url": "http://git.focasoftware.com/deploy/backoffice.git" | 19 | "url": "http://git.focasoftware.com/deploy/backoffice.git" |
17 | }, | 20 | }, |
18 | "author": "Foca Software", | 21 | "author": "Foca Software", |
19 | "license": "ISC" | 22 | "license": "ISC" |
20 | } | 23 | } |
21 | 24 |