-- --------------------------------------------------------
-- Server OS:                    Win64
-- HeidiSQL Version:             12.6.0.6765
-- --------------------------------------------------------


-- Dumping structure for table dinero_db.darijumi
CREATE TABLE IF NOT EXISTS `darijumi` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'darijuma id',
  `kont_id` int(11) DEFAULT NULL COMMENT 'konta id',
  `sanem_kont_id` int(11) DEFAULT NULL COMMENT 'saņēmēja konta id',
  `nosaukums` varchar(100) DEFAULT NULL COMMENT 'darijuma nosaukums',
  `dar_dat_laik` date DEFAULT NULL COMMENT 'darijuma datums un laiks',
  `dar_sum` decimal(10,0) DEFAULT NULL COMMENT 'darijuma summa',
  PRIMARY KEY (`id`),
  KEY `sanem_kont_id` (`kont_id`),
  CONSTRAINT `kont_id` FOREIGN KEY (`kont_id`) REFERENCES `konts` (`id`),
  CONSTRAINT `sanem_kont_id` FOREIGN KEY (`kont_id`) REFERENCES `konts` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table dinero_db.darijumi: ~0 rows (approximately)

-- Dumping structure for table dinero_db.karte
CREATE TABLE IF NOT EXISTS `karte` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'kartes id',
  `konta_id` int(11) DEFAULT NULL COMMENT 'konta id',
  `kart_tip_id` int(11) DEFAULT NULL COMMENT 'kartes tipa id',
  `kart_nr` decimal(16,0) DEFAULT NULL COMMENT 'kartes numurs',
  `kart_der` date DEFAULT NULL COMMENT 'kartes derīguma termiņš',
  `kart_cvv` decimal(3,0) DEFAULT NULL COMMENT 'kartes cvv kods',
  `pin` decimal(4,0) DEFAULT NULL COMMENT 'kartes pin kods',
  `blok_kart` tinyint(1) DEFAULT NULL COMMENT 'iespēja bloķēt karti',
  `inter_maks` tinyint(1) DEFAULT NULL COMMENT 'iespēja veikt interneta maksājumus',
  `pirk_arzem` tinyint(1) DEFAULT NULL COMMENT 'iespēja veikt pirkumus ārzemēs',
  `bezkont_maks` tinyint(1) DEFAULT NULL COMMENT 'iespēja veikt bezkontaktu maksājumus',
  PRIMARY KEY (`id`),
  KEY `kart_tip_id` (`kart_tip_id`),
  KEY `konta_id` (`konta_id`),
  CONSTRAINT `kart_tip_id` FOREIGN KEY (`kart_tip_id`) REFERENCES `kartes_tips` (`id`),
  CONSTRAINT `konta_id` FOREIGN KEY (`konta_id`) REFERENCES `konts` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table dinero_db.karte: ~0 rows (approximately)

-- Dumping structure for table dinero_db.kartes_tips
CREATE TABLE IF NOT EXISTS `kartes_tips` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'kartes tipa id',
  `kart_tip` varchar(15) DEFAULT NULL COMMENT 'kartes tips',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table dinero_db.kartes_tips: ~0 rows (approximately)

-- Dumping structure for table dinero_db.konts
CREATE TABLE IF NOT EXISTS `konts` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'konta id',
  `liet_id` int(11) DEFAULT NULL COMMENT 'lietotaja id',
  `kont_nr` varchar(25) DEFAULT NULL COMMENT 'konta numurs',
  PRIMARY KEY (`id`),
  KEY `liet_id` (`liet_id`),
  CONSTRAINT `liet_id` FOREIGN KEY (`liet_id`) REFERENCES `lietotajs` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table dinero_db.konts: ~0 rows (approximately)

-- Dumping structure for table dinero_db.lietotajs
CREATE TABLE IF NOT EXISTS `lietotajs` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'lietotaja id',
  `pers_id` int(11) DEFAULT NULL COMMENT 'personas id',
  `parole` varchar(20) DEFAULT NULL COMMENT 'lietotaja parole',
  PRIMARY KEY (`id`),
  KEY `FK_lietotajs_Persona` (`pers_id`),
  CONSTRAINT `FK_lietotajs_Persona` FOREIGN KEY (`pers_id`) REFERENCES `persona` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table dinero_db.lietotajs: ~1 rows (approximately)
INSERT INTO `lietotajs` (`id`, `pers_id`, `parole`) VALUES
	(1, 1, '$2y$10$iSsoYfMMyeG3YkFWmtvx3O87cGsnImxWH4mNGRv1d4nDExh.Kf3E.'),
	(2, 2, '$2y$10$yXtf8WrzgY85XeiXpVoJ..mBy8In2kHrFcHp2MzpwxZImkqoVa6oe');

-- Dumping structure for table dinero_db.persona
CREATE TABLE IF NOT EXISTS `persona` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'personas id',
  `vards` varchar(20) DEFAULT NULL COMMENT 'personas vards',
  `uzvards` varchar(20) DEFAULT NULL COMMENT 'personas uzvards',
  `dz_diena` date DEFAULT NULL COMMENT 'dzimsanas diena',
  `epasts` varchar(20) DEFAULT NULL COMMENT 'personas epasts',
  `dzimums` tinyint(1) DEFAULT NULL COMMENT 'personas dzimums',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Personas dati';

-- Dumping data for table dinero_db.persona: ~1 rows (approximately)
INSERT INTO `persona` (`id`, `vards`, `uzvards`, `dz_diena`, `epasts`, `dzimums`) VALUES
	(1, 'emils', 'skab', '2007-05-05', 'emils@gmail.com', 1),
	(2, 'dima', 'ssss', '2005-12-12', 'dima@gmail.com', 1);

