-- --------------------------------------------------------
-- Host:                         153.92.1.116
-- Server version:               8.0.39-0ubuntu0.22.04.1 - (Ubuntu)
-- Server OS:                    Linux
-- HeidiSQL Version:             12.8.0.6908
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


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

-- Dumping structure for table laura_k.autors
CREATE TABLE IF NOT EXISTS `autors` (
  `autors_id` int unsigned NOT NULL AUTO_INCREMENT,
  `vards` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `uzvards` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`autors_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Data exporting was unselected.

-- Dumping structure for table laura_k.gramata
CREATE TABLE IF NOT EXISTS `gramata` (
  `gr_id` int unsigned NOT NULL AUTO_INCREMENT,
  `nosaukums` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `apraksts` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `izd_gads` year NOT NULL,
  `zanrs_id` int unsigned NOT NULL,
  `autors_id` int unsigned NOT NULL,
  PRIMARY KEY (`gr_id`),
  KEY `FK_gramata_zanrs` (`zanrs_id`),
  KEY `FK_gramata_autors` (`autors_id`),
  CONSTRAINT `FK_gramata_autors` FOREIGN KEY (`autors_id`) REFERENCES `autors` (`autors_id`),
  CONSTRAINT `FK_gramata_zanrs` FOREIGN KEY (`zanrs_id`) REFERENCES `zanrs` (`zanrs_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Data exporting was unselected.

-- Dumping structure for table laura_k.komentars
CREATE TABLE IF NOT EXISTS `komentars` (
  `koment_id` int unsigned NOT NULL AUTO_INCREMENT,
  `koment` tinytext COLLATE utf8mb4_unicode_ci NOT NULL,
  `gr_id` int unsigned NOT NULL,
  `liet_id` int unsigned NOT NULL,
  `laiks` timestamp NOT NULL DEFAULT (unix_timestamp(now())),
  PRIMARY KEY (`koment_id`),
  KEY `FK_komentars_gramata` (`gr_id`),
  KEY `FK_komentars_lietotajs` (`liet_id`),
  CONSTRAINT `FK_komentars_gramata` FOREIGN KEY (`gr_id`) REFERENCES `gramata` (`gr_id`),
  CONSTRAINT `FK_komentars_lietotajs` FOREIGN KEY (`liet_id`) REFERENCES `lietotajs` (`liet_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Data exporting was unselected.

-- Dumping structure for table laura_k.lietotajs
CREATE TABLE IF NOT EXISTS `lietotajs` (
  `liet_id` int unsigned NOT NULL AUTO_INCREMENT,
  `liet_vards` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `epasts` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `parole` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `valsts_id` int unsigned NOT NULL,
  PRIMARY KEY (`liet_id`),
  KEY `FK_lietotajs_valsts` (`valsts_id`),
  CONSTRAINT `FK_lietotajs_valsts` FOREIGN KEY (`valsts_id`) REFERENCES `valsts` (`valsts_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Data exporting was unselected.

-- Dumping structure for table laura_k.valsts
CREATE TABLE IF NOT EXISTS `valsts` (
  `valsts_id` int unsigned NOT NULL AUTO_INCREMENT,
  `valsts` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`valsts_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Data exporting was unselected.

-- Dumping structure for table laura_k.zanrs
CREATE TABLE IF NOT EXISTS `zanrs` (
  `zanrs_id` int unsigned NOT NULL AUTO_INCREMENT,
  `zanrs` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`zanrs_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Data exporting was unselected.

/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
