From b0815f75ebe3ffbe9c17e1154978039ef5ed3b24 Mon Sep 17 00:00:00 2001 From: "WQY\\qiong" Date: Mon, 14 Nov 2022 20:02:45 +0800 Subject: [PATCH] Refine energy table --- script/sql/create/15.energy.sql | 17 +++++++++-------- script/sql/drop/15.energy.sql | 4 +++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/script/sql/create/15.energy.sql b/script/sql/create/15.energy.sql index 93c5481..9fd7bd5 100644 --- a/script/sql/create/15.energy.sql +++ b/script/sql/create/15.energy.sql @@ -1,16 +1,17 @@ -- [ENERGY] -create table energy_global +create table energy ( - _no integer primary key -, price numeric not null -, pattern varchar(32) references _pattern(id) -, effic numeric not null -, demand_charge numeric not null + key text primary key +, value text not null ); -insert into energy_global (_no, price, pattern, effic, demand_charge) - values (0, 0.0, null, 75, 0.0); +insert into energy (key, value) values + ('GLOBAL PRICE', '0.0') +, ('GLOBAL PATTERN', '') +, ('GLOBAL EFFIC', '75') +, ('DEMAND CHARGE', '0.0') +; create table energy_pump_price ( diff --git a/script/sql/drop/15.energy.sql b/script/sql/drop/15.energy.sql index cbf857d..d5a8d35 100644 --- a/script/sql/drop/15.energy.sql +++ b/script/sql/drop/15.energy.sql @@ -1,7 +1,9 @@ -- [ENERGY] drop table if exists energy_pump_effic; + drop table if exists energy_pump_pattern; + drop table if exists energy_pump_price; -drop table if exists energy_global; +drop table if exists energy;