From fff38caa6a1eddbc70e160772b355f4d59a127f0 Mon Sep 17 00:00:00 2001 From: "marcos.padin@outlook.es" Date: Mon, 21 Oct 2024 09:46:19 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adido=20v4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V4_create_students_table.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 cd2024bfs4g1-model/src/main/resources/db/migration/V4_create_students_table.sql diff --git a/cd2024bfs4g1-model/src/main/resources/db/migration/V4_create_students_table.sql b/cd2024bfs4g1-model/src/main/resources/db/migration/V4_create_students_table.sql new file mode 100644 index 000000000..b3e33c1c0 --- /dev/null +++ b/cd2024bfs4g1-model/src/main/resources/db/migration/V4_create_students_table.sql @@ -0,0 +1,17 @@ +DROP TABLE student; + +CREATE TABLE students ( + id SERIAL PRIMARY KEY, + name varchar(255) NOT NULL, + surnames varchar(255) NOT NULL, + email varchar(255) NOT NULL +); + +CREATE TABLE student_bootcamp ( + id SERIAL PRIMARY KEY, + student_id int4 NULL, + bootcamp_id int4 NULL, + CONSTRAINT sb_student_id_bootcamp_id_key UNIQUE (student_id, bootcamp_id), + CONSTRAINT sb_bootcamp_id_fkey FOREIGN KEY (bootcamp_id) REFERENCES public.bootcamps(id), + CONSTRAINT sb_student_id_fkey FOREIGN KEY (student_id) REFERENCES public.students(id) +);