--BD PROJEKT MODEL LOGICZNY-- drop table uzytkownik; drop table uprawnienia_adminow; drop table admin; drop table ban; drop table dotacja; drop table rozgrywka; drop table tlumaczenie; drop table opis; drop table gra; drop table tryb_gry; drop table poziom_uzytkownika; drop table znajomosc; drop table trofeum; drop table trofeum_uzytkownika; drop table stat_przeciw_znaj; create table poziom_uzytkownika ( id_poz_uzyt number(6) not null primary key, nazwa_poziomu varchar2(20) not null, kolor varchar2(20) not null, min_wiek number(2) not null, wymag_liczba_rozeg number(6) not null, wymag_liczba_wygr number(6) not null ); create table uzytkownik ( id_uzytkownika NUMBER(6) primary key, login VARCHAR2(10) unique not null, hash_hasla, --? id_poziomu_uzytkownika NUMBER(6) not null references poziom_uzytkownika, imie VARCHAR2(20) not null, nazwisko VARCHAR2(20) not null, data_urodzenia DATE not null, data_rejestracji DATE not null, ostatnie_logowanie TIME, ostatnie_wylogowanie TIME ); --trigger data rejestracji wypełniana automatycznie? create table uprawnienia_adminow ( rang_admina NUMBER(2) primary key, zasieg_admina NUMBER(6) not null references poziom_uzytkownika ); create table admin ( id_admina NUMBER(6) primary key, id_uzytkownika NUMBER(6) not null references uzytkownik, id_zwierzchnika NUMBER(6) references admin, ranga_admina NUMBER(2) not null references uprawnienia_adminow ); create table ban ( id_bana NUMBER(6) primary key, id_uzytkownika NUMBER(6) not null references uzytkownik, id_admina NUMBER(6) references admin, data_zbanowania DATE not null, data_wygasniecia DATE not null ); --trigger data zbanowania wypełniana automatycznie? create table dotacja ( id_dotacji NUMBER(6) primary key, id_uzytkownika NUMBER(6) not null references uzytkownik, kwota NUMBER(7) not null check (kwota > 0), data_wplaty DATE not null ); --trigger data wpłaty wypełniana automatycznie? create table tlumaczenie ( slowo VARCHAR2(20) primary key, przetlumaczone VARCHAR2(20) not null, jezyk VARCHAR(10) not null ); create table opis ( id_opisu number(6) not null primary key, opis varchar2(1024) not null ); create table gra ( id_gry number(6) not null primary key, nazwa_gry varchar2(20) not null, id_opisu number(6) not null references opis ); create table tryb_gry ( id_trybu number(6) not null primary key, nazwa_trybu varchar2(20) not null, wymagany_poziom number(6) not null references poziom_uzytkownika ); create table rozgrywka ( id_rozgrywki NUMBER(6) primary key, id_gry NUMBER(6) not null references gra, id_trybu NUMBER(6) not null references tryb_gry, id_zwyciezcy NUMBER(6) not null references uzytkownik, id_przegranego NUMBER(6) not null references uzytkownik ); create table znajomosc ( id_uzyt number(6) not null references uzytkownik, id_znaj number(6) not null references uzytkownik, primary key (id_uzyt, id_znaj) ) create table trofeum ( id_trofeum number(6) not null primary key, nazwa_trofeum varchar2(20) not null, id_gry number(6) not null references gra, id_trybu number(6) not null references tryb_gry, wym_poziom number(6) not null references poziomy_uzytkownika, wym_liczba_zwyciestw number(6) not null, wym_proc_zwyciestw number(0, 2) not null ); create table trofeum_uzytkownika ( id_uzytkownika number(6) not null references uzytkownik, id_trofeum number(6) not null references trofeum primary key (id_uzytkownika, id_trofeum) ); create table stat_przeciw_znaj ( id_znajmomosci number(6) not null primary key, id_gry number(6) not null references );