aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/db-add.sql194
-rw-r--r--scripts/db-init.sql20
-rw-r--r--scripts/db-privileges.sql1
3 files changed, 206 insertions, 9 deletions
diff --git a/scripts/db-add.sql b/scripts/db-add.sql
new file mode 100644
index 0000000..6b202aa
--- /dev/null
+++ b/scripts/db-add.sql
@@ -0,0 +1,194 @@
+INSERT INTO `WSdb`.`tblMain` (temperature, humidity) VALUES
+-- 20.6, 77.7, 0.59, now()
+(23.6,57),
+(23.6,57),
+(23.6,56),
+(23.6,56),
+(23.5,58),
+(23.4,59),
+(23.4,59),
+(23.4,60),
+(23.4,60),
+(23.4,60),
+(23.3,60),
+(23.3,60),
+(23.3,60),
+(23.2,60),
+(23.4,60),
+(23.3,60),
+(23.2,60),
+(23.2,59),
+(23.1,59),
+(23.1,59),
+(23.0,59),
+(23.0,59),
+(22.9,59),
+(22.9,59),
+(22.9,58),
+(22.8,58),
+(22.8,58),
+(22.8,58),
+(22.8,58),
+(22.7,58),
+(22.7,58),
+(22.7,58),
+(22.6,58),
+(22.6,58),
+(22.6,58),
+(22.6,58),
+(22.5,58),
+(22.5,58),
+(22.5,58),
+(22.4,58),
+(22.4,58),
+(22.4,58),
+(22.4,57),
+(22.4,57),
+(22.3,57),
+(22.3,57),
+(22.3,57),
+(22.3,57),
+(22.3,57),
+(22.4,57),
+(22.7,57),
+(22.9,57),
+(23.0,57),
+(23.2,57),
+(23.2,57),
+(23.1,59),
+(23.0,59),
+(23.0,59),
+(23.2,58),
+(23.4,58),
+(23.4,58),
+(23.5,57),
+(23.6,57),
+(23.7,57),
+(23.7,57),
+(23.8,57),
+(23.9,57),
+(23.8,59),
+(23.8,59),
+(23.7,58),
+(23.6,58),
+(23.5,58),
+(23.5,58),
+(23.4,57),
+(23.5,59),
+(23.8,58),
+(23.7,59),
+(23.7,59),
+(23.7,59),
+(23.9,59),
+(23.8,57),
+(23.7,56),
+(23.5,55),
+(23.4,54),
+(23.4,54),
+(23.6,53),
+(23.6,56),
+(23.7,55),
+(23.7,54),
+(23.8,54),
+(23.8,54),
+(23.8,55),
+(23.7,55),
+(23.6,55),
+(23.5,55),
+(23.5,56),
+(23.4,56),
+(23.4,58),
+(23.3,59),
+(23.4,63),
+(23.4,63),
+(23.4,63),
+(23.4,63),
+(23.4,63),
+(23.3,64),
+(23.2,63),
+(23.2,62),
+(23.1,62),
+(23.1,61),
+(23.0,61),
+(22.9,61),
+(22.9,61),
+(22.9,61),
+(22.8,60),
+(22.8,60),
+(22.8,60),
+(22.7,60),
+(22.7,60),
+(22.6,60),
+(22.6,60),
+(22.5,59),
+(22.5,59),
+(22.5,59),
+(22.4,59),
+(22.4,59),
+(22.4,59),
+(22.4,59),
+(22.4,59),
+(22.4,58),
+(22.3,58),
+(22.3,58),
+(22.3,58),
+(22.3,58),
+(22.2,58),
+(22.2,58),
+(22.2,58),
+(22.2,58),
+(22.2,58),
+(22.1,58),
+(22.1,58),
+(22.1,58),
+(22.1,57),
+(22.0,57),
+(22.0,57),
+(22.0,57),
+(22.1,58),
+(22.4,57),
+(22.5,58),
+(22.6,58),
+(22.7,58),
+(22.8,58),
+(22.9,58),
+(22.9,58),
+(22.8,57),
+(22.7,57),
+(22.7,57),
+(22.9,57),
+(22.9,57),
+(23.0,58),
+(23.2,58),
+(23.3,58),
+(23.2,59),
+(23.2,59),
+(23.2,58),
+(23.4,58),
+(23.6,59),
+(23.7,59),
+(23.9,59),
+(24.0,58),
+(23.9,55),
+(23.9,54),
+(23.9,55),
+(24.0,55),
+(24.2,55),
+(24.2,55),
+(24.1,56),
+(24.0,55),
+(24.0,56),
+(23.9,57),
+(23.9,56),
+(24.0,55),
+(24.1,55),
+(23.9,56),
+(23.9,56),
+(23.9,56),
+(23.9,56),
+(23.8,56),
+(23.8,56),
+(23.7,56),
+(23.7,56),
+(23.6,58),
+(23.6,59);
diff --git a/scripts/db-init.sql b/scripts/db-init.sql
index 4c4c4d4..2b0581c 100644
--- a/scripts/db-init.sql
+++ b/scripts/db-init.sql
@@ -1,9 +1,11 @@
-CREATE SCHEMA `WSdb`;
-CREATE TABLE `DAB1Pract1`.`tblMain` (
- `ID` INT GENERATED ALWAYS AS (),
- `temperature` DECIMAL(5,2) NULL,
- `humidity` DECIMAL(5,2) NULL,
- `pressure` DECIMAL(5,2) NULL,
- `time` DATETIME NULL,
- PRIMARY KEY (`ID`),
- UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE);
+drop schema if exists `WSdb`;
+create schema if not exists `WSdb`;
+drop table if exists `WSdb`.`tblMain`;
+create table if not exists `WSdb`.`tblMain` (
+ id int unsigned not null auto_increment,
+ temperature decimal(5,2) null,
+ humidity decimal(5,2) null,
+ pressure decimal(5,2) null,
+ time datetime null,
+ primary key (id)
+);
diff --git a/scripts/db-privileges.sql b/scripts/db-privileges.sql
new file mode 100644
index 0000000..75f8fcc
--- /dev/null
+++ b/scripts/db-privileges.sql
@@ -0,0 +1 @@
+grant all privileges on WSdb.* to 'user'@'localhost';