-- --------------------------------------------------------
-- Server OS:                    Linux
-- HeidiSQL Version:             12.14.0.7165
-- --------------------------------------------------------



-- Dumping database structure for sr_310_ricards_tren
CREATE DATABASE IF NOT EXISTS `sr_310_ricards_tren` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `sr_310_ricards_tren`;

-- Dumping structure for view sr_310_ricards_tren.rezultats
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `rezultats` (
	`ieraksti_id` INT NOT NULL,
	`diena` VARCHAR(1) NULL COMMENT 'nedēļas diena' COLLATE 'utf8mb4_unicode_ci',
	`datums` DATE NOT NULL COMMENT 'darba veikšanas datums',
	`laiks_no` TIME NOT NULL COMMENT 'darba veikšanas sākuma laiks',
	`darbs_id` INT NULL,
	`vieta_id` INT NULL
);

-- Removing temporary table and create final VIEW structure
CREATE ALGORITHM=UNDEFINED SQL SECURITY INVOKER VIEW `rezultats` AS select `ieraksti`.`ieraksti_id` AS `ieraksti_id`,`ieraksti`.`diena` AS `diena`,`ieraksti`.`datums` AS `datums`,`ieraksti`.`laiks_no` AS `laiks_no`,`ieraksti`.`darbs_id` AS `darbs_id`,`ieraksti`.`vieta_id` AS `vieta_id` from `ieraksti`
;

