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


-- Dumping structure for table car_registration.cars
CREATE TABLE IF NOT EXISTS `cars` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `make` varchar(50) DEFAULT NULL,
  `model` varchar(50) DEFAULT NULL,
  `year` int(11) DEFAULT NULL,
  `color` varchar(20) DEFAULT NULL,
  `fuel` varchar(20) DEFAULT NULL,
  `registration_number` varchar(20) DEFAULT NULL,
  `vin` varchar(17) DEFAULT NULL,
  `price` varchar(50) DEFAULT NULL,
  `description` mediumtext DEFAULT NULL,
  `photo` blob NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `vin` (`vin`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `cars_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=146 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table car_registration.cars: ~0 rows (approximately)
INSERT INTO `cars` (`id`, `user_id`, `make`, `model`, `year`, `color`, `fuel`, `registration_number`, `vin`, `price`, `description`, `photo`) VALUES
	(145, NULL, 'BMW', 'e39', 1996, 'Black', 'Diesel', 'NR223', 'W131243243REWREWR', '2200', 'Sveiki vēlētos samainīt savu E39 pret kādu citu RWD auto.\\r\\nRūsa kā jau 39 nedaudz uz bagāžnieka, Sliekšņi ideālā stāvoklī. Jaunas ziemas Riepas, Brūns ādas salos, koiloveri. vairāk info privāti.', _binary 0x[BLOB]);

-- Dumping structure for table car_registration.car_photos
CREATE TABLE IF NOT EXISTS `car_photos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `car_id` int(11) NOT NULL,
  `photo_path` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `car_id` (`car_id`),
  CONSTRAINT `car_photos_ibfk_1` FOREIGN KEY (`car_id`) REFERENCES `cars` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table car_registration.car_photos: ~0 rows (approximately)

-- Dumping structure for table car_registration.color
CREATE TABLE IF NOT EXISTS `color` (
  `color_id` int(11) NOT NULL AUTO_INCREMENT,
  `color` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`color_id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table car_registration.color: ~20 rows (approximately)
INSERT INTO `color` (`color_id`, `color`) VALUES
	(1, 'Red'),
	(2, 'Blue'),
	(3, 'Black'),
	(4, 'White'),
	(5, 'Silver'),
	(6, 'Green'),
	(7, 'Yellow'),
	(8, 'Orange'),
	(9, 'Purple'),
	(10, 'Pink'),
	(11, 'Brown'),
	(12, 'Gray'),
	(13, 'Gold'),
	(14, 'Cyan'),
	(15, 'Magenta'),
	(16, 'Lime'),
	(17, 'Maroon'),
	(18, 'Navy'),
	(19, 'Olive'),
	(20, 'Teal');

-- Dumping structure for table car_registration.make_brand
CREATE TABLE IF NOT EXISTS `make_brand` (
  `make_id` int(11) NOT NULL AUTO_INCREMENT,
  `make` varchar(70) DEFAULT NULL,
  PRIMARY KEY (`make_id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table car_registration.make_brand: ~18 rows (approximately)
INSERT INTO `make_brand` (`make_id`, `make`) VALUES
	(1, 'Toyota'),
	(2, 'Ford'),
	(3, 'Honda'),
	(4, 'Chevrolet'),
	(5, 'BMW'),
	(6, 'Volvo'),
	(7, 'Mazda'),
	(8, 'Cupra'),
	(9, 'Audi'),
	(10, 'Mercedes-Benz'),
	(11, 'Nissan'),
	(12, 'Hyundai'),
	(13, 'Kia'),
	(14, 'Volkswagen'),
	(15, 'Subaru'),
	(16, 'Jaguar'),
	(17, 'Porsche'),
	(18, 'Saab');

