CREATE TABLE `WERKNEMER` (
    `WERKNEMER_ID` INT PRIMARY KEY,
    `GEBOORTEDATUM` DATE,
    `NAAM` VARCHAR(80),
    `VOORNAAM` VARCHAR(255),
    `WOONPLAATS` VARCHAR(50)
) ENGINE=InnoDB;

CREATE TABLE `FUNCTIE` (
    `FUNCTIE_ID` INT PRIMARY KEY,
    `CODE` VARCHAR(50),
    `NAAM` VARCHAR(80),
    `OMSCHRIJVING` TEXT,
    `SCHAAL` VARCHAR(20),
    `TAKEN` TEXT
) ENGINE=InnoDB;

CREATE TABLE `SOLLICITANT` (
    `SOLLICITANT_ID` INT PRIMARY KEY
) ENGINE=InnoDB;

CREATE TABLE `DOCUMENT` (
    `DOCUMENT_ID` INT PRIMARY KEY,
    `COCUMENTBESCHRIJVING` VARCHAR(255),
    `DATUMCREATIEDOCUMENT` DATE,
    `DATUMONTVANGSTDOCUMENT` DATE,
    `DATUMVERZENDINGDOCUMENT` DATE,
    `DOCUMENTAUTEUR` VARCHAR(200),
    `DOCUMENTIDENTIFICATIE` VARCHAR(255),
    `DOCUMENTTITEL` VARCHAR(200),
    `VERTROUWELIJKAANDUIDING` VARCHAR(20)
) ENGINE=InnoDB;

CREATE TABLE `VACATURE` (
    `VACATURE_ID` INT PRIMARY KEY,
    `DATUMGESLOTEN` DATE,
    `DATUMOPENGESTELD` DATE,
    `DEELTIJD` DATETIME,
    `EXTERN` BOOLEAN,
    `INTERN` BOOLEAN,
    `VACATURE_BIJ_FUNCTIE_FUNCTIE_ID` INT,
    `VASTEDIENST` BOOLEAN
) ENGINE=InnoDB;

CREATE TABLE `KP_WRKNMR_DCMNT` (
    `KP_WRKNMR_DCMNT_ID` INT PRIMARY KEY,
    `WERKNEMER_ID` INT,
    `DOCUMENT_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `KP_VCTR_DCMNT` (
    `KP_VCTR_DCMNT_ID` INT PRIMARY KEY,
    `VACATURE_ID` INT,
    `DOCUMENT_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `SOLLICITATIE` (
    `SOLLICITATIE_ID` INT PRIMARY KEY,
    `DATUM` DATE,
    `OP_VACATURE_VACATURE_ID` INT,
    `SOLLICITEERT_OP_FUNCTIE_SOLLICITANT_ID` INT,
    `SOLLICITEERT_WERKNEMER_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `SOLLICITATIEGESPREK` (
    `SOLLICITATIEGESPREK_ID` INT PRIMARY KEY,
    `AANGENOMEN` BOOLEAN,
    `DATUM` DATE,
    `IN_KADER_VAN_SOLLICITATIE_ID` INT,
    `OPMERKINGEN` TEXT,
    `VOLGENDGESPREK` BOOLEAN
) ENGINE=InnoDB;

CREATE TABLE `KP_SLLCTTGSPRK_WRKNMR` (
    `KP_SLLCTTGSPRK_WRKNMR_ID` INT PRIMARY KEY,
    `SOLLICITATIEGESPREK_ID` INT,
    `WERKNEMER_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `KP_SLLCTTGSPRK_SLLCTNT` (
    `KP_SLLCTTGSPRK_SLLCTNT_ID` INT PRIMARY KEY,
    `SOLLICITATIEGESPREK_ID` INT,
    `SOLLICITANT_ID` INT
) ENGINE=InnoDB;

ALTER TABLE `KP_WRKNMR_DCMNT` ADD CONSTRAINT FK_KP_WRKNMR_DCMNT_1 FOREIGN KEY (`WERKNEMER_ID`) REFERENCES `WERKNEMER` (`WERKNEMER_ID`);
-- WERKNEMER (many-to-many junction, Connector_ID: 107)

ALTER TABLE `KP_WRKNMR_DCMNT` ADD CONSTRAINT FK_KP_WRKNMR_DCMNT_2 FOREIGN KEY (`DOCUMENT_ID`) REFERENCES `DOCUMENT` (`DOCUMENT_ID`);
-- DOCUMENT (many-to-many junction, Connector_ID: 107)

ALTER TABLE `KP_VCTR_DCMNT` ADD CONSTRAINT FK_KP_VCTR_DCMNT_1 FOREIGN KEY (`VACATURE_ID`) REFERENCES `VACATURE` (`VACATURE_ID`);
-- VACATURE (many-to-many junction, Connector_ID: 108)

ALTER TABLE `KP_VCTR_DCMNT` ADD CONSTRAINT FK_KP_VCTR_DCMNT_2 FOREIGN KEY (`DOCUMENT_ID`) REFERENCES `DOCUMENT` (`DOCUMENT_ID`);
-- DOCUMENT (many-to-many junction, Connector_ID: 108)

ALTER TABLE `KP_SLLCTTGSPRK_WRKNMR` ADD CONSTRAINT FK_KP_SLLCTTGSPRK_WRKNMR_1 FOREIGN KEY (`SOLLICITATIEGESPREK_ID`) REFERENCES `SOLLICITATIEGESPREK` (`SOLLICITATIEGESPREK_ID`);
-- SOLLICITATIEGESPREK (many-to-many junction, Connector_ID: 436)

ALTER TABLE `KP_SLLCTTGSPRK_WRKNMR` ADD CONSTRAINT FK_KP_SLLCTTGSPRK_WRKNMR_2 FOREIGN KEY (`WERKNEMER_ID`) REFERENCES `WERKNEMER` (`WERKNEMER_ID`);
-- WERKNEMER (many-to-many junction, Connector_ID: 436)

ALTER TABLE `KP_SLLCTTGSPRK_SLLCTNT` ADD CONSTRAINT FK_KP_SLLCTTGSPRK_SLLCTNT_1 FOREIGN KEY (`SOLLICITATIEGESPREK_ID`) REFERENCES `SOLLICITATIEGESPREK` (`SOLLICITATIEGESPREK_ID`);
-- SOLLICITATIEGESPREK (many-to-many junction, Connector_ID: 440)

ALTER TABLE `KP_SLLCTTGSPRK_SLLCTNT` ADD CONSTRAINT FK_KP_SLLCTTGSPRK_SLLCTNT_2 FOREIGN KEY (`SOLLICITANT_ID`) REFERENCES `SOLLICITANT` (`SOLLICITANT_ID`);
-- SOLLICITANT (many-to-many junction, Connector_ID: 440)

ALTER TABLE `SOLLICITATIE` ADD CONSTRAINT FK_SOLLICITATIE_SOLLICITEERT FOREIGN KEY (`SOLLICITEERT_WERKNEMER_ID`) REFERENCES `WERKNEMER` (`WERKNEMER_ID`);
-- SOLLICITEERT (1 to 0..*, Connector_ID: 437)

ALTER TABLE `SOLLICITATIEGESPREK` ADD CONSTRAINT FK_SOLLICITATIEGESPREK_IN_KADER_VAN FOREIGN KEY (`IN_KADER_VAN_SOLLICITATIE_ID`) REFERENCES `SOLLICITATIE` (`SOLLICITATIE_ID`);
-- IN_KADER_VAN (0..* to 1, Connector_ID: 438)

ALTER TABLE `SOLLICITATIE` ADD CONSTRAINT FK_SOLLICITATIE_OP_VACATURE FOREIGN KEY (`OP_VACATURE_VACATURE_ID`) REFERENCES `VACATURE` (`VACATURE_ID`);
-- OP_VACATURE (0..* to 1, Connector_ID: 439)

ALTER TABLE `SOLLICITATIE` ADD CONSTRAINT FK_SOLLICITATIE_SOLLICITEERT_OP_FUNCTIE FOREIGN KEY (`SOLLICITEERT_OP_FUNCTIE_SOLLICITANT_ID`) REFERENCES `SOLLICITANT` (`SOLLICITANT_ID`);
-- SOLLICITEERT_OP_FUNCTIE (1 to 0..*, Connector_ID: 441)

ALTER TABLE `VACATURE` ADD CONSTRAINT FK_VACATURE_VACATURE_BIJ_FUNCTIE FOREIGN KEY (`VACATURE_BIJ_FUNCTIE_FUNCTIE_ID`) REFERENCES `FUNCTIE` (`FUNCTIE_ID`);
-- VACATURE_BIJ_FUNCTIE (0..* to 1, Connector_ID: 460)

