aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-27 10:56:26 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-27 10:56:26 +0200
commitead710db271795380207141f0add7278ba12ada0 (patch)
treeb9a507b841abee25ad35fd679d37fdd4d8cd3a30 /scripts
parentc363bf7fb006914dbcfadb0a752c05fdf8683400 (diff)
finish merge and fix sql scripts
Diffstat (limited to 'scripts')
-rw-r--r--scripts/db-init.sql20
-rw-r--r--scripts/db-privileges.sql1
2 files changed, 12 insertions, 9 deletions
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';