CREATE TABLE `KP_AFWJKND_MTRGL_MTRGL` (
    `KP_AFWJKND_MTRGL_MTRGL_ID` INT PRIMARY KEY,
    `AFWIJKENDE_MAATREGEL_ID` INT,
    `MAATREGEL_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `KP_MTRGL_OP_UTKRNG_MTRGL` (
    `KP_MTRGL_OP_UTKRNG_MTRGL_ID` INT PRIMARY KEY,
    `MAATREGEL_OP_UITKERING_ID` INT,
    `MAATREGEL_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `KP_BT_MTRGL` (
    `KP_BT_MTRGL_ID` INT PRIMARY KEY,
    `BOETE_ID` INT,
    `MAATREGEL_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `AFWIJKENDE_MAATREGEL` (
    `MAATREGEL_ID` INT PRIMARY KEY,
    `BEDRAG` DECIMAL(10,2),
    `CODE_REDEN_AFWIJKING_MAATREGEL` VARCHAR(255),
    `MOTIVATIE_AFWIJKING_MAATREGEL` VARCHAR(255),
    `PERCENTAGE` VARCHAR(255),
    `REFEREERT_MAATREGEL_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `MAATREGEL` (
    `MAATREGEL_ID` INT PRIMARY KEY,
    `DATUM_AANVANG_MAATREGEL` DATE,
    `DATUM_EINDE_MAATREGEL` DATE,
    `DATUM_VASTSTELLING_MAATREGEL` DATE,
    `IDENTIFICATIE` DATE,
    `TYPE_MAATREGEL` VARCHAR(255)
) ENGINE=InnoDB;

CREATE TABLE `MAATREGEL_OP_UITKERING` (
    `MAATREGEL_ID` INT PRIMARY KEY,
    `CODE_REDEN_MAATREGEL` VARCHAR(255),
    `MOTIVATIE_VERMINDERING_MAATREGEL` VARCHAR(255),
    `PERCENTAGE_MAATREGEL` VARCHAR(255)
) ENGINE=InnoDB;

CREATE TABLE `BOETE` (
    `MAATREGEL_ID` INT PRIMARY KEY,
    `BEDRAG_BOETE` DECIMAL(10,2),
    `BOETEVORM` VARCHAR(255),
    `REDEN_BOETE` VARCHAR(255),
    `VOORWAARDE_BOETE` VARCHAR(255)
) ENGINE=InnoDB;

CREATE TABLE `NORMAFWIJKING` (
    `NORMAFWIJKING_ID` INT PRIMARY KEY,
    `DATUM_VASTSTELLING_NORMAFWIJKING` DATE,
    `DATUM_VASTSTELLING_VERWIJTBAARHEID` DATE,
    `IDENTIFICATIE` DATE,
    `MOTIVATIE_VERWIJTBAARHEID` DATE,
    `NORMAFWIJKING_LEIDT_TOT_MAATREGEL_MAATREGEL_ID` INT,
    `RECIDIVE` VARCHAR(255),
    `TYPE_NORMAFWIJKING` VARCHAR(255),
    `VERWIJTBAARHEID` VARCHAR(255)
) ENGINE=InnoDB;

ALTER TABLE `AFWIJKENDE_MAATREGEL` ADD CONSTRAINT FK_AFWIJKENDE_MAATREGEL_GEN_MAATREGEL FOREIGN KEY (`MAATREGEL_ID`) REFERENCES `MAATREGEL` (`MAATREGEL_ID`);
-- Generalization to MAATREGEL

ALTER TABLE `BOETE` ADD CONSTRAINT FK_BOETE_GEN_MAATREGEL FOREIGN KEY (`MAATREGEL_ID`) REFERENCES `MAATREGEL` (`MAATREGEL_ID`);
-- Generalization to MAATREGEL

ALTER TABLE `MAATREGEL_OP_UITKERING` ADD CONSTRAINT FK_MAATREGEL_OP_UITKERING_GEN_MAATREGEL FOREIGN KEY (`MAATREGEL_ID`) REFERENCES `MAATREGEL` (`MAATREGEL_ID`);
-- Generalization to MAATREGEL

ALTER TABLE `KP_MTRGL_OP_UTKRNG_MTRGL` ADD CONSTRAINT FK_KP_MTRGL_OP_UTKRNG_MTRGL_1 FOREIGN KEY (`MAATREGEL_OP_UITKERING_ID`) REFERENCES `MAATREGEL_OP_UITKERING` (`MAATREGEL_ID`);
-- MAATREGEL_OP_UITKERING (many-to-many junction, Connector_ID: 1696)

ALTER TABLE `KP_MTRGL_OP_UTKRNG_MTRGL` ADD CONSTRAINT FK_KP_MTRGL_OP_UTKRNG_MTRGL_2 FOREIGN KEY (`MAATREGEL_ID`) REFERENCES `MAATREGEL` (`MAATREGEL_ID`);
-- MAATREGEL (many-to-many junction, Connector_ID: 1696)

ALTER TABLE `KP_BT_MTRGL` ADD CONSTRAINT FK_KP_BT_MTRGL_1 FOREIGN KEY (`BOETE_ID`) REFERENCES `BOETE` (`MAATREGEL_ID`);
-- BOETE (many-to-many junction, Connector_ID: 1698)

ALTER TABLE `KP_BT_MTRGL` ADD CONSTRAINT FK_KP_BT_MTRGL_2 FOREIGN KEY (`MAATREGEL_ID`) REFERENCES `MAATREGEL` (`MAATREGEL_ID`);
-- MAATREGEL (many-to-many junction, Connector_ID: 1698)

ALTER TABLE `KP_AFWJKND_MTRGL_MTRGL` ADD CONSTRAINT FK_KP_AFWJKND_MTRGL_MTRGL_1 FOREIGN KEY (`AFWIJKENDE_MAATREGEL_ID`) REFERENCES `AFWIJKENDE_MAATREGEL` (`MAATREGEL_ID`);
-- AFWIJKENDE_MAATREGEL (many-to-many junction, Connector_ID: 1700)

ALTER TABLE `KP_AFWJKND_MTRGL_MTRGL` ADD CONSTRAINT FK_KP_AFWJKND_MTRGL_MTRGL_2 FOREIGN KEY (`MAATREGEL_ID`) REFERENCES `MAATREGEL` (`MAATREGEL_ID`);
-- MAATREGEL (many-to-many junction, Connector_ID: 1700)

ALTER TABLE `NORMAFWIJKING` ADD CONSTRAINT FK_NORMAFWIJKING_NORMAFWIJKING_LEIDT_TOT_MAATREGEL FOREIGN KEY (`NORMAFWIJKING_LEIDT_TOT_MAATREGEL_MAATREGEL_ID`) REFERENCES `MAATREGEL` (`MAATREGEL_ID`);
-- NORMAFWIJKING_LEIDT_TOT_MAATREGEL (0..1 to 1..1, Connector_ID: 1697)

ALTER TABLE `AFWIJKENDE_MAATREGEL` ADD CONSTRAINT FK_AFWIJKENDE_MAATREGEL_REFEREERT FOREIGN KEY (`REFEREERT_MAATREGEL_ID`) REFERENCES `MAATREGEL` (`MAATREGEL_ID`);
-- REFEREERT (1..1 to 1..1, Connector_ID: 1699)

