@golemio/energetics 1.16.0-dev.2846140746 → 1.16.0-dev.2854171782

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.
@@ -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', '20260914090000-enapo-eb-consumption-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', '20260914090000-enapo-eb-consumption-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 @@
1
+ DROP TABLE IF EXISTS enapo_eb_consumption;
@@ -0,0 +1,27 @@
1
+ CREATE TABLE enapo_eb_consumption (
2
+ idodbmisto_rspotrebyfa bigint NOT NULL,
3
+ idodbmistoom bigint NOT NULL,
4
+ ean_eic varchar NULL,
5
+ komodita smallint NOT NULL,
6
+ datum_od date NOT NULL,
7
+ datum_do date NOT NULL,
8
+ spotreba_vt numeric NULL,
9
+ spotreba_nt numeric NULL,
10
+ spotreba_mwh numeric NULL,
11
+ rok smallint NULL,
12
+ created_at timestamptz NULL DEFAULT now(),
13
+ CONSTRAINT enapo_eb_consumption_pk PRIMARY KEY (idodbmisto_rspotrebyfa)
14
+ );
15
+
16
+ COMMENT ON TABLE enapo_eb_consumption IS 'One-off historical consumption import from the Energy Broker export (praha-zaznamy-*.xlsx, sheet odbmisto_rspotrebyfa), electricity + gas only, years 2023-2026. Loaded manually as a single batch, not maintained by any cron. All consumption values are in MWh. Out of scope: heat/water and years 2014-2022.';
17
+ COMMENT ON COLUMN enapo_eb_consumption.idodbmisto_rspotrebyfa IS 'Source row id from odbmisto_rspotrebyfa; primary key so a re-run of the manual load stays idempotent.';
18
+ COMMENT ON COLUMN enapo_eb_consumption.idodbmistoom IS 'Consumption point id (odbmisto_om) used for pairing back to the source and to metadata.';
19
+ COMMENT ON COLUMN enapo_eb_consumption.ean_eic IS 'EAN (electricity) / EIC (gas) resolved via odbmisto_om; join key to enapo_gid_mapping.place_id.';
20
+ COMMENT ON COLUMN enapo_eb_consumption.komodita IS 'Source commodity code: 1 = electricity, 2 = gas.';
21
+ COMMENT ON COLUMN enapo_eb_consumption.spotreba_vt IS 'High-tariff consumption for the billing period, in MWh.';
22
+ COMMENT ON COLUMN enapo_eb_consumption.spotreba_nt IS 'Low-tariff consumption for the billing period, in MWh.';
23
+ COMMENT ON COLUMN enapo_eb_consumption.spotreba_mwh IS 'Total consumption for the billing period, in MWh.';
24
+ COMMENT ON COLUMN enapo_eb_consumption.rok IS 'Year derived from datum_od; kept denormalized for the coverage check against the live integration.';
25
+
26
+ CREATE INDEX enapo_eb_consumption_ean_eic_idx ON enapo_eb_consumption (ean_eic);
27
+ CREATE INDEX enapo_eb_consumption_komodita_rok_idx ON enapo_eb_consumption (komodita, rok);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/energetics",
3
- "version": "1.16.0-dev.2846140746",
3
+ "version": "1.16.0-dev.2854171782",
4
4
  "description": "Golemio Energetics Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",