-- --------------------------------------------------------
-- Server OS:                    Win64
-- HeidiSQL Version:             12.11.0.7065
-- --------------------------------------------------------



-- Dumping database structure for portfolio
DROP DATABASE IF EXISTS `portfolio`;
CREATE DATABASE IF NOT EXISTS `portfolio` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;
USE `portfolio`;

-- Dumping structure for table portfolio.favorites
CREATE TABLE IF NOT EXISTS `favorites` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unikāls favorīta ieraksta identifikators',
  `user_id` int(10) unsigned DEFAULT NULL COMMENT 'Lietotāja ID, kas pievienoja favorītus',
  `gallery_item_id` int(10) unsigned DEFAULT NULL COMMENT 'Galerijas vienuma ID, kas tika pievienots favorītiem',
  `created_at` datetime DEFAULT NULL COMMENT 'Kad vienums tika pievienots favorītiem',
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id_gallery_item_id` (`user_id`,`gallery_item_id`),
  KEY `favorites_gallery_item_id_foreign` (`gallery_item_id`),
  CONSTRAINT `favorites_gallery_item_id_foreign` FOREIGN KEY (`gallery_item_id`) REFERENCES `gallery_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `favorites_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Favorītu tabula - savieno lietotājus ar viņu iecienītākajiem mākslas darbiem';

-- Dumping data for table portfolio.favorites: ~6 rows (approximately)
DELETE FROM `favorites`;
INSERT INTO `favorites` (`id`, `user_id`, `gallery_item_id`, `created_at`) VALUES
	(23, 10, 15, '2026-02-03 20:53:10'),
	(24, 11, 15, '2026-02-03 20:54:41'),
	(25, 11, 16, '2026-02-03 20:55:04'),
	(26, 12, 17, '2026-02-03 20:56:28'),
	(27, 12, 16, '2026-02-03 20:56:29'),
	(28, 12, 15, '2026-02-03 20:56:30'),
	(29, 10, 20, '2026-02-03 21:02:15'),
	(30, 10, 19, '2026-02-03 21:02:16'),
	(31, 10, 18, '2026-02-03 21:02:17');

-- Dumping structure for table portfolio.gallery_items
CREATE TABLE IF NOT EXISTS `gallery_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unikāls galerijas vienuma identifikators',
  `user_id` int(10) unsigned DEFAULT NULL COMMENT 'Lietotāja ID, kas izveidoja šo mākslas darbu',
  `title` varchar(255) DEFAULT NULL COMMENT 'Mākslas darba nosaukums',
  `description` text DEFAULT NULL COMMENT 'Mākslas darba apraksts',
  `image_path` varchar(255) DEFAULT NULL COMMENT 'Ceļš uz augšupielādēto attēla failu',
  `created_at` datetime DEFAULT NULL COMMENT 'Augšupielādes datums un laiks',
  `updated_at` datetime DEFAULT NULL COMMENT 'Pēdējās rediģēšanas datums un laiks',
  PRIMARY KEY (`id`),
  KEY `gallery_items_ibfk_1` (`user_id`),
  CONSTRAINT `gallery_items_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Galerijas vienumu tabula - satur visus lietotāju augšupielādētos mākslas darbus';

-- Dumping data for table portfolio.gallery_items: ~3 rows (approximately)
DELETE FROM `gallery_items`;
INSERT INTO `gallery_items` (`id`, `user_id`, `title`, `description`, `image_path`, `created_at`, `updated_at`) VALUES
	(15, 10, 'first post', 'my first post', 'uploads/1770151885_c0eab18a88b585c48979.webp', '2026-02-03 20:51:25', '2026-02-03 20:51:25'),
	(16, 11, 'AE86', ':)', 'uploads/1770152099_9ba12addf6b29d3de549.jpg', '2026-02-03 20:54:59', '2026-02-03 20:55:15'),
	(17, 12, 'Tren Twins', 'our progress photo', 'uploads/1770152185_f732591de55fbeb324fd.jpg', '2026-02-03 20:56:25', '2026-02-03 20:56:25'),
	(18, 12, 'Tokyo ghoul', 'traditional art', 'uploads/1770152312_fda8e1a4a60738cada2d.jpg', '2026-02-03 20:58:32', '2026-02-03 20:58:32'),
	(19, 10, 'Muhammad Al-Hazad', 'first of many id photos i made', 'uploads/1770152440_27fe876ceed87b65431e.png', '2026-02-03 21:00:40', '2026-02-03 21:00:40'),
	(20, 10, 'Emils', 'War council member', 'uploads/1770152528_dcab2a1e0a5f494ddbab.png', '2026-02-03 21:02:08', '2026-02-03 21:02:08');

-- Dumping structure for table portfolio.migrations
CREATE TABLE IF NOT EXISTS `migrations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `version` varchar(255) NOT NULL,
  `class` varchar(255) NOT NULL,
  `group` varchar(255) NOT NULL,
  `namespace` varchar(255) NOT NULL,
  `time` int(11) NOT NULL,
  `batch` int(11) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table portfolio.migrations: ~7 rows (approximately)
DELETE FROM `migrations`;
INSERT INTO `migrations` (`id`, `version`, `class`, `group`, `namespace`, `time`, `batch`) VALUES
	(1, '2026-01-26-175731', 'App\\Database\\Migrations\\Users', 'default', 'App', 1769450327, 1),
	(2, '2026-01-27-000001', 'App\\Database\\Migrations\\CreateGalleryTable', 'default', 'App', 1769604849, 2),
	(3, '2026-01-29-231948', 'App\\Database\\Migrations\\AddProfilePictureToUsers', 'default', 'App', 1769728852, 3),
	(4, '2026-01-30-205613', 'App\\Database\\Migrations\\CreateFavoritesTable', 'default', 'App', 1769806604, 4),
	(5, '2026-01-31-000000', 'App\\Database\\Migrations\\AddDatabaseComments', 'default', 'App', 1769812719, 5),
	(6, '2026-02-03-202946', 'App\\Database\\Migrations\\ChangeFirstnameLastnameToUsername', 'default', 'App', 1770150720, 6),
	(7, '2026-02-03-204850', 'App\\Database\\Migrations\\FixPasswordColumnLength', 'default', 'App', 1770151748, 7);

