-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Server version:               10.4.28-MariaDB - mariadb.org binary distribution
-- Server OS:                    Win64
-- HeidiSQL Version:             12.13.0.7147
-- --------------------------------------------------------

/*!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 animals_db
DROP DATABASE IF EXISTS `animals_db`;
CREATE DATABASE IF NOT EXISTS `animals_db` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;
USE `animals_db`;

-- Dumping structure for table animals_db.animal
DROP TABLE IF EXISTS `animal`;
CREATE TABLE IF NOT EXISTS `animal` (
  `animal_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  `breed_id` int(10) unsigned NOT NULL,
  `weight` decimal(4,1) unsigned NOT NULL,
  `age` int(10) unsigned NOT NULL,
  `gender` enum('m','f') NOT NULL,
  PRIMARY KEY (`animal_id`),
  KEY `fk_animal_breed_id` (`breed_id`),
  CONSTRAINT `fk_animal_breed_id` FOREIGN KEY (`breed_id`) REFERENCES `breed` (`breed_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table animals_db.animal: ~5 rows (approximately)
INSERT INTO `animal` (`animal_id`, `name`, `breed_id`, `weight`, `age`, `gender`) VALUES
	(1, 'Eko', 1, 23.4, 96, 'm'),
	(2, 'Kitty', 2, 3.3, 50, 'f'),
	(3, 'Veljko', 3, 16.1, 32, 'm'),
	(4, 'Dog2', 4, 30.0, 80, 'f'),
	(5, 'Cat2', 5, 4.7, 21, 'm');

-- Dumping structure for table animals_db.breed
DROP TABLE IF EXISTS `breed`;
CREATE TABLE IF NOT EXISTS `breed` (
  `breed_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `species_id` int(10) unsigned NOT NULL,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`breed_id`),
  UNIQUE KEY `uq_breed_name` (`name`),
  KEY `fk_breed_species_id` (`species_id`),
  CONSTRAINT `fk_breed_species_id` FOREIGN KEY (`species_id`) REFERENCES `species` (`species_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table animals_db.breed: ~5 rows (approximately)
INSERT INTO `breed` (`breed_id`, `species_id`, `name`) VALUES
	(1, 1, 'Husky'),
	(2, 2, 'Russian'),
	(3, 2, 'Common shorthair'),
	(4, 1, 'Golden Retriever'),
	(5, 1, 'Persian');

-- Dumping structure for table animals_db.species
DROP TABLE IF EXISTS `species`;
CREATE TABLE IF NOT EXISTS `species` (
  `species_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`species_id`),
  UNIQUE KEY `uq_species_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=334 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table animals_db.species: ~2 rows (approximately)
INSERT INTO `species` (`species_id`, `name`) VALUES
	(1, 'Canis lupus familiaris'),
	(2, 'Felis catus');

-- Dumping structure for table animals_db.vaccination
DROP TABLE IF EXISTS `vaccination`;
CREATE TABLE IF NOT EXISTS `vaccination` (
  `vaccination_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `animal_id` int(10) unsigned NOT NULL,
  `vaccinated_at` date NOT NULL,
  `vaccine` varchar(50) NOT NULL,
  PRIMARY KEY (`vaccination_id`),
  KEY `fk_vaccination_animal_id` (`animal_id`),
  CONSTRAINT `fk_vaccination_animal_id` FOREIGN KEY (`animal_id`) REFERENCES `animal` (`animal_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table animals_db.vaccination: ~1 rows (approximately)
INSERT INTO `vaccination` (`vaccination_id`, `animal_id`, `vaccinated_at`, `vaccine`) VALUES
	(1, 1, '2025-11-21', 'Some vaccine..');

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