

CREATE TABLE benutzer_menu_recht (
    person_id integer NOT NULL,
    menu_id integer,
    gegeben_von character varying
);


CREATE TABLE benutzer_rolle (
    person_id integer,
    rolle_id integer
);



CREATE TABLE fach (
    fach_id serial NOT NULL,
    fach_name character varying(255) NOT NULL
);



CREATE TABLE fehler (
    fehler_id serial NOT NULL,
    fehler_name character varying(255) NOT NULL
);



CREATE TABLE fehlermeldungen (
    fehler_id integer NOT NULL,
    person_id integer NOT NULL
);


CREATE TABLE fehlzeiten (
    fehlzeiten_id serial NOT NULL,
    datum date NOT NULL,
    status boolean DEFAULT false NOT NULL,
    lehrer_id integer NOT NULL,
    schueler_id integer NOT NULL,
    stunde integer
);



CREATE TABLE halbjahr (
    halbjahr_id serial NOT NULL,
    halbjahr_name character varying(255) NOT NULL
);


CREATE TABLE kontaktperson (
    schueler_id integer NOT NULL,
    person_id integer NOT NULL,
    typ integer
);



CREATE TABLE kontaktperson_typ (
    ktyp_id serial NOT NULL,
    ktyp_name character varying(255)
);


CREATE TABLE kurs (
    kurs_id serial NOT NULL,
    fach_id integer NOT NULL,
    kurstyp_id integer NOT NULL,
    halbjahr_id integer NOT NULL,
    lehrer_id integer NOT NULL
);


CREATE TABLE kurstyp (
    kurstyp_id serial NOT NULL,
    kurstyp_name character varying(255) NOT NULL
);



CREATE TABLE lehrer (
    person_id integer NOT NULL
);



CREATE TABLE leistung (
    typ_id integer NOT NULL,
    note_id integer NOT NULL,
    kurs_id integer NOT NULL,
    person_id integer NOT NULL,
    veranstaltung_id integer NOT NULL,
    leistung_id serial NOT NULL
);



CREATE TABLE leistung_typ (
    typ_id serial NOT NULL,
    typ_name character varying(255) NOT NULL
);


CREATE TABLE logging (
    log_id serial NOT NULL,
    operation text NOT NULL,
    datum date NOT NULL,
    person_id integer NOT NULL
);



CREATE TABLE login (
    login_name character varying(255) NOT NULL,
    passwort character varying(255),
    pwd_frage character varying(255),
    pwd_antwort character varying(255),
    person_id integer NOT NULL
);

CREATE TABLE menu (
    menu_id serial NOT NULL,
    menu_name character varying(255),
    pfad character varying(255),
    "position" integer NOT NULL,
    vater character varying(255)
);


CREATE TABLE note (
    note_id serial NOT NULL,
    name1 character varying(255),
    name2 character varying(255)
);



CREATE TABLE person (
    person_id serial NOT NULL,
    nachname character varying(255) NOT NULL,
    namenszusatz character varying(255),
    rufname character varying(255),
    strasse character varying(255) NOT NULL,
    plz numeric(5,0) NOT NULL,
    ort character varying(255) NOT NULL,
    addresszusatz character varying(255),
    telefon character varying(255),
    fax character varying(255),
    mobil character varying(255),
    email character varying(255),
    geburtstag date,
    geburtsort character varying(255),
    status boolean DEFAULT true,
    beginn date NOT NULL,
    geschlecht character varying(1),
    vorname character varying(255) NOT NULL
);



CREATE TABLE plugins (
    name character varying(255) NOT NULL,
    pfad character varying(255) NOT NULL,
    startpunkt character varying(255) NOT NULL,
    jardatei character varying(255),
    author character varying(255),
    mail character varying(255),
    jarversion character varying(255),
    pluginversion character varying(255)
);



CREATE TABLE raum (
    raum_id serial NOT NULL,
    raum_name character varying(255) NOT NULL
);



CREATE TABLE rolle (
    rolle_id serial NOT NULL,
    rolle_name character varying(255) NOT NULL,
    rolle_beschreibung character varying(255),
    status boolean
);



CREATE TABLE rolle_menu_recht (
    rolle_id integer NOT NULL,
    menu_id integer NOT NULL
);



CREATE TABLE schueler (
    foto character varying(255),
    person_id integer NOT NULL,
    abgang date,
    wochenstundenzahl integer,
    verantwortung_typ integer
);


CREATE TABLE schule (
    name character varying(255) NOT NULL,
    gymnasium boolean NOT NULL,
    strasse character varying(255) NOT NULL,
    plz numeric(5,0) NOT NULL,
    ort character varying(255) NOT NULL,
    telefon character varying(255) NOT NULL,
    fax character varying(255) NOT NULL,
    email character varying(255) NOT NULL,
    sekretariat character varying(255) NOT NULL,
    schulleiter character varying(255) NOT NULL,
    schulleiter_st character varying(255),
    oberstufenleiter character varying(255)
);



CREATE TABLE sonstiges (
    vermerk text NOT NULL,
    sonstiges_id serial NOT NULL
);



CREATE TABLE veranstaltung (
    veranstaltung_id serial NOT NULL,
    anfang time without time zone NOT NULL,
    ende time without time zone NOT NULL,
    datum date NOT NULL,
    kurs_id integer NOT NULL,
    raum_id integer NOT NULL
);



CREATE TABLE unterricht (
    schueler_id integer NOT NULL,
    kurs_id integer NOT NULL
);


CREATE TABLE tadel (
    sonstiges_id integer NOT NULL
);



CREATE TABLE unterrichtet (
    fach_id integer NOT NULL,
    lehrer_id integer NOT NULL
);


CREATE TABLE verantwortung (
    verantwortung_typ integer NOT NULL,
    klehrer integer NOT NULL,
    klehrerst integer NOT NULL,
    svert integer NOT NULL,
    svertst integer NOT NULL,
    evert integer NOT NULL,
    evertst integer NOT NULL
);


CREATE TABLE verantwortung_typ (
    verantwortung_typ_id serial NOT NULL,
    verantwortung_name integer NOT NULL,
    verantwortung_name_zusatz character varying(255)
);


CREATE TABLE verwaltung (
    titel character varying(255),
    person_id integer NOT NULL
);


CREATE TABLE verweis (
    sonstiges_id integer NOT NULL
);

--
-- Name: fach_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY fach
    ADD CONSTRAINT fach_pkey PRIMARY KEY (fach_id);


ALTER INDEX public.fach_pkey OWNER TO fsvb1;

--
-- Name: fehler_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY fehler
    ADD CONSTRAINT fehler_pkey PRIMARY KEY (fehler_id);


ALTER INDEX public.fehler_pkey OWNER TO fsvb1;

--
-- Name: fehlermeldungen_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY fehlermeldungen
    ADD CONSTRAINT fehlermeldungen_pkey PRIMARY KEY (fehler_id, person_id);


ALTER INDEX public.fehlermeldungen_pkey OWNER TO fsvb1;

--
-- Name: fehlzeiten_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY fehlzeiten
    ADD CONSTRAINT fehlzeiten_pkey PRIMARY KEY (fehlzeiten_id);


ALTER INDEX public.fehlzeiten_pkey OWNER TO fsvb1;

--
-- Name: halbjahr_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY halbjahr
    ADD CONSTRAINT halbjahr_pkey PRIMARY KEY (halbjahr_id);


ALTER INDEX public.halbjahr_pkey OWNER TO fsvb1;

--
-- Name: kontaktperson_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY kontaktperson
    ADD CONSTRAINT kontaktperson_pkey PRIMARY KEY (person_id);


ALTER INDEX public.kontaktperson_pkey OWNER TO fsvb1;

--
-- Name: kontaktperson_typ_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY kontaktperson_typ
    ADD CONSTRAINT kontaktperson_typ_pkey PRIMARY KEY (ktyp_id);


ALTER INDEX public.kontaktperson_typ_pkey OWNER TO fsvb1;

--
-- Name: kurs_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY kurs
    ADD CONSTRAINT kurs_pkey PRIMARY KEY (kurs_id);


ALTER INDEX public.kurs_pkey OWNER TO fsvb1;

--
-- Name: kurstyp_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY kurstyp
    ADD CONSTRAINT kurstyp_pkey PRIMARY KEY (kurstyp_id);


ALTER INDEX public.kurstyp_pkey OWNER TO fsvb1;

--
-- Name: lehrer_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY lehrer
    ADD CONSTRAINT lehrer_pkey PRIMARY KEY (person_id);


ALTER INDEX public.lehrer_pkey OWNER TO fsvb1;

--
-- Name: leistung_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY leistung
    ADD CONSTRAINT leistung_pkey PRIMARY KEY (leistung_id);


ALTER INDEX public.leistung_pkey OWNER TO fsvb1;

--
-- Name: leistung_typ_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY leistung_typ
    ADD CONSTRAINT leistung_typ_pkey PRIMARY KEY (typ_id);


ALTER INDEX public.leistung_typ_pkey OWNER TO fsvb1;

--
-- Name: logging_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY logging
    ADD CONSTRAINT logging_pkey PRIMARY KEY (log_id);


ALTER INDEX public.logging_pkey OWNER TO fsvb1;

--
-- Name: login_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY login
    ADD CONSTRAINT login_pkey PRIMARY KEY (login_name);


ALTER INDEX public.login_pkey OWNER TO fsvb1;

--
-- Name: menu_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY menu
    ADD CONSTRAINT menu_pkey PRIMARY KEY (menu_id);


ALTER INDEX public.menu_pkey OWNER TO fsvb1;

--
-- Name: note_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY note
    ADD CONSTRAINT note_pkey PRIMARY KEY (note_id);


ALTER INDEX public.note_pkey OWNER TO fsvb1;

--
-- Name: person_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY person
    ADD CONSTRAINT person_pkey PRIMARY KEY (person_id);


ALTER INDEX public.person_pkey OWNER TO fsvb1;

--
-- Name: plugins_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY plugins
    ADD CONSTRAINT plugins_pkey PRIMARY KEY (name);


ALTER INDEX public.plugins_pkey OWNER TO fsvb1;

--
-- Name: raum_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY raum
    ADD CONSTRAINT raum_pkey PRIMARY KEY (raum_id);


ALTER INDEX public.raum_pkey OWNER TO fsvb1;

--
-- Name: rolle_menu_recht_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY rolle_menu_recht
    ADD CONSTRAINT rolle_menu_recht_pkey PRIMARY KEY (rolle_id, menu_id);


ALTER INDEX public.rolle_menu_recht_pkey OWNER TO fsvb1;

--
-- Name: rolle_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY rolle
    ADD CONSTRAINT rolle_pkey PRIMARY KEY (rolle_id);


ALTER INDEX public.rolle_pkey OWNER TO fsvb1;

--
-- Name: schueler_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY schueler
    ADD CONSTRAINT schueler_pkey PRIMARY KEY (person_id);


ALTER INDEX public.schueler_pkey OWNER TO fsvb1;

--
-- Name: schule_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY schule
    ADD CONSTRAINT schule_pkey PRIMARY KEY (name);


ALTER INDEX public.schule_pkey OWNER TO fsvb1;

--
-- Name: sonstiges_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY sonstiges
    ADD CONSTRAINT sonstiges_pkey PRIMARY KEY (sonstiges_id);


ALTER INDEX public.sonstiges_pkey OWNER TO fsvb1;

--
-- Name: tadel_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY tadel
    ADD CONSTRAINT tadel_pkey PRIMARY KEY (sonstiges_id);


ALTER INDEX public.tadel_pkey OWNER TO fsvb1;

--
-- Name: testtabelle_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY testtabelle
    ADD CONSTRAINT testtabelle_pkey PRIMARY KEY (raum_id);


ALTER INDEX public.testtabelle_pkey OWNER TO fsvb1;

--
-- Name: unterricht_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY unterricht
    ADD CONSTRAINT unterricht_pkey PRIMARY KEY (schueler_id, kurs_id);


ALTER INDEX public.unterricht_pkey OWNER TO fsvb1;

--
-- Name: unterrichtet_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY unterrichtet
    ADD CONSTRAINT unterrichtet_pkey PRIMARY KEY (fach_id, lehrer_id);


ALTER INDEX public.unterrichtet_pkey OWNER TO fsvb1;

--
-- Name: veranstaltung_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY veranstaltung
    ADD CONSTRAINT veranstaltung_pkey PRIMARY KEY (veranstaltung_id);


ALTER INDEX public.veranstaltung_pkey OWNER TO fsvb1;

--
-- Name: verantwortung_typ_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY verantwortung_typ
    ADD CONSTRAINT verantwortung_typ_pkey PRIMARY KEY (verantwortung_typ_id);


ALTER INDEX public.verantwortung_typ_pkey OWNER TO fsvb1;

--
-- Name: verwaltung_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY verwaltung
    ADD CONSTRAINT verwaltung_pkey PRIMARY KEY (person_id);


ALTER INDEX public.verwaltung_pkey OWNER TO fsvb1;

--
-- Name: verweis_pkey; Type: CONSTRAINT; Schema: public; Owner: fsvb1; Tablespace: 
--

ALTER TABLE ONLY verweis
    ADD CONSTRAINT verweis_pkey PRIMARY KEY (sonstiges_id);


ALTER INDEX public.verweis_pkey OWNER TO fsvb1;

--
-- Name: fk_benutzer_menu_recht; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY benutzer_menu_recht
    ADD CONSTRAINT fk_benutzer_menu_recht FOREIGN KEY (person_id) REFERENCES person(person_id) ON DELETE CASCADE;


--
-- Name: fk_fehlermeldungen_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY fehlermeldungen
    ADD CONSTRAINT fk_fehlermeldungen_1 FOREIGN KEY (fehler_id) REFERENCES fehler(fehler_id);


--
-- Name: fk_fehlermeldungen_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY fehlermeldungen
    ADD CONSTRAINT fk_fehlermeldungen_2 FOREIGN KEY (person_id) REFERENCES person(person_id);


--
-- Name: fk_fehlzeiten_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY fehlzeiten
    ADD CONSTRAINT fk_fehlzeiten_1 FOREIGN KEY (lehrer_id) REFERENCES lehrer(person_id);


--
-- Name: fk_fehlzeiten_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY fehlzeiten
    ADD CONSTRAINT fk_fehlzeiten_2 FOREIGN KEY (schueler_id) REFERENCES schueler(person_id);


--
-- Name: fk_kontaktperson_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY kontaktperson
    ADD CONSTRAINT fk_kontaktperson_1 FOREIGN KEY (typ) REFERENCES kontaktperson_typ(ktyp_id);


--
-- Name: fk_kontaktperson_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY kontaktperson
    ADD CONSTRAINT fk_kontaktperson_2 FOREIGN KEY (person_id) REFERENCES person(person_id);


--
-- Name: fk_kurs_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY kurs
    ADD CONSTRAINT fk_kurs_1 FOREIGN KEY (fach_id) REFERENCES fach(fach_id);


--
-- Name: fk_kurs_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY kurs
    ADD CONSTRAINT fk_kurs_2 FOREIGN KEY (kurstyp_id) REFERENCES kurstyp(kurstyp_id);


--
-- Name: fk_kurs_3; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY kurs
    ADD CONSTRAINT fk_kurs_3 FOREIGN KEY (halbjahr_id) REFERENCES halbjahr(halbjahr_id);


--
-- Name: fk_kurs_4; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY kurs
    ADD CONSTRAINT fk_kurs_4 FOREIGN KEY (lehrer_id) REFERENCES lehrer(person_id);


--
-- Name: fk_lehrer_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY lehrer
    ADD CONSTRAINT fk_lehrer_1 FOREIGN KEY (person_id) REFERENCES person(person_id);


--
-- Name: fk_leistung_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY leistung
    ADD CONSTRAINT fk_leistung_1 FOREIGN KEY (typ_id) REFERENCES leistung_typ(typ_id);


--
-- Name: fk_leistung_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY leistung
    ADD CONSTRAINT fk_leistung_2 FOREIGN KEY (note_id) REFERENCES note(note_id);


--
-- Name: fk_leistung_3; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY leistung
    ADD CONSTRAINT fk_leistung_3 FOREIGN KEY (kurs_id) REFERENCES kurs(kurs_id);


--
-- Name: fk_leistung_5; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY leistung
    ADD CONSTRAINT fk_leistung_5 FOREIGN KEY (veranstaltung_id) REFERENCES veranstaltung(veranstaltung_id);


--
-- Name: fk_logging_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY logging
    ADD CONSTRAINT fk_logging_1 FOREIGN KEY (person_id) REFERENCES person(person_id);


--
-- Name: fk_login_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY login
    ADD CONSTRAINT fk_login_1 FOREIGN KEY (person_id) REFERENCES person(person_id);


--
-- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY benutzer_rolle
    ADD CONSTRAINT fk_person_id FOREIGN KEY (person_id) REFERENCES person(person_id);


--
-- Name: fk_rolle_id; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY benutzer_rolle
    ADD CONSTRAINT fk_rolle_id FOREIGN KEY (rolle_id) REFERENCES rolle(rolle_id);


--
-- Name: fk_rolle_menu_recht_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY rolle_menu_recht
    ADD CONSTRAINT fk_rolle_menu_recht_1 FOREIGN KEY (rolle_id) REFERENCES rolle(rolle_id) ON DELETE CASCADE;


--
-- Name: fk_rolle_menu_recht_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY rolle_menu_recht
    ADD CONSTRAINT fk_rolle_menu_recht_2 FOREIGN KEY (menu_id) REFERENCES menu(menu_id) ON DELETE CASCADE;


--
-- Name: fk_schueler_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY schueler
    ADD CONSTRAINT fk_schueler_1 FOREIGN KEY (person_id) REFERENCES person(person_id);


--
-- Name: fk_tadel_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY tadel
    ADD CONSTRAINT fk_tadel_1 FOREIGN KEY (sonstiges_id) REFERENCES sonstiges(sonstiges_id);


--
-- Name: fk_unterricht_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY unterricht
    ADD CONSTRAINT fk_unterricht_2 FOREIGN KEY (kurs_id) REFERENCES kurs(kurs_id);


--
-- Name: fk_unterrichtet_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY unterrichtet
    ADD CONSTRAINT fk_unterrichtet_2 FOREIGN KEY (fach_id) REFERENCES fach(fach_id);


--
-- Name: fk_unterrichtet_3; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY unterrichtet
    ADD CONSTRAINT fk_unterrichtet_3 FOREIGN KEY (lehrer_id) REFERENCES lehrer(person_id);


--
-- Name: fk_veranstaltung_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY veranstaltung
    ADD CONSTRAINT fk_veranstaltung_1 FOREIGN KEY (kurs_id) REFERENCES kurs(kurs_id);


--
-- Name: fk_veranstaltung_2; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY veranstaltung
    ADD CONSTRAINT fk_veranstaltung_2 FOREIGN KEY (raum_id) REFERENCES raum(raum_id);


--
-- Name: fk_verantwortung_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY verantwortung
    ADD CONSTRAINT fk_verantwortung_1 FOREIGN KEY (verantwortung_typ) REFERENCES verantwortung_typ(verantwortung_typ_id);


--
-- Name: fk_verwaltung_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY verwaltung
    ADD CONSTRAINT fk_verwaltung_1 FOREIGN KEY (person_id) REFERENCES person(person_id);


--
-- Name: fk_verweis_1; Type: FK CONSTRAINT; Schema: public; Owner: fsvb1
--

ALTER TABLE ONLY verweis
    ADD CONSTRAINT fk_verweis_1 FOREIGN KEY (sonstiges_id) REFERENCES sonstiges(sonstiges_id);


--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--