Occupancy-Planner-Team1 / Occupancy-Planner

OCCUPANCY PLANNER
https://it-designers-gruppe.de/
0 stars 0 forks source link

Datenbank Struktur (ERM) #12

Closed SiIaS closed 1 year ago

codergod1337 commented 1 year ago

Hier ist der SQL Code um die zwei Tabellen zu erstellen UND die Einträge für unsere 32 Stühle:

create table reservation (id serial primary key not NULL, date varchar(50), timeslot varchar(50), leaderid varchar(255), memberid varchar(255), bookingid varchar(100),chairid int, constraint stuhl_link foreign key (chairid) references chair(id))

create table chair (id serial primary key, tisch varchar(100), posx varchar(100), posy varchar(100))

alter table reservation add constraint keine_doppelbuchung unique(date, timeslot, leaderid, memberid)

INSERT INTO chair (tisch, posx, posy) VALUES('Tisch1', '823', '70'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch1', '823', '223'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch1', '976', '223'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch1', '975', '70'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch2', '578', '181'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch2', '578', '334'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch2', '731', '334'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch2', '730', '181'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch3', '312', '38'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch3', '312', '191'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch3', '465', '191'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch3', '464', '38'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch4', '38', '181'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch4', '38', '334'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch4', '191', '334'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch4', '190', '181'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch5', '597', '493'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch5', '596', '836'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch5', '482', '582'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch5', '482', '665'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch5', '481', '747'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch5', '713', '748'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch5', '713', '665'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch5', '714', '583'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch6', '967', '493'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch6', '965', '835'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch6', '852', '582'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch6', '852', '665'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch6', '851', '747'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch6', '1083', '748'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch6', '1083', '665'); INSERT INTO chair (tisch, posx, posy) VALUES('Tisch6', '1084', '583');

// Dummy Reservierungseintrag: INSERT INTO reservation ("date", timeslot, leaderid, memberid, bookingid, chairid) VALUES('20230229', '1', 'teamleiter1', 'user69', 'booking id', 1);

codergod1337 commented 1 year ago

UPDATE: zum erstellen der Tabellen: create table reservation (id serial primary key not NULL, datum varchar(50), timeslot varchar(50), leaderid varchar(50), memberid varchar(50), bookingid varchar(100),chairid int, constraint stuhl_link foreign key (chairid) references chair(id));

create table chair (id serial primary key, tisch varchar(25), posx varchar(10), posy varchar(10));

CREATE table mitarbeiter (id serial primary key, prename varchar(50), lastname varchar(50), kcid varchar(50) unique);

create table teams (id serial primary key, memberid int, constraint memberidlink foreign key (memberid) references mitarbeiter(id), bossid int, constraint memberidlink foreign key (bossid) references mitarbeiter(id) );

create table bookingid (id serial primary key, leaderid int, constraint linklink foreign key (leaderid) references mitarbeiter(id) );

codergod1337 commented 1 year ago

ist nun obsolet, die datenbank bzw die tabellen werden von jpa angelegt