@golemio/waze-tt 1.1.4 → 1.1.5-dev.827567826
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/migrations/postgresql/20230329083253-v_barrandov_bridge_route_live_unix.js +53 -0
- package/db/migrations/postgresql/20230404113923-pp20230404.js +53 -0
- package/db/migrations/postgresql/sqls/20230329083253-v_barrandov_bridge_route_live_unix-down.sql +19 -0
- package/db/migrations/postgresql/sqls/20230329083253-v_barrandov_bridge_route_live_unix-up.sql +20 -0
- package/db/migrations/postgresql/sqls/20230404113923-pp20230404-down.sql +1 -0
- package/db/migrations/postgresql/sqls/20230404113923-pp20230404-up.sql +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dbm;
|
|
4
|
+
var type;
|
|
5
|
+
var seed;
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
var Promise;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* We receive the dbmigrate dependency from dbmigrate initially.
|
|
12
|
+
* This enables us to not have to rely on NODE_PATH.
|
|
13
|
+
*/
|
|
14
|
+
exports.setup = function(options, seedLink) {
|
|
15
|
+
dbm = options.dbmigrate;
|
|
16
|
+
type = dbm.dataType;
|
|
17
|
+
seed = seedLink;
|
|
18
|
+
Promise = options.Promise;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.up = function(db) {
|
|
22
|
+
var filePath = path.join(__dirname, 'sqls', '20230329083253-v_barrandov_bridge_route_live_unix-up.sql');
|
|
23
|
+
return new Promise( function( resolve, reject ) {
|
|
24
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
25
|
+
if (err) return reject(err);
|
|
26
|
+
console.log('received data: ' + data);
|
|
27
|
+
|
|
28
|
+
resolve(data);
|
|
29
|
+
});
|
|
30
|
+
})
|
|
31
|
+
.then(function(data) {
|
|
32
|
+
return db.runSql(data);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.down = function(db) {
|
|
37
|
+
var filePath = path.join(__dirname, 'sqls', '20230329083253-v_barrandov_bridge_route_live_unix-down.sql');
|
|
38
|
+
return new Promise( function( resolve, reject ) {
|
|
39
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
40
|
+
if (err) return reject(err);
|
|
41
|
+
console.log('received data: ' + data);
|
|
42
|
+
|
|
43
|
+
resolve(data);
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
.then(function(data) {
|
|
47
|
+
return db.runSql(data);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports._meta = {
|
|
52
|
+
"version": 1
|
|
53
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dbm;
|
|
4
|
+
var type;
|
|
5
|
+
var seed;
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
var Promise;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* We receive the dbmigrate dependency from dbmigrate initially.
|
|
12
|
+
* This enables us to not have to rely on NODE_PATH.
|
|
13
|
+
*/
|
|
14
|
+
exports.setup = function(options, seedLink) {
|
|
15
|
+
dbm = options.dbmigrate;
|
|
16
|
+
type = dbm.dataType;
|
|
17
|
+
seed = seedLink;
|
|
18
|
+
Promise = options.Promise;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.up = function(db) {
|
|
22
|
+
var filePath = path.join(__dirname, 'sqls', '20230404113923-pp20230404-up.sql');
|
|
23
|
+
return new Promise( function( resolve, reject ) {
|
|
24
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
25
|
+
if (err) return reject(err);
|
|
26
|
+
console.log('received data: ' + data);
|
|
27
|
+
|
|
28
|
+
resolve(data);
|
|
29
|
+
});
|
|
30
|
+
})
|
|
31
|
+
.then(function(data) {
|
|
32
|
+
return db.runSql(data);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.down = function(db) {
|
|
37
|
+
var filePath = path.join(__dirname, 'sqls', '20230404113923-pp20230404-down.sql');
|
|
38
|
+
return new Promise( function( resolve, reject ) {
|
|
39
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
40
|
+
if (err) return reject(err);
|
|
41
|
+
console.log('received data: ' + data);
|
|
42
|
+
|
|
43
|
+
resolve(data);
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
.then(function(data) {
|
|
47
|
+
return db.runSql(data);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports._meta = {
|
|
52
|
+
"version": 1
|
|
53
|
+
};
|
package/db/migrations/postgresql/sqls/20230329083253-v_barrandov_bridge_route_live_unix-down.sql
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
DROP VIEW analytic.v_barrandov_bridge_route_live;
|
|
2
|
+
|
|
3
|
+
CREATE OR REPLACE VIEW analytic.v_barrandov_bridge_route_live
|
|
4
|
+
AS SELECT wrl.route_id,
|
|
5
|
+
wrl.update_time,
|
|
6
|
+
wrl."time",
|
|
7
|
+
wrl.length,
|
|
8
|
+
wrl.historic_time,
|
|
9
|
+
wrl.jam_level,
|
|
10
|
+
wrl.create_batch_id,
|
|
11
|
+
wrl.created_at,
|
|
12
|
+
wrl.created_by,
|
|
13
|
+
wrl.update_batch_id,
|
|
14
|
+
wrl.updated_at,
|
|
15
|
+
wrl.updated_by
|
|
16
|
+
FROM wazett.wazett_route_lives wrl
|
|
17
|
+
WHERE (wrl.route_id IN ( SELECT DISTINCT wazett_routes.id
|
|
18
|
+
FROM wazett.wazett_routes
|
|
19
|
+
WHERE wazett_routes.name ~~ 'BM %'::text)) AND wrl.update_time::double precision >= (date_part('epoch'::text, CURRENT_DATE - '7 days'::interval) * 1000::double precision);
|
package/db/migrations/postgresql/sqls/20230329083253-v_barrandov_bridge_route_live_unix-up.sql
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
DROP VIEW analytic.v_barrandov_bridge_route_live;
|
|
2
|
+
|
|
3
|
+
CREATE OR REPLACE VIEW analytic.v_barrandov_bridge_route_live
|
|
4
|
+
AS SELECT wrl.route_id,
|
|
5
|
+
to_timestamp((wrl.update_time / 1000)::double precision) AS update_time,
|
|
6
|
+
wrl."time",
|
|
7
|
+
wrl.length,
|
|
8
|
+
wrl.historic_time,
|
|
9
|
+
wrl.jam_level,
|
|
10
|
+
wrl.create_batch_id,
|
|
11
|
+
wrl.created_at,
|
|
12
|
+
wrl.created_by,
|
|
13
|
+
wrl.update_batch_id,
|
|
14
|
+
wrl.updated_at,
|
|
15
|
+
wrl.updated_by
|
|
16
|
+
FROM wazett.wazett_route_lives wrl
|
|
17
|
+
WHERE (wrl.route_id IN ( SELECT DISTINCT wazett_routes.id
|
|
18
|
+
FROM wazett.wazett_routes
|
|
19
|
+
WHERE wazett_routes.name ~~ 'BM %'::text)) AND wrl.update_time::double precision >= (date_part('epoch'::text, CURRENT_DATE - '7 days'::interval) * 1000::double precision);
|
|
20
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Drop view analytic.v_sck_last_update;
|