1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Updated database schema export

This commit is contained in:
Jon Ziebell 2023-01-17 18:59:24 -05:00
parent eddf22800a
commit 9e0fb081a8

View File

@ -1,16 +1,10 @@
-- mysqldump -u root -p --opt beestat -d --single-transaction | sed 's/ AUTO_INCREMENT=[0-9]*//g' > beestat.sql
-- MySQL dump 10.13 Distrib 8.0.20, for Linux (x86_64)
-- MySQL dump 10.13 Distrib 8.0.29, for Linux (x86_64)
--
-- Host: localhost Database: beestat
-- ------------------------------------------------------
-- Server version 8.0.20
-- Server version 8.0.29
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@ -33,14 +27,14 @@ DROP TABLE IF EXISTS `address`;
CREATE TABLE `address` (
`address_id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL,
`key` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`normalized` json DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`address_id`),
UNIQUE KEY `user_id_guid` (`user_id`,`key`),
CONSTRAINT `address_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -59,7 +53,7 @@ CREATE TABLE `announcement` (
`icon` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`announcement_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -72,15 +66,15 @@ DROP TABLE IF EXISTS `api_cache`;
CREATE TABLE `api_cache` (
`api_cache_id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned DEFAULT NULL,
`key` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`response_data` json DEFAULT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`api_cache_id`),
KEY `user_id_key` (`user_id`,`key`),
CONSTRAINT `api_cache_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
KEY `expires_at` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -108,13 +102,7 @@ CREATE TABLE `api_log` (
KEY `request_ip_request_timestamp` (`ip_address`,`timestamp`),
KEY `request_timestamp` (`timestamp`),
KEY `request_api_user_id_request_timestamp` (`api_user_id`,`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY RANGE (unix_timestamp(`timestamp`))
(PARTITION 2020_10 VALUES LESS THAN (1604188800) ENGINE = InnoDB,
PARTITION 2020_11 VALUES LESS THAN (1606780800) ENGINE = InnoDB,
PARTITION 2020_12 VALUES LESS THAN (1609459200) ENGINE = InnoDB,
PARTITION 2021_01 VALUES LESS THAN (1612137600) ENGINE = InnoDB,
PARTITION 2021_02 VALUES LESS THAN (1614556800) ENGINE = InnoDB) */;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPRESSED;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -126,15 +114,15 @@ DROP TABLE IF EXISTS `api_user`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `api_user` (
`api_user_id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`api_key` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`session_key` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`api_key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`session_key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`api_user_id`),
UNIQUE KEY `api_key` (`api_key`),
UNIQUE KEY `username` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -146,13 +134,13 @@ DROP TABLE IF EXISTS `ecobee_api_cache`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ecobee_api_cache` (
`ecobee_api_cache_id` int unsigned NOT NULL AUTO_INCREMENT,
`key` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`response` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`response` longtext CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`ecobee_api_cache_id`),
KEY `user_id_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -168,13 +156,13 @@ CREATE TABLE `ecobee_api_log` (
`api_user_id` int unsigned DEFAULT NULL,
`request_timestamp` timestamp NULL DEFAULT NULL,
`request` json DEFAULT NULL,
`response` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`response` longtext CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`ecobee_api_log_id`),
KEY `user_id` (`user_id`),
KEY `api_user_id` (`api_user_id`),
KEY `request_timestamp` (`request_timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -186,12 +174,12 @@ DROP TABLE IF EXISTS `ecobee_sensor`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ecobee_sensor` (
`ecobee_sensor_id` int unsigned NOT NULL AUTO_INCREMENT,
`identifier` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`identifier` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`user_id` int unsigned NOT NULL,
`ecobee_thermostat_id` int unsigned NOT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`code` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`code` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`in_use` tinyint(1) DEFAULT NULL,
`capability` json DEFAULT NULL,
`inactive` tinyint(1) NOT NULL DEFAULT '0',
@ -201,7 +189,7 @@ CREATE TABLE `ecobee_sensor` (
KEY `user_id` (`user_id`),
CONSTRAINT `ecobee_sensor_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`),
CONSTRAINT `ecobee_sensor_ibfk_4` FOREIGN KEY (`ecobee_thermostat_id`) REFERENCES `ecobee_thermostat` (`ecobee_thermostat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -213,17 +201,17 @@ DROP TABLE IF EXISTS `ecobee_thermostat`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ecobee_thermostat` (
`ecobee_thermostat_id` int unsigned NOT NULL AUTO_INCREMENT,
`identifier` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`guid` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`identifier` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`guid` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`user_id` int unsigned NOT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`connected` tinyint(1) DEFAULT NULL,
`thermostat_revision` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`alert_revision` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`runtime_revision` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`interval_revision` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`thermostat_revision` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`alert_revision` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`runtime_revision` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`interval_revision` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`utc_time` timestamp NULL DEFAULT NULL,
`model_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`model_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`runtime` json DEFAULT NULL,
`extended_runtime` json DEFAULT NULL,
`electricity` json DEFAULT NULL,
@ -252,7 +240,7 @@ CREATE TABLE `ecobee_thermostat` (
KEY `user_id_guid` (`user_id`,`guid`),
KEY `identifier` (`identifier`),
CONSTRAINT `ecobee_thermostat_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -265,14 +253,35 @@ DROP TABLE IF EXISTS `ecobee_token`;
CREATE TABLE `ecobee_token` (
`ecobee_token_id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL,
`access_token` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`refresh_token` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`ecobee_account_id` char(36) COLLATE utf8_unicode_ci DEFAULT NULL,
`access_token` text CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`refresh_token` text CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`ecobee_token_id`),
UNIQUE KEY `user_id` (`user_id`),
CONSTRAINT `ecobee_token_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `floor_plan`
--
DROP TABLE IF EXISTS `floor_plan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `floor_plan` (
`floor_plan_id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL,
`address_id` int unsigned DEFAULT NULL,
`name` varchar(255) NOT NULL,
`data` json DEFAULT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`floor_plan_id`),
KEY `user_id` (`user_id`),
KEY `address_id` (`address_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -284,13 +293,13 @@ DROP TABLE IF EXISTS `mailgun_api_cache`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mailgun_api_cache` (
`mailgun_api_cache_id` int unsigned NOT NULL AUTO_INCREMENT,
`key` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`response` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`response` longtext CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`mailgun_api_cache_id`),
KEY `user_id_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -312,7 +321,7 @@ CREATE TABLE `mailgun_api_log` (
KEY `user_id` (`user_id`),
KEY `api_user_id` (`api_user_id`),
KEY `request_timestamp` (`request_timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -324,13 +333,13 @@ DROP TABLE IF EXISTS `patreon_api_cache`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `patreon_api_cache` (
`patreon_api_cache_id` int unsigned NOT NULL AUTO_INCREMENT,
`key` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`response` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`response` longtext CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`patreon_api_cache_id`),
KEY `user_id_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -352,7 +361,7 @@ CREATE TABLE `patreon_api_log` (
KEY `user_id` (`user_id`),
KEY `api_user_id` (`api_user_id`),
KEY `request_timestamp` (`request_timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -365,14 +374,36 @@ DROP TABLE IF EXISTS `patreon_token`;
CREATE TABLE `patreon_token` (
`patreon_token_id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL,
`access_token` char(43) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`refresh_token` char(43) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`access_token` char(43) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`refresh_token` char(43) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`patreon_token_id`),
UNIQUE KEY `user_id` (`user_id`),
CONSTRAINT `patreon_token_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `profile`
--
DROP TABLE IF EXISTS `profile`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `profile` (
`profile_id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL,
`thermostat_id` int unsigned NOT NULL,
`date` date NOT NULL,
`profile` json NOT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`profile_id`),
UNIQUE KEY `user_id_thermostat_id_date` (`user_id`,`thermostat_id`,`date`),
KEY `thermostat_id` (`thermostat_id`),
CONSTRAINT `profile_ibfk_1` FOREIGN KEY (`thermostat_id`) REFERENCES `thermostat` (`thermostat_id`),
CONSTRAINT `profile_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -388,15 +419,14 @@ CREATE TABLE `runtime_sensor` (
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`temperature` smallint DEFAULT NULL,
`occupancy` tinyint unsigned DEFAULT NULL,
`air_pressure` mediumint unsigned DEFAULT NULL,
`air_quality` tinyint unsigned DEFAULT NULL,
`air_quality_accuracy` tinyint unsigned DEFAULT NULL,
`voc_concentration` smallint unsigned DEFAULT NULL,
`co2_concentration` smallint unsigned DEFAULT NULL,
PRIMARY KEY (`runtime_sensor_id`,`timestamp`),
UNIQUE KEY `thermostat_id_timestamp` (`sensor_id`,`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY RANGE (unix_timestamp(`timestamp`))
(PARTITION 2020_10 VALUES LESS THAN (1604188800) ENGINE = InnoDB,
PARTITION 2020_11 VALUES LESS THAN (1606780800) ENGINE = InnoDB,
PARTITION 2020_12 VALUES LESS THAN (1609459200) ENGINE = InnoDB,
PARTITION 2021_01 VALUES LESS THAN (1612137600) ENGINE = InnoDB,
PARTITION 2021_02 VALUES LESS THAN (1614556800) ENGINE = InnoDB) */;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPRESSED;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -407,44 +437,29 @@ DROP TABLE IF EXISTS `runtime_thermostat`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `runtime_thermostat` (
`runtime_thermostat_id` int unsigned NOT NULL AUTO_INCREMENT,
`runtime_thermostat_id` bigint unsigned NOT NULL AUTO_INCREMENT,
`thermostat_id` int unsigned NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`compressor_1` smallint unsigned DEFAULT NULL,
`compressor_2` smallint unsigned DEFAULT NULL,
`compressor_mode` enum('heat','cool','off') CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`compressor_mode` enum('heat','cool','off') CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`auxiliary_heat_1` smallint unsigned DEFAULT NULL,
`auxiliary_heat_2` smallint unsigned DEFAULT NULL,
`fan` smallint unsigned DEFAULT NULL,
`accessory` smallint unsigned DEFAULT NULL,
`accessory_type` enum('humidifier','dehumidifier','ventilator','economizer','off') CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`system_mode` enum('auto','auxiliary_heat','cool','heat','off') CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`accessory_type` enum('humidifier','dehumidifier','ventilator','economizer','off') CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`system_mode` enum('auto','auxiliary_heat','cool','heat','off') CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`indoor_temperature` smallint DEFAULT NULL,
`indoor_humidity` tinyint unsigned DEFAULT NULL,
`outdoor_temperature` smallint DEFAULT NULL,
`outdoor_humidity` tinyint unsigned DEFAULT NULL,
`event_runtime_thermostat_text_id` smallint unsigned DEFAULT NULL,
`climate_runtime_thermostat_text_id` smallint unsigned DEFAULT NULL,
`event_runtime_thermostat_text_id` int unsigned DEFAULT NULL,
`climate_runtime_thermostat_text_id` int unsigned DEFAULT NULL,
`setpoint_cool` smallint unsigned DEFAULT NULL,
`setpoint_heat` smallint unsigned DEFAULT NULL,
PRIMARY KEY (`runtime_thermostat_id`,`timestamp`),
UNIQUE KEY `thermostat_id_timestamp` (`thermostat_id`,`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY RANGE (unix_timestamp(`timestamp`))
(PARTITION 2020_01 VALUES LESS THAN (1580515200) ENGINE = InnoDB,
PARTITION 2020_02 VALUES LESS THAN (1583020800) ENGINE = InnoDB,
PARTITION 2020_03 VALUES LESS THAN (1585699200) ENGINE = InnoDB,
PARTITION 2020_04 VALUES LESS THAN (1588291200) ENGINE = InnoDB,
PARTITION 2020_05 VALUES LESS THAN (1590969600) ENGINE = InnoDB,
PARTITION 2020_06 VALUES LESS THAN (1593561600) ENGINE = InnoDB,
PARTITION 2020_07 VALUES LESS THAN (1596240000) ENGINE = InnoDB,
PARTITION 2020_08 VALUES LESS THAN (1598918400) ENGINE = InnoDB,
PARTITION 2020_09 VALUES LESS THAN (1601510400) ENGINE = InnoDB,
PARTITION 2020_10 VALUES LESS THAN (1604188800) ENGINE = InnoDB,
PARTITION 2020_11 VALUES LESS THAN (1606780800) ENGINE = InnoDB,
PARTITION 2020_12 VALUES LESS THAN (1609459200) ENGINE = InnoDB,
PARTITION 2021_01 VALUES LESS THAN (1612137600) ENGINE = InnoDB,
PARTITION 2021_02 VALUES LESS THAN (1614556800) ENGINE = InnoDB) */;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPRESSED;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -471,6 +486,7 @@ CREATE TABLE `runtime_thermostat_summary` (
`sum_dehumidifier` mediumint unsigned NOT NULL,
`sum_ventilator` mediumint unsigned NOT NULL,
`sum_economizer` mediumint unsigned NOT NULL,
`sum_degree_days` decimal(3,1) DEFAULT NULL,
`avg_outdoor_temperature` smallint NOT NULL,
`avg_outdoor_humidity` tinyint unsigned NOT NULL,
`min_outdoor_temperature` smallint NOT NULL,
@ -483,7 +499,7 @@ CREATE TABLE `runtime_thermostat_summary` (
KEY `user_id` (`user_id`),
CONSTRAINT `runtime_thermostat_summary_ibfk_1` FOREIGN KEY (`thermostat_id`) REFERENCES `thermostat` (`thermostat_id`),
CONSTRAINT `runtime_thermostat_summary_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -494,12 +510,12 @@ DROP TABLE IF EXISTS `runtime_thermostat_text`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `runtime_thermostat_text` (
`runtime_thermostat_text_id` smallint unsigned NOT NULL AUTO_INCREMENT,
`value` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`runtime_thermostat_text_id` int unsigned NOT NULL AUTO_INCREMENT,
`value` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`runtime_thermostat_text_id`),
UNIQUE KEY `user_id_guid` (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -514,9 +530,9 @@ CREATE TABLE `sensor` (
`user_id` int unsigned NOT NULL,
`thermostat_id` int unsigned NOT NULL,
`ecobee_sensor_id` int unsigned DEFAULT NULL,
`identifier` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`identifier` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`in_use` tinyint(1) DEFAULT NULL,
`temperature` decimal(4,1) DEFAULT NULL,
`humidity` int unsigned DEFAULT NULL,
@ -531,7 +547,7 @@ CREATE TABLE `sensor` (
CONSTRAINT `sensor_ibfk_1` FOREIGN KEY (`thermostat_id`) REFERENCES `thermostat` (`thermostat_id`),
CONSTRAINT `sensor_ibfk_2` FOREIGN KEY (`ecobee_sensor_id`) REFERENCES `ecobee_sensor` (`ecobee_sensor_id`),
CONSTRAINT `sensor_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -543,7 +559,7 @@ DROP TABLE IF EXISTS `session`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `session` (
`session_id` int unsigned NOT NULL AUTO_INCREMENT,
`session_key` char(128) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`session_key` char(128) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`user_id` int unsigned DEFAULT NULL,
`api_user_id` int unsigned DEFAULT NULL,
`timeout` int unsigned DEFAULT NULL,
@ -559,7 +575,7 @@ CREATE TABLE `session` (
KEY `api_user_id` (`api_user_id`),
CONSTRAINT `session_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`),
CONSTRAINT `session_ibfk_2` FOREIGN KEY (`api_user_id`) REFERENCES `api_user` (`api_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -571,13 +587,13 @@ DROP TABLE IF EXISTS `smarty_streets_api_cache`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `smarty_streets_api_cache` (
`smarty_streets_api_cache_id` int unsigned NOT NULL AUTO_INCREMENT,
`key` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`response` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`response` longtext CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`smarty_streets_api_cache_id`),
KEY `user_id_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -599,7 +615,108 @@ CREATE TABLE `smarty_streets_api_log` (
KEY `user_id` (`user_id`),
KEY `api_user_id` (`api_user_id`),
KEY `request_timestamp` (`request_timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `stripe_api_cache`
--
DROP TABLE IF EXISTS `stripe_api_cache`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stripe_api_cache` (
`stripe_api_cache_id` int unsigned NOT NULL AUTO_INCREMENT,
`key` char(40) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`response` longtext CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`stripe_api_cache_id`),
KEY `user_id_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `stripe_api_log`
--
DROP TABLE IF EXISTS `stripe_api_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stripe_api_log` (
`stripe_api_log_id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned DEFAULT NULL,
`api_user_id` int unsigned DEFAULT NULL,
`request_timestamp` timestamp NULL DEFAULT NULL,
`request` json DEFAULT NULL,
`response` text COLLATE utf8_unicode_ci,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`stripe_api_log_id`),
KEY `user_id` (`user_id`),
KEY `api_user_id` (`api_user_id`),
KEY `request_timestamp` (`request_timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `stripe_event`
--
DROP TABLE IF EXISTS `stripe_event`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stripe_event` (
`stripe_event_id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL,
`stripe_webhook_log_id` int unsigned NOT NULL,
`stripe_event_identifier` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`timestamp` timestamp NOT NULL,
`type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`data` json NOT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`stripe_event_id`),
UNIQUE KEY `stripe_event_identifier` (`stripe_event_identifier`),
KEY `user_id` (`user_id`),
KEY `stripe_webhook_log_id` (`stripe_webhook_log_id`),
CONSTRAINT `stripe_event_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT,
CONSTRAINT `stripe_event_ibfk_2` FOREIGN KEY (`stripe_webhook_log_id`) REFERENCES `stripe_webhook_log` (`stripe_webhook_log_id`) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `stripe_payment_link`
--
DROP TABLE IF EXISTS `stripe_payment_link`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stripe_payment_link` (
`stripe_payment_link_id` int unsigned NOT NULL AUTO_INCREMENT,
`amount` int unsigned NOT NULL,
`currency` enum('usd','cad','gbp','aud') CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`interval` enum('month','year') CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL,
`url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`stripe_payment_link_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `stripe_webhook_log`
--
DROP TABLE IF EXISTS `stripe_webhook_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stripe_webhook_log` (
`stripe_webhook_log_id` int unsigned NOT NULL AUTO_INCREMENT,
`request_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`request` text COLLATE utf8_unicode_ci,
`processed` tinyint(1) NOT NULL DEFAULT '0',
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`stripe_webhook_log_id`),
KEY `request_timestamp` (`request_timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -618,6 +735,8 @@ CREATE TABLE `thermostat` (
`temperature` decimal(4,1) DEFAULT NULL,
`temperature_unit` enum('°F','°C') DEFAULT NULL,
`humidity` int unsigned DEFAULT NULL,
`setpoint_heat` decimal(4,1) DEFAULT NULL,
`setpoint_cool` decimal(4,1) DEFAULT NULL,
`alerts` json DEFAULT NULL,
`first_connected` timestamp NULL DEFAULT NULL,
`sync_begin` timestamp NULL DEFAULT NULL,
@ -626,17 +745,16 @@ CREATE TABLE `thermostat` (
`data_end` timestamp NULL DEFAULT NULL,
`time_zone` varchar(255) DEFAULT NULL,
`filters` json DEFAULT NULL,
`temperature_profile` json DEFAULT NULL,
`profile` json DEFAULT NULL,
`property` json DEFAULT NULL,
`system_type` json DEFAULT NULL,
`system_type2` json DEFAULT NULL,
`weather` json DEFAULT NULL,
`settings` json DEFAULT NULL,
`program` json DEFAULT NULL,
`running_equipment` json DEFAULT NULL,
`system_type_heat` enum('geothermal','compressor','boiler','gas','oil','electric','none') DEFAULT NULL,
`system_type_heat_stages` int unsigned DEFAULT NULL,
`system_type_auxiliary_heat` enum('electric','gas','oil','none') DEFAULT NULL,
`system_type_auxiliary_heat` enum('electric','gas','oil','none') CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL,
`system_type_auxiliary_heat_stages` int unsigned DEFAULT NULL,
`system_type_cool` enum('geothermal','compressor','none') DEFAULT NULL,
`system_type_cool_stages` int unsigned DEFAULT NULL,
@ -652,11 +770,11 @@ CREATE TABLE `thermostat` (
KEY `ecobee_thermostat_id` (`ecobee_thermostat_id`),
KEY `user_id` (`user_id`),
KEY `address_id` (`address_id`),
KEY `comparison` (`system_type_heat`,`system_type_cool`,`system_type_heat_stages`,`system_type_cool_stages`,`property_structure_type`,`address_latitude`,`address_longitude`),
KEY `metric` (`system_type_heat`,`system_type_cool`,`system_type_heat_stages`,`system_type_cool_stages`,`property_age`,`property_square_feet`,`property_stories`,`address_latitude`,`address_longitude`,`property_structure_type`),
CONSTRAINT `thermostat_ibfk_1` FOREIGN KEY (`ecobee_thermostat_id`) REFERENCES `ecobee_thermostat` (`ecobee_thermostat_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `thermostat_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `thermostat_ibfk_4` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -668,20 +786,22 @@ DROP TABLE IF EXISTS `user`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`user_id` int unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`password` char(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`ecobee_account_id` char(36) COLLATE utf8_unicode_ci DEFAULT NULL,
`stripe_customer_identifier` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`username` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`password` char(60) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL,
`anonymous` tinyint(1) NOT NULL,
`email_address` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`settings` json DEFAULT NULL,
`patreon_status` json DEFAULT NULL,
`sync_status` json DEFAULT NULL,
`debug` tinyint(1) DEFAULT '0',
`comment` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`comment` text CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@ -693,4 +813,4 @@ CREATE TABLE `user` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-01-23 19:10:19
-- Dump completed on 2023-01-17 23:56:28