added new datbase myesm_carbon_db
parent
ff0105ab27
commit
910afa03c9
|
@ -22,6 +22,7 @@ Execute the following scripts in MySQL commandline, or execute in other MySQL cl
|
|||
cd myems/database/install
|
||||
mysql -u root -p < myems_billing_baseline_db.sql
|
||||
mysql -u root -p < myems_billing_db.sql
|
||||
mysql -u root -p < myems_carbon_db.sql
|
||||
mysql -u root -p < myems_energy_baseline_db.sql
|
||||
mysql -u root -p < myems_energy_db.sql
|
||||
mysql -u root -p < myems_fdd_db.sql
|
||||
|
|
|
@ -0,0 +1,257 @@
|
|||
-- MyEMS Carbon Emission Database
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Schema myems_carbon_db
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS `myems_carbon_db` ;
|
||||
CREATE DATABASE IF NOT EXISTS `myems_carbon_db` ;
|
||||
USE `myems_carbon_db` ;
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_combined_equipment_input_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_combined_equipment_input_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_combined_equipment_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`combined_equipment_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_combined_equipment_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_combined_equipment_input_category_hourly` (`combined_equipment_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_combined_equipment_input_item_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_combined_equipment_input_item_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_combined_equipment_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`combined_equipment_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_combined_equipment_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_combined_equipment_input_item_hourly` (`combined_equipment_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_combined_equipment_output_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_combined_equipment_output_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_combined_equipment_output_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`combined_equipment_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_combined_equipment_output_category_hourly_index_1` ON `myems_carbon_db`.`tbl_combined_equipment_output_category_hourly` (`combined_equipment_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_equipment_input_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_equipment_input_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_equipment_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`equipment_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_equipment_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_equipment_input_category_hourly` (`equipment_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_equipment_input_item_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_equipment_input_item_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_equipment_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`equipment_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_equipment_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_equipment_input_item_hourly` (`equipment_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_equipment_output_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_equipment_output_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_equipment_output_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`equipment_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_equipment_output_category_hourly_index_1` ON `myems_carbon_db`.`tbl_equipment_output_category_hourly` (`equipment_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_meter_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_meter_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_meter_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`meter_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_meter_hourly_index_1` ON `myems_carbon_db`.`tbl_meter_hourly` (`meter_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_offline_meter_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_offline_meter_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_offline_meter_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`offline_meter_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_offline_meter_hourly_index_1` ON `myems_carbon_db`.`tbl_offline_meter_hourly` (`offline_meter_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_shopfloor_input_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_shopfloor_input_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_shopfloor_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`shopfloor_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_shopfloor_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_shopfloor_input_category_hourly` (`shopfloor_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_shopfloor_input_item_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_shopfloor_input_item_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_shopfloor_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`shopfloor_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_shopfloor_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_shopfloor_input_item_hourly` (`shopfloor_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_space_input_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_space_input_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_space_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`space_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_space_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_space_input_category_hourly` (`space_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_space_input_item_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_space_input_item_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_space_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`space_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_space_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_space_input_item_hourly` (`space_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_space_output_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_space_output_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_space_output_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`space_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_space_output_category_hourly_index_1` ON `myems_carbon_db`.`tbl_space_output_category_hourly` (`space_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_store_input_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_store_input_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_store_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`store_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_store_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_store_input_category_hourly` (`store_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_store_input_item_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_store_input_item_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_store_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`store_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_store_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_store_input_item_hourly` (`store_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_tenant_input_category_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_tenant_input_category_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_tenant_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`tenant_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_tenant_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_tenant_input_category_hourly` (`tenant_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_tenant_input_item_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_tenant_input_item_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_tenant_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`tenant_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_tenant_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_tenant_input_item_hourly` (`tenant_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
-- Table `myems_carbon_db`.`tbl_virtual_meter_hourly`
|
||||
-- ---------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `myems_carbon_db`.`tbl_virtual_meter_hourly` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_virtual_meter_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`virtual_meter_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_virtual_meter_hourly_index_1` ON `myems_carbon_db`.`tbl_virtual_meter_hourly` (`virtual_meter_id`, `start_datetime_utc`);
|
|
@ -0,0 +1,168 @@
|
|||
START TRANSACTION;
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS `myems_carbon_db` ;
|
||||
USE `myems_carbon_db` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_combined_equipment_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`combined_equipment_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_combined_equipment_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_combined_equipment_input_category_hourly` (`combined_equipment_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_combined_equipment_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`combined_equipment_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_combined_equipment_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_combined_equipment_input_item_hourly` (`combined_equipment_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_combined_equipment_output_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`combined_equipment_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_combined_equipment_output_category_hourly_index_1` ON `myems_carbon_db`.`tbl_combined_equipment_output_category_hourly` (`combined_equipment_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_equipment_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`equipment_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_equipment_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_equipment_input_category_hourly` (`equipment_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_equipment_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`equipment_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_equipment_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_equipment_input_item_hourly` (`equipment_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_equipment_output_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`equipment_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_equipment_output_category_hourly_index_1` ON `myems_carbon_db`.`tbl_equipment_output_category_hourly` (`equipment_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_meter_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`meter_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_meter_hourly_index_1` ON `myems_carbon_db`.`tbl_meter_hourly` (`meter_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_offline_meter_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`offline_meter_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_offline_meter_hourly_index_1` ON `myems_carbon_db`.`tbl_offline_meter_hourly` (`offline_meter_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_shopfloor_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`shopfloor_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_shopfloor_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_shopfloor_input_category_hourly` (`shopfloor_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_shopfloor_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`shopfloor_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_shopfloor_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_shopfloor_input_item_hourly` (`shopfloor_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_space_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`space_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_space_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_space_input_category_hourly` (`space_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_space_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`space_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_space_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_space_input_item_hourly` (`space_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_space_output_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`space_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_space_output_category_hourly_index_1` ON `myems_carbon_db`.`tbl_space_output_category_hourly` (`space_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_store_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`store_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_store_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_store_input_category_hourly` (`store_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_store_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`store_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_store_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_store_input_item_hourly` (`store_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_tenant_input_category_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`tenant_id` BIGINT NOT NULL,
|
||||
`energy_category_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_tenant_input_category_hourly_index_1` ON `myems_carbon_db`.`tbl_tenant_input_category_hourly` (`tenant_id`, `energy_category_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_tenant_input_item_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`tenant_id` BIGINT NOT NULL,
|
||||
`energy_item_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_tenant_input_item_hourly_index_1` ON `myems_carbon_db`.`tbl_tenant_input_item_hourly` (`tenant_id`, `energy_item_id`, `start_datetime_utc`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `myems_carbon_db`.`tbl_virtual_meter_hourly` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`virtual_meter_id` BIGINT NOT NULL,
|
||||
`start_datetime_utc` DATETIME NOT NULL,
|
||||
`actual_value` DECIMAL(18, 3) NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
CREATE INDEX `tbl_virtual_meter_hourly_index_1` ON `myems_carbon_db`.`tbl_virtual_meter_hourly` (`virtual_meter_id`, `start_datetime_utc`);
|
||||
|
||||
-- UPDATE VERSION NUMBER
|
||||
UPDATE myems_system_db.tbl_versions SET version='1.7.0', release_date='2022-01-28' WHERE id=1;
|
||||
|
||||
COMMIT;
|
Loading…
Reference in New Issue