20181213153525_0.5.js
2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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.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')
]);
};