-- --------------------------------------------------------
-- Server OS:                    Win32
-- HeidiSQL Version:             12.1.0.6537
-- --------------------------------------------------------



-- Dumping database structure for mihails akelans
DROP DATABASE IF EXISTS `mihails akelans`;
CREATE DATABASE IF NOT EXISTS `mihails akelans` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;
USE `mihails akelans`;

-- Dumping structure for table mihails akelans.adrese
CREATE TABLE IF NOT EXISTS `adrese` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'adrese id',
  `piesaistitais_id` int(10) unsigned DEFAULT '0' COMMENT 'piesaistitais adress id',
  `id_adr_lim` int(10) unsigned NOT NULL COMMENT 'adr_limenis id',
  `id_index` int(10) unsigned NOT NULL COMMENT 'index id',
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'nosaukums',
  PRIMARY KEY (`id`),
  KEY `piesaistitais_id` (`piesaistitais_id`),
  KEY `id_adr_lim` (`id_adr_lim`),
  KEY `id_index` (`id_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Adrese';

-- Dumping data for table mihails akelans.adrese: ~0 rows (approximately)

-- Dumping structure for table mihails akelans.adr_limenis
CREATE TABLE IF NOT EXISTS `adr_limenis` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'adr_limenis id',
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'adr_limenis',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Adresa limenis						\r\n';

-- Dumping data for table mihails akelans.adr_limenis: ~0 rows (approximately)

-- Dumping structure for table mihails akelans.catalogs
CREATE TABLE IF NOT EXISTS `catalogs` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'catalogs id',
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'preces kategorija',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Catalogs';

-- Dumping data for table mihails akelans.catalogs: ~2 rows (approximately)
INSERT INTO `catalogs` (`id`, `name`) VALUES
	(1, 'Datortehnika'),
	(2, 'Foto tehnika'),
	(3, 'Telefoni');

-- Dumping structure for table mihails akelans.index
CREATE TABLE IF NOT EXISTS `index` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'index id',
  `zip` smallint(4) unsigned NOT NULL COMMENT 'pasta indekss',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Index						\r\n';

-- Dumping data for table mihails akelans.index: ~0 rows (approximately)

-- Dumping structure for table mihails akelans.lietotajs
CREATE TABLE IF NOT EXISTS `lietotajs` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_persona` int(10) unsigned NOT NULL,
  `activestatus` smallint(1) unsigned DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `id_persona` (`id_persona`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lietotajs';

-- Dumping data for table mihails akelans.lietotajs: ~3 rows (approximately)
INSERT INTO `lietotajs` (`id`, `id_persona`, `activestatus`) VALUES
	(1, 1, 0),
	(2, 2, 1),
	(3, 3, 0);

-- Dumping structure for table mihails akelans.persona
CREATE TABLE IF NOT EXISTS `persona` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'personas id',
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'personas vards',
  `surname` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'personas uzvards',
  `e-mail` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'personas e-pasts',
  `phone` int(10) unsigned NOT NULL COMMENT 'personas numurs',
  `id_adrese` int(10) unsigned DEFAULT NULL COMMENT 'personas adrese id',
  PRIMARY KEY (`id`),
  KEY `id_adrese` (`id_adrese`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Persona';

-- Dumping data for table mihails akelans.persona: ~2 rows (approximately)
INSERT INTO `persona` (`id`, `name`, `surname`, `e-mail`, `phone`, `id_adrese`) VALUES
	(1, 'Mihails', 'Akelans', 'akelan2003@gmail.com', 2545123, NULL),
	(2, 'Ņikita', 'Čaikovskis', 'chaikovskis2003@gmail.com', 2545123, NULL),
	(3, 'Vladislavs', 'Grebeņiks', 'grebenik2003@gmail.com', 2545123, NULL);

-- Dumping structure for table mihails akelans.pirkums
CREATE TABLE IF NOT EXISTS `pirkums` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'pirkuma id',
  `id_rekins` int(10) unsigned NOT NULL COMMENT 'rekins id',
  `id_catalogs` int(10) unsigned NOT NULL COMMENT 'catalogs id',
  `count` int(10) unsigned NOT NULL COMMENT 'skaits',
  `atlaide?` int(10) unsigned DEFAULT NULL COMMENT 'atlaide procentos',
  PRIMARY KEY (`id`),
  KEY `id_rekins` (`id_rekins`),
  KEY `id_catalogs` (`id_catalogs`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Pirkums';

-- Dumping data for table mihails akelans.pirkums: ~0 rows (approximately)

-- Dumping structure for table mihails akelans.prece
CREATE TABLE IF NOT EXISTS `prece` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'preces id',
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'preces nosaukums',
  `id_catalogs` int(10) unsigned NOT NULL COMMENT 'catalogs id',
  `pay` decimal(7,2) unsigned NOT NULL COMMENT 'cena',
  `photo` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'bilde ar nosaukumu',
  `text` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'info',
  PRIMARY KEY (`id`),
  KEY `id_catalogs` (`id_catalogs`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Prece';

-- Dumping data for table mihails akelans.prece: ~3 rows (approximately)
INSERT INTO `prece` (`id`, `name`, `id_catalogs`, `pay`, `photo`, `text`) VALUES
	(1, 'dators', 1, 1000.00, NULL, NULL),
	(2, 'kamera', 2, 300.00, NULL, NULL),
	(3, 'telefons', 3, 199.00, NULL, NULL);

-- Dumping structure for table mihails akelans.rekins
CREATE TABLE IF NOT EXISTS `rekins` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'rekins id',
  `date` date DEFAULT NULL COMMENT 'rekina datums',
  `id_lietotajs` int(10) unsigned NOT NULL COMMENT 'lietotajs id',
  `contact_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'kontakt informacija',
  PRIMARY KEY (`id`),
  KEY `id_lietotajs` (`id_lietotajs`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reķins';

-- Dumping data for table mihails akelans.rekins: ~3 rows (approximately)
INSERT INTO `rekins` (`id`, `date`, `id_lietotajs`, `contact_name`) VALUES
	(1, '2022-11-08', 1, NULL),
	(2, '2022-11-08', 2, NULL),
	(3, '2022-11-08', 3, NULL);

