From 4f17d9d168922e8a47bba1f369cf21a4b733e1c3 Mon Sep 17 00:00:00 2001 From: "leo.tuaillon" Date: Sat, 21 Jan 2023 14:10:06 +0100 Subject: [PATCH] =?UTF-8?q?(#1)=20Commit=20premi=C3=A8re=20version=20bdd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + DB/table_init.sql | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 DB/table_init.sql diff --git a/.gitignore b/.gitignore index 07428bf..6ee10aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ build .gradle .idea +*.sqlite */.gradle/ log diff --git a/DB/table_init.sql b/DB/table_init.sql new file mode 100644 index 0000000..37cb552 --- /dev/null +++ b/DB/table_init.sql @@ -0,0 +1,39 @@ + + +CREATE TABLE user( + id int PRIMARY KEY, + name varchar(30) NOT NULL , + forename varchar(30) NOT NULL +); + +CREATE TABLE team( + id int, + name varchar(30), + club_name varchar(30), + PRIMARY KEY (id) +); + +CREATE TABLE tactic_group( + tactic_id int, + group_id int, + PRIMARY KEY(tactic_id, group_id), + FOREIGN KEY (tactic_id) REFERENCES tactic(id), + FOREIGN KEY (group_id) REFERENCES team(id) +); + +CREATE TABLE member( + group_id int, + user_id int, + is_manager int NOT NULL, + PRIMARY KEY (group_id, user_id), + FOREIGN KEY (group_id) REFERENCES team(id), + FOREIGN KEY (user_id) REFERENCES user(id) +); + +CREATE TABLE tactic( + id int PRIMARY KEY , + name varchar(30) NOT NULL, + file_path varchar NOT NULL, + owner_id int, + FOREIGN KEY (owner_id) REFERENCES user(id) +); \ No newline at end of file