forked from s421507/eOSP2
Prześlij pliki do 'database/db'
This commit is contained in:
parent
8b42974d18
commit
7a5443ac10
494
database/db/eOSP.sql
Normal file
494
database/db/eOSP.sql
Normal file
@ -0,0 +1,494 @@
|
|||||||
|
-- MySQL Script generated by MySQL Workbench
|
||||||
|
-- Sun Nov 24 02:38:19 2019
|
||||||
|
-- Model: New Model Version: 1.0
|
||||||
|
-- MySQL Workbench Forward Engineering
|
||||||
|
|
||||||
|
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
||||||
|
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
||||||
|
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Schema osp
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Schema osp
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE SCHEMA IF NOT EXISTS `osp` DEFAULT CHARACTER SET utf16 COLLATE utf16_polish_ci ;
|
||||||
|
USE `osp` ;
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`uzytkownik`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`uzytkownik` (
|
||||||
|
`Id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`login` VARCHAR(45) NOT NULL,
|
||||||
|
`haslo` VARCHAR(45) NOT NULL,
|
||||||
|
`imie` VARCHAR(45) NOT NULL,
|
||||||
|
`nazwisko` VARCHAR(45) NOT NULL,
|
||||||
|
`data_urodzenia` DATE NOT NULL,
|
||||||
|
`pesel` INT NOT NULL,
|
||||||
|
`adres` VARCHAR(45) NULL,
|
||||||
|
`funkcja` VARCHAR(45) NOT NULL,
|
||||||
|
`stopien` VARCHAR(45) NOT NULL,
|
||||||
|
`aktywny` TINYINT NOT NULL DEFAULT 1,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`Id`),
|
||||||
|
CONSTRAINT `edytor`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `Id_UNIQUE` ON `osp`.`uzytkownik` (`Id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`uzytkownik` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `login_UNIQUE` ON `osp`.`uzytkownik` (`login` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`typ_szkolenia`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`typ_szkolenia` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`nazwa` VARCHAR(45) NOT NULL,
|
||||||
|
`szkolenie_kpp` TINYINT NOT NULL DEFAULT 0,
|
||||||
|
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `edytor`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`typ_szkolenia` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`typ_szkolenia` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`szkolenie_uzytkownika`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`szkolenie_uzytkownika` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`typ_szkolenia_id` INT UNSIGNED NOT NULL,
|
||||||
|
`uzytkownik_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_szkolenia` DATE NOT NULL,
|
||||||
|
`data_waznosci` DATE NULL,
|
||||||
|
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `typ_szkolenia`
|
||||||
|
FOREIGN KEY (`typ_szkolenia_id`)
|
||||||
|
REFERENCES `osp`.`typ_szkolenia` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `uzytkownik`
|
||||||
|
FOREIGN KEY (`uzytkownik_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `edytor`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`szkolenie_uzytkownika` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `typ_szkolenia_idx` ON `osp`.`szkolenie_uzytkownika` (`typ_szkolenia_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `uzytkownik_idx` ON `osp`.`szkolenie_uzytkownika` (`uzytkownik_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`szkolenie_uzytkownika` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`badanie`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`badanie` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`uzytkownik_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_badania` DATE NOT NULL,
|
||||||
|
`waznosc_badania` DATE NOT NULL,
|
||||||
|
`lekarz` VARCHAR(45) NOT NULL,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `uzytkownik0`
|
||||||
|
FOREIGN KEY (`uzytkownik_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `edytor0`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`badanie` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `uzytkownik_idx` ON `osp`.`badanie` (`uzytkownik_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`badanie` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`uzytkownik_historia`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`uzytkownik_historia` (
|
||||||
|
`Id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`uzytkownik_id` INT UNSIGNED NOT NULL,
|
||||||
|
`login` VARCHAR(45) NOT NULL,
|
||||||
|
`haslo` VARCHAR(45) NOT NULL,
|
||||||
|
`imie` VARCHAR(45) NOT NULL,
|
||||||
|
`nazwisko` VARCHAR(45) NOT NULL,
|
||||||
|
`data_urodzenia` DATE NOT NULL,
|
||||||
|
`pesel` INT NOT NULL,
|
||||||
|
`adres` VARCHAR(45) NULL,
|
||||||
|
`funkcja` VARCHAR(45) NOT NULL,
|
||||||
|
`stopien` VARCHAR(45) NOT NULL,
|
||||||
|
`aktywny` TINYINT NOT NULL DEFAULT 1,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`Id`),
|
||||||
|
CONSTRAINT `edytor1`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `uzytkownik`
|
||||||
|
FOREIGN KEY (`uzytkownik_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `Id_UNIQUE` ON `osp`.`uzytkownik_historia` (`Id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `login_UNIQUE` ON `osp`.`uzytkownik_historia` (`login` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor1_idx` ON `osp`.`uzytkownik_historia` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `uzytkownik_idx` ON `osp`.`uzytkownik_historia` (`uzytkownik_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`zastep`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`zastep` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`pojazd_id` INT UNSIGNED NOT NULL,
|
||||||
|
`kierowca` INT UNSIGNED NOT NULL,
|
||||||
|
`dowodca` INT UNSIGNED NOT NULL,
|
||||||
|
`przod_roty_1` INT UNSIGNED NOT NULL,
|
||||||
|
`pom_przod_roty_1` INT UNSIGNED NOT NULL,
|
||||||
|
`przod_roty_2` INT UNSIGNED NOT NULL,
|
||||||
|
`pom_przod_roty_2` INT UNSIGNED NOT NULL,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `edytor`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`zastep` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`zastep` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`zastep_historia`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`zastep_historia` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`zastep_id` INT UNSIGNED NOT NULL,
|
||||||
|
`pojazd_id` INT UNSIGNED NOT NULL,
|
||||||
|
`kierowca` INT UNSIGNED NOT NULL,
|
||||||
|
`dowodca` INT UNSIGNED NOT NULL,
|
||||||
|
`przod_roty_1` INT UNSIGNED NOT NULL,
|
||||||
|
`pom_przod_roty_1` INT UNSIGNED NOT NULL,
|
||||||
|
`przod_roty_2` INT UNSIGNED NOT NULL,
|
||||||
|
`pom_przod_roty_2` INT UNSIGNED NOT NULL,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `edytor2`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `zastep`
|
||||||
|
FOREIGN KEY (`zastep_id`)
|
||||||
|
REFERENCES `osp`.`zastep` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`zastep_historia` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`zastep_historia` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `zastep_idx` ON `osp`.`zastep_historia` (`zastep_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`wyjazd`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`wyjazd` (
|
||||||
|
`id` INT NOT NULL,
|
||||||
|
`zastep_id` INT UNSIGNED NOT NULL,
|
||||||
|
`adres` VARCHAR(45) NOT NULL,
|
||||||
|
`opis` VARCHAR(45) NOT NULL,
|
||||||
|
`godzina_wyjazdu` DATETIME NOT NULL,
|
||||||
|
`godzina_powrotu` DATETIME NOT NULL,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `zastep`
|
||||||
|
FOREIGN KEY (`zastep_id`)
|
||||||
|
REFERENCES `osp`.`zastep_historia` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `edytor`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE INDEX `zastep_idx` ON `osp`.`wyjazd` (`zastep_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`wyjazd` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`pojazdy`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`pojazdy` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`nazwa` VARCHAR(45) NOT NULL,
|
||||||
|
`numer_rejestracyjny` VARCHAR(45) NULL,
|
||||||
|
`marka_pojazdu` VARCHAR(45) NULL,
|
||||||
|
`typ_model_podwozia` VARCHAR(45) NULL,
|
||||||
|
`producent_podwozia` VARCHAR(45) NULL,
|
||||||
|
`układ_napedowy` VARCHAR(45) NULL,
|
||||||
|
`ilosc_osob_w_zalodze` INT NULL,
|
||||||
|
`ilosc_srodka_pianotworczego` FLOAT NULL,
|
||||||
|
`moc_silnika` FLOAT NULL,
|
||||||
|
`masa_calkowita` FLOAT NULL,
|
||||||
|
`numer_podwozia` VARCHAR(45) NULL,
|
||||||
|
`numer_silnika` VARCHAR(45) NULL,
|
||||||
|
`rodzaj_paliwa` VARCHAR(45) NULL,
|
||||||
|
`rok_produkcji_podwozia` INT NULL,
|
||||||
|
`data_wprowadzenia_do_eksploatacji` DATE NULL,
|
||||||
|
`opis_autopompy` VARCHAR(45) NULL,
|
||||||
|
`data_waznosci_przegladu_technicznego` DATE NULL,
|
||||||
|
`termin_waznosci_ubezpieczenia_OC` DATE NULL,
|
||||||
|
`usuniety` TINYINT NOT NULL DEFAULT 0,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `edytor_id`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `idpojazdy_UNIQUE` ON `osp`.`pojazdy` (`id` ASC) INVISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_id_idx` ON `osp`.`pojazdy` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`pojazdy_historia`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`pojazdy_historia` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`pojazdy_id` INT UNSIGNED NOT NULL,
|
||||||
|
`nazwa` VARCHAR(45) NOT NULL,
|
||||||
|
`numer_rejestracyjny` VARCHAR(45) NULL,
|
||||||
|
`marka_pojazdu` VARCHAR(45) NULL,
|
||||||
|
`typ_model_podwozia` VARCHAR(45) NULL,
|
||||||
|
`producent_podwozia` VARCHAR(45) NULL,
|
||||||
|
`układ_napedowy` VARCHAR(45) NULL,
|
||||||
|
`ilosc_osob_w_zalodze` INT NULL,
|
||||||
|
`ilosc_srodka_pianotworczego` FLOAT NULL,
|
||||||
|
`moc_silnika` FLOAT NULL,
|
||||||
|
`masa_calkowita` FLOAT NULL,
|
||||||
|
`numer_podwozia` VARCHAR(45) NULL,
|
||||||
|
`numer_silnika` VARCHAR(45) NULL,
|
||||||
|
`rodzaj_paliwa` VARCHAR(45) NULL,
|
||||||
|
`rok_produkcji_podwozia` INT NULL,
|
||||||
|
`data_wprowadzenia_do_eksploatacji` DATE NULL,
|
||||||
|
`opis_autopompy` VARCHAR(45) NULL,
|
||||||
|
`data_waznosci_przegladu_technicznego` DATE NULL,
|
||||||
|
`termin_waznosci_ubezpieczenia_OC` DATE NULL,
|
||||||
|
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `edytor_id`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `pojazdy_id`
|
||||||
|
FOREIGN KEY (`pojazdy_id`)
|
||||||
|
REFERENCES `osp`.`pojazdy` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `idpojazdy_UNIQUE` ON `osp`.`pojazdy_historia` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `pojazdy_id_idx` ON `osp`.`pojazdy_historia` (`pojazdy_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_id_idx` ON `osp`.`pojazdy_historia` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`typ_szkolenia_historia`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`typ_szkolenia_historia` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`typ_szkolenia_id` INT UNSIGNED NOT NULL,
|
||||||
|
`nazwa` VARCHAR(45) NOT NULL,
|
||||||
|
`szkolenie_kpp` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `edytor`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `typ_szkolenia_id`
|
||||||
|
FOREIGN KEY (`typ_szkolenia_id`)
|
||||||
|
REFERENCES `osp`.`typ_szkolenia` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`typ_szkolenia_historia` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`typ_szkolenia_historia` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `typ_szkolenia_id_idx` ON `osp`.`typ_szkolenia_historia` (`typ_szkolenia_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`szkolenie_uzytkownika_historia`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`szkolenie_uzytkownika_historia` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`szkolenie_uzytkownika_id` INT UNSIGNED NOT NULL,
|
||||||
|
`typ_szkolenia_id` INT UNSIGNED NOT NULL,
|
||||||
|
`uzytkownik_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_szkolenia` DATE NOT NULL,
|
||||||
|
`data_waznosci` DATE NULL,
|
||||||
|
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `typ_szkolenia`
|
||||||
|
FOREIGN KEY (`typ_szkolenia_id`)
|
||||||
|
REFERENCES `osp`.`typ_szkolenia` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `uzytkownik`
|
||||||
|
FOREIGN KEY (`uzytkownik_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `edytor`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`szkolenie_uzytkownika_historia` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `typ_szkolenia_idx` ON `osp`.`szkolenie_uzytkownika_historia` (`typ_szkolenia_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `uzytkownik_idx` ON `osp`.`szkolenie_uzytkownika_historia` (`uzytkownik_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_idx` ON `osp`.`szkolenie_uzytkownika_historia` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`sprzet`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`sprzet` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`nazwa` VARCHAR(45) NOT NULL,
|
||||||
|
`ilosc` INT NOT NULL DEFAULT 0,
|
||||||
|
`parametr_charakterystyczny` VARCHAR(45) NULL,
|
||||||
|
`rodzaj_sprzetu` VARCHAR(45) NOT NULL,
|
||||||
|
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `edytor_id`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`sprzet` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_id_idx` ON `osp`.`sprzet` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `osp`.`sprzet_historia`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `osp`.`sprzet_historia` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`sprzet_id` INT UNSIGNED NOT NULL,
|
||||||
|
`nazwa` VARCHAR(45) NOT NULL,
|
||||||
|
`ilosc` INT NOT NULL,
|
||||||
|
`parametr_charakterystyczny` VARCHAR(45) NULL,
|
||||||
|
`rodzaj_sprzetu` VARCHAR(45) NOT NULL,
|
||||||
|
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`edytor_id` INT UNSIGNED NOT NULL,
|
||||||
|
`data_edycji` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `edytor_id`
|
||||||
|
FOREIGN KEY (`edytor_id`)
|
||||||
|
REFERENCES `osp`.`uzytkownik` (`Id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `sprzet_id`
|
||||||
|
FOREIGN KEY (`sprzet_id`)
|
||||||
|
REFERENCES `osp`.`sprzet` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`sprzet_historia` (`id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `edytor_id_idx` ON `osp`.`sprzet_historia` (`edytor_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
CREATE INDEX `sprzet_id_idx` ON `osp`.`sprzet_historia` (`sprzet_id` ASC) VISIBLE;
|
||||||
|
|
||||||
|
|
||||||
|
SET SQL_MODE=@OLD_SQL_MODE;
|
||||||
|
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||||
|
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
BIN
database/db/osp.mwb
Normal file
BIN
database/db/osp.mwb
Normal file
Binary file not shown.
BIN
database/db/osp.mwb.bak
Normal file
BIN
database/db/osp.mwb.bak
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user