-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Server version:               10.4.32-MariaDB - mariadb.org binary distribution
-- Server OS:                    Win64
-- 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 kvd
CREATE DATABASE IF NOT EXISTS `kvd` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;
USE `kvd`;

-- Dumping structure for table kvd.favoriti
CREATE TABLE IF NOT EXISTS `favoriti` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'identifikators',
  `lietotajvards` char(50) DEFAULT NULL COMMENT 'lietotajvards',
  `dziesma_id` int(11) NOT NULL COMMENT 'dziesmas identifikators',
  PRIMARY KEY (`id`),
  KEY `dziesmas_id` (`dziesma_id`),
  CONSTRAINT `dziesmas_id` FOREIGN KEY (`dziesma_id`) REFERENCES `muzika` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='tabula ar lietotaja favoritiem';

-- Data exporting was unselected.

-- Dumping structure for table kvd.lietotaji
CREATE TABLE IF NOT EXISTS `lietotaji` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'lietotaja identifikators',
  `lietotajvards` char(50) DEFAULT NULL COMMENT 'lietotajvards',
  `parole` varchar(255) DEFAULT NULL COMMENT 'sifreta parole',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='tabula ar visiem lietotajiem';

-- Data exporting was unselected.

-- Dumping structure for table kvd.muzika
CREATE TABLE IF NOT EXISTS `muzika` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'dziesmas identifikators',
  `nosaukums` char(50) DEFAULT NULL COMMENT 'dziesmas nosaukums',
  `autors` char(50) DEFAULT NULL COMMENT 'lietotajvards',
  `dziesma` blob DEFAULT NULL COMMENT 'dziesmas fails',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='tabula ar visam dziesmam';

-- Data exporting was unselected.

-- Dumping structure for table kvd.saraksti
CREATE TABLE IF NOT EXISTS `saraksti` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'saraksta identifikators',
  `lietotaja_id` int(11) NOT NULL COMMENT 'lietotaja identifikators',
  `nosaukums` text NOT NULL COMMENT 'saraksta nosaukums',
  `apraksts` varchar(50) DEFAULT NULL COMMENT 'saraksta apraksts',
  PRIMARY KEY (`id`),
  KEY `lietotaja_id` (`lietotaja_id`),
  CONSTRAINT `lietotaja_id` FOREIGN KEY (`lietotaja_id`) REFERENCES `lietotaji` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='tabula ar visiem sarakstiem';

-- Data exporting was unselected.

-- Dumping structure for table kvd.saraksts
CREATE TABLE IF NOT EXISTS `saraksts` (
  `id` int(11) NOT NULL COMMENT 'identifikators',
  `saraksts_id` int(11) NOT NULL COMMENT 'saraksta identifikators',
  `dziesma_id` int(11) NOT NULL COMMENT 'dziesmas identifikators',
  PRIMARY KEY (`id`),
  KEY `saraksts_id` (`saraksts_id`),
  KEY `dziesma_id` (`dziesma_id`),
  CONSTRAINT `dziesma_id` FOREIGN KEY (`dziesma_id`) REFERENCES `muzika` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `saraksts_id` FOREIGN KEY (`saraksts_id`) REFERENCES `saraksti` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='tabula ar dziemsam kontretaja saraksta';

-- 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) */;
