-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsqlbee.sql
138 lines (129 loc) · 5.75 KB
/
sqlbee.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
start transaction;
create database `sqlbee` collate=utf8_unicode_ci;
use `sqlbee`;
create table `api_log` (
`api_log_id` int(10) unsigned not null auto_increment,
`method` enum('get','post') not null,
`endpoint` varchar(255) not null,
`json_arguments` text not null,
`response` mediumtext not null,
`timestamp` timestamp not null default current_timestamp,
`deleted` tinyint(1) not null default '0',
primary key (`api_log_id`)
) engine=innodb default charset=utf8 collate=utf8_unicode_ci;
create table `error_log` (
`error_log_id` int(10) unsigned not null auto_increment,
`timestamp` timestamp not null default current_timestamp,
`json_error` text not null,
`deleted` tinyint(1) unsigned not null default '0',
primary key (`error_log_id`)
) engine=innodb default charset=utf8 collate=utf8_unicode_ci;
create table `thermostat` (
`thermostat_id` int(10) unsigned not null auto_increment,
`identifier` varchar(255) not null,
`name` varchar(255) not null,
`connected` tinyint(1) not null,
`thermostat_revision` varchar(255) not null,
`alert_revision` varchar(255) not null,
`runtime_revision` varchar(255) not null,
`internal_revision` varchar(255) not null,
`json_runtime` text,
`json_extended_runtime` text,
`json_electricity` text,
`json_settings` text,
`json_location` text,
`json_program` text,
`json_events` text,
`json_device` text,
`json_technician` text,
`json_utility` text,
`json_management` text,
`json_alerts` text,
`json_weather` text,
`json_house_details` text,
`json_oem_cfg` text,
`json_equipment_status` text,
`json_notification_settings` text,
`json_privacy` text,
`json_version` text,
`json_remote_sensors` text,
`json_audio` text,
`deleted` tinyint(1) not null default '0',
primary key (`thermostat_id`),
unique key `identifier` (`identifier`)
) engine=innodb default charset=utf8 collate=utf8_unicode_ci;
create table `sensor` (
`sensor_id` int(10) unsigned not null auto_increment,
`thermostat_id` int(10) unsigned not null,
`identifier` varchar(255) collate utf8_unicode_ci not null,
`name` varchar(255) collate utf8_unicode_ci not null,
`type` varchar(255) collate utf8_unicode_ci not null,
`code` varchar(255) collate utf8_unicode_ci default null,
`in_use` tinyint(1) not null,
`json_capability` text collate utf8_unicode_ci not null,
`deleted` tinyint(1) not null default '0',
primary key (`sensor_id`),
key `thermostat_id` (`thermostat_id`),
constraint `sensor_ibfk_1` foreign key (`thermostat_id`) references `thermostat` (`thermostat_id`)
) engine=innodb default charset=utf8 collate=utf8_unicode_ci;
create table `runtime_report_thermostat` (
`runtime_report_thermostat_id` int(10) unsigned not null auto_increment,
`thermostat_id` int(10) unsigned not null,
`timestamp` timestamp not null,
`auxiliary_heat_1` int(10) unsigned default null,
`auxiliary_heat_2` int(10) unsigned default null,
`auxiliary_heat_3` int(10) unsigned default null,
`compressor_cool_1` int(10) unsigned default null,
`compressor_cool_2` int(10) unsigned default null,
`compressor_heat_1` int(10) unsigned default null,
`compressor_heat_2` int(10) unsigned default null,
`dehumidifier` int(10) unsigned default null,
`demand_management_offset` decimal(4,1) default null,
`economizer` int(10) unsigned default null,
`fan` int(10) unsigned default null,
`humidifier` int(10) unsigned default null,
`hvac_mode` varchar(255) default null,
`outdoor_humidity` int(10) unsigned default null,
`outdoor_temperature` decimal(4,1) default null,
`sky` int(10) unsigned default null,
`ventilator` int(10) unsigned default null,
`wind` int(10) unsigned default null,
`zone_average_temperature` decimal(4,1) default null,
`zone_calendar_event` varchar(255) default null,
`zone_climate` varchar(255) default null,
`zone_cool_temperature` decimal(4,1) default null,
`zone_heat_temperature` decimal(4,1) default null,
`zone_humidity` int(10) unsigned default null,
`zone_humidity_high` int(10) unsigned default null,
`zone_humidity_low` int(10) unsigned default null,
`zone_hvac_mode` varchar(255) default null,
`zone_occupancy` int(10) unsigned default null,
`deleted` tinyint(1) not null default '0',
primary key (`runtime_report_thermostat_id`),
unique key `thermostat_id_timestamp` (`thermostat_id`,`timestamp`),
constraint `runtime_report_thermostat_ibfk_1` foreign key (`thermostat_id`) references `thermostat` (`thermostat_id`)
) engine=innodb default charset=utf8 collate=utf8_unicode_ci;
create table `runtime_report_sensor` (
`runtime_report_sensor_id` int(10) unsigned not null auto_increment,
`thermostat_id` int(10) unsigned not null,
`sensor_id` int(10) unsigned not null,
`timestamp` timestamp not null,
`temperature` decimal(4,1) default null,
`humidity` int(10) unsigned default null,
`occupancy` tinyint(1) default null,
`deleted` tinyint(1) not null default '0',
primary key (`runtime_report_sensor_id`),
unique key `sensor_id_timestamp` (`sensor_id`,`timestamp`),
key `thermostat_id` (`thermostat_id`),
constraint `runtime_report_sensor_ibfk_1` foreign key (`sensor_id`) references `sensor` (`sensor_id`),
constraint `runtime_report_sensor_ibfk_2` foreign key (`thermostat_id`) references `thermostat` (`thermostat_id`)
) engine=innodb default charset=utf8 collate=utf8_unicode_ci;
create table `token` (
`token_id` int(10) unsigned not null auto_increment,
`access_token` text not null,
`refresh_token` text not null,
`timestamp` timestamp not null default current_timestamp,
`deleted` tinyint(4) not null default '0',
primary key (`token_id`)
) engine=innodb default charset=utf8 collate=utf8_unicode_ci;
commit;