From ead710db271795380207141f0add7278ba12ada0 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 27 Oct 2022 10:56:26 +0200 Subject: finish merge and fix sql scripts --- scripts/db-init.sql | 20 +++++++++++--------- scripts/db-privileges.sql | 1 + 2 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 scripts/db-privileges.sql (limited to 'scripts') 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'; -- cgit v1.2.3