From ef6c7bbb51432b8c7756ae614b26dd2168129076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joe=20Ku=CC=88ng?= Date: Wed, 26 Apr 2023 17:16:28 +0200 Subject: [PATCH] mysql file for generating db --- src/main/resources/mysql.sql | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/main/resources/mysql.sql diff --git a/src/main/resources/mysql.sql b/src/main/resources/mysql.sql new file mode 100644 index 0000000..41f02aa --- /dev/null +++ b/src/main/resources/mysql.sql @@ -0,0 +1,43 @@ +drop database if exists Progetto152; +create database if not exists Progetto152; +use Progetto152; + + + +create table if not exists Location +( + id int auto_increment not null, + location varchar(255) not null unique, + region varchar(3) not null, + lat double not null, + lon double not null, + primary key (id) +); + +create table if not exists Waypoints +( + id int not null auto_increment, + name varchar(10) not null, + lat double not null, + lon double not null, + description varchar(1000) not null, + img varchar(1000) not null, + LocationId int not null, + primary key (id), + foreign key (LocationId) references Location (id) +); + +create table if not exists User( + id int not null auto_increment, + name varchar(45) not null, + username varchar(100) not null, + password varchar(100) not null, + primary key (id) +); + +create table if not exists LocationVisited( + userId int not null, + locationid int not null, + foreign key (userId) references User(id), + foreign key (locationid) references Location(id) +) \ No newline at end of file