-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `album`
--

-- --------------------------------------------------------

--
-- Table structure for table `admin_alerts`
--

CREATE TABLE `admin_alerts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(160) NOT NULL,
  `body` text DEFAULT NULL,
  `type` varchar(40) NOT NULL DEFAULT 'system',
  `severity` varchar(20) NOT NULL DEFAULT 'info',
  `family_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `read_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `albums`
--

CREATE TABLE `albums` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `privacy` enum('family','private','shared') NOT NULL DEFAULT 'family',
  `type` enum('standard','event','year_in_review') NOT NULL DEFAULT 'standard',
  `cover_path` varchar(255) DEFAULT NULL,
  `likes_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `photos_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `videos_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `category` varchar(255) NOT NULL DEFAULT 'general'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `albums`
--

INSERT INTO `albums` (`id`, `user_id`, `name`, `description`, `privacy`, `type`, `cover_path`, `likes_count`, `photos_count`, `videos_count`, `created_at`, `updated_at`, `category`) VALUES
(1, 2, 'New ALbum', NULL, 'family', 'standard', 'slabum/albums/1/YlfCBlZ9oVG73xI0CxazhF27iBcTv9vevDKLDRxJ.jpg', 0, 1, 0, '2025-08-29 20:35:17', '2025-08-29 20:35:41', 'general');

-- --------------------------------------------------------

--
-- Table structure for table `events`
--

CREATE TABLE `events` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `type` enum('birthday','vacation','holiday','anniversary','other') NOT NULL DEFAULT 'other',
  `description` text DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `start_at` datetime NOT NULL,
  `end_at` datetime DEFAULT NULL,
  `is_all_day` tinyint(1) NOT NULL DEFAULT 0,
  `attendees` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `has_album` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `family_groups`
--

CREATE TABLE `family_groups` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `owner_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `privacy` enum('private','family','public') NOT NULL DEFAULT 'private',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `family_groups`
--

INSERT INTO `family_groups` (`id`, `owner_id`, `name`, `description`, `privacy`, `created_at`, `updated_at`) VALUES
(1, 2, 'My group', NULL, 'private', '2025-08-29 20:37:17', '2025-08-29 20:37:17');

-- --------------------------------------------------------

--
-- Table structure for table `family_members`
--

CREATE TABLE `family_members` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `family_group_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `role` enum('admin','member') NOT NULL DEFAULT 'member',
  `relationship` enum('spouse','child','parent','sibling','grandparent','grandchild','aunt_uncle','cousin','other') NOT NULL DEFAULT 'other',
  `presence` enum('online','away','offline') NOT NULL DEFAULT 'offline',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `family_members`
--

INSERT INTO `family_members` (`id`, `family_group_id`, `user_id`, `role`, `relationship`, `presence`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 'admin', 'other', 'online', '2025-08-29 20:37:17', '2025-08-29 20:37:17');

-- --------------------------------------------------------

--
-- Table structure for table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `media`
--

CREATE TABLE `media` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `album_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('photo','video') NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `caption` text DEFAULT NULL,
  `comments_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `path` varchar(255) NOT NULL,
  `thumb_path` varchar(255) DEFAULT NULL,
  `size_bytes` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `likes_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `is_favorite` tinyint(1) NOT NULL DEFAULT 0,
  `captured_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `media`
--

INSERT INTO `media` (`id`, `album_id`, `user_id`, `type`, `title`, `caption`, `comments_count`, `path`, `thumb_path`, `size_bytes`, `likes_count`, `is_favorite`, `captured_at`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 'photo', 'first image', '', 0, 'slabum/albums/1/YlfCBlZ9oVG73xI0CxazhF27iBcTv9vevDKLDRxJ.jpg', 'slabum/albums/1/YlfCBlZ9oVG73xI0CxazhF27iBcTv9vevDKLDRxJ.jpg', 289414, 0, 0, '2025-08-30 02:39:00', '2025-08-29 20:35:41', '2025-08-29 20:35:41');

-- --------------------------------------------------------

--
-- Table structure for table `media_comments`
--

CREATE TABLE `media_comments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `media_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `content` text NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `media_favorites`
--

CREATE TABLE `media_favorites` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `media_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `media_likes`
--

CREATE TABLE `media_likes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `media_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `memories`
--

CREATE TABLE `memories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('photo','video','event') NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `occurred_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `media` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`media`)),
  `likes` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `comments` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `shares` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `author_name` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `metric_dailies`
--

CREATE TABLE `metric_dailies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `day` date NOT NULL,
  `new_users` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `active_users` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `photos_uploaded` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `videos_uploaded` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `new_albums` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `active_families` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `families_small` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `families_medium` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `families_large` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `activity_high` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `activity_medium` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `activity_low` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `activity_inactive` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `storage_used_bytes` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(19, '0001_01_01_000000_create_users_table', 1),
(20, '0001_01_01_000001_create_cache_table', 1),
(21, '0001_01_01_000002_create_jobs_table', 1),
(22, '2025_08_22_174003_create_albums_table', 1),
(23, '2025_08_22_182731_create_media_table', 1),
(24, '2025_08_22_185129_create_events_table', 1),
(25, '2025_08_22_190424_create_family_groups_table', 1),
(26, '2025_08_22_190506_create_family_members_table', 1),
(27, '2025_08_22_190551_create_invitations_table', 1),
(28, '2025_08_22_190635_create_album_shares_table', 1),
(29, '2025_08_22_192256_create_memories_table', 1),
(30, '2025_08_22_192913_create_user_activities_table', 1),
(31, '2025_08_22_201758_create_admin_alerts_table', 1),
(32, '2025_08_22_205353_create_plans_table', 1),
(33, '2025_08_22_205434_create_subscriptions_table', 1),
(34, '2025_08_22_205521_create_payment_settings_table', 1),
(35, '2025_08_22_210806_create_metric_dailies_table', 1),
(36, '2025_08_22_215029_create_subscription_orders_table', 1),
(37, '2025_08_28_222659_create_media_likes_table', 1),
(38, '2025_08_28_222846_create_media_comments_table', 1),
(39, '2025_08_28_222944_create_media_favorites_table', 1);

-- --------------------------------------------------------

--
-- Table structure for table `plans`
--

CREATE TABLE `plans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `price_cents` int(10) UNSIGNED NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'USD',
  `interval` enum('month','year') NOT NULL DEFAULT 'month',
  `trial_days` smallint(5) UNSIGNED NOT NULL DEFAULT 14,
  `features` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`features`)),
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `storage_gb` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `member_limit` int(10) UNSIGNED DEFAULT NULL,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `plans`
--

INSERT INTO `plans` (`id`, `name`, `code`, `price_cents`, `currency`, `interval`, `trial_days`, `features`, `is_active`, `storage_gb`, `member_limit`, `is_featured`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, 'Free', 'free', 0, 'USD', 'month', 14, '\"[\\\"Up to 5 family members\\\",\\\"1GB storage\\\",\\\"Basic photo sharing\\\",\\\"Mobile app access\\\"]\"', 1, 1, 5, 0, 1, '2025-08-29 20:27:37', '2025-08-29 20:27:37'),
(2, 'Premium', 'premium', 900, 'USD', 'month', 14, '\"[\\\"Unlimited family members\\\",\\\"50GB storage\\\",\\\"Video uploads & sharing\\\",\\\"Event management\\\",\\\"Timeline features\\\",\\\"Priority support\\\"]\"', 1, 50, NULL, 1, 2, '2025-08-29 20:27:37', '2025-08-29 20:27:37'),
(3, 'Family', 'family', 1900, 'USD', 'month', 14, '\"[\\\"Everything in Premium\\\",\\\"200GB storage\\\",\\\"Multiple family groups\\\",\\\"Advanced privacy controls\\\",\\\"Custom branding\\\",\\\"24\\\\\\/7 support\\\"]\"', 1, 200, NULL, 0, 3, '2025-08-29 20:27:37', '2025-08-29 20:27:37');

-- --------------------------------------------------------

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('RiTSSHu9e2BSUbSztCB1bwhqzhbGTcJW4mvX0Egt', 2, '42.0.4.196', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiZllHMU03empZUnNWQmZiTWVOOHJscDVTS1dHS3piODFwa1FIU2R0TyI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NTY6Imh0dHA6Ly8xNjQuMTMyLjE1MS4xODcvYWxidW0vcHVibGljL3BvcnRhbC9hbGJ1bXM/dXNlcj0yIjt9czo1MDoibG9naW5fd2ViXzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO2k6Mjt9', 1756521508);

-- --------------------------------------------------------

--
-- Table structure for table `subscriptions`
--

CREATE TABLE `subscriptions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `plan_id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('trial','active','expired','cancelled') NOT NULL DEFAULT 'trial',
  `trial_ends_at` datetime DEFAULT NULL,
  `starts_at` datetime DEFAULT NULL,
  `next_billing_at` datetime DEFAULT NULL,
  `ends_at` datetime DEFAULT NULL,
  `gateway` varchar(255) DEFAULT NULL,
  `gateway_subscription_id` varchar(255) DEFAULT NULL,
  `payment_brand` varchar(255) DEFAULT NULL,
  `payment_last4` varchar(4) DEFAULT NULL,
  `amount_cents` int(10) UNSIGNED NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'USD',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `subscription_orders`
--

CREATE TABLE `subscription_orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `plan_id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('pending','paid','approved','failed','rejected','refunded') NOT NULL DEFAULT 'pending',
  `amount_cents` int(10) UNSIGNED NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'USD',
  `payment_method` varchar(255) DEFAULT NULL,
  `payment_reference` varchar(255) DEFAULT NULL,
  `paid_at` timestamp NULL DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `meta` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`meta`)),
  `gateway` varchar(255) DEFAULT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `subscription_orders`
--

INSERT INTO `subscription_orders` (`id`, `user_id`, `plan_id`, `status`, `amount_cents`, `currency`, `payment_method`, `payment_reference`, `paid_at`, `approved_at`, `approved_by`, `meta`, `gateway`, `reference`, `created_at`, `updated_at`) VALUES
(1, 2, 2, 'pending', 900, 'USD', NULL, NULL, NULL, NULL, NULL, '{\"billing\":\"monthly\",\"interval\":\"month\",\"yearly_discount_percent\":20,\"monthly_list_price_cents\":900}', NULL, 'INV-20250830-VKTDVQ', '2025-08-29 20:34:43', '2025-08-29 20:34:43'),
(2, 2, 1, 'pending', 0, 'USD', NULL, NULL, NULL, NULL, NULL, '{\"billing\":\"monthly\",\"interval\":\"month\",\"yearly_discount_percent\":20,\"monthly_list_price_cents\":0}', NULL, 'INV-20250830-OMB92P', '2025-08-29 20:34:53', '2025-08-29 20:34:53');

-- --------------------------------------------------------

--
-- Table structure for table `user_activities`
--

CREATE TABLE `user_activities` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `icon` varchar(255) DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `context` varchar(255) DEFAULT NULL,
  `meta` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`meta`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_activities`
--

INSERT INTO `user_activities` (`id`, `user_id`, `icon`, `title`, `context`, `meta`, `created_at`, `updated_at`) VALUES
(1, 2, 'album', 'Created a new album', 'New ALbum', '{\"album_id\":1,\"album_name\":\"New ALbum\",\"cover\":null}', '2025-08-29 20:35:17', '2025-08-29 20:35:17'),
(2, 2, 'camera', 'Shared a photo', NULL, '{\"album_id\":1,\"media_id\":1,\"type\":\"photo\",\"path\":\"slabum\\/albums\\/1\\/YlfCBlZ9oVG73xI0CxazhF27iBcTv9vevDKLDRxJ.jpg\",\"thumb\":\"slabum\\/albums\\/1\\/YlfCBlZ9oVG73xI0CxazhF27iBcTv9vevDKLDRxJ.jpg\"}', '2025-08-29 20:35:41', '2025-08-29 20:35:41'),
(3, 2, 'camera', 'Uploaded 1 photo', 'New ALbum', '{\"album_id\":1,\"count\":1}', '2025-08-29 20:35:41', '2025-08-29 20:35:41');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin_alerts`
--
ALTER TABLE `admin_alerts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `admin_alerts_created_at_index` (`created_at`),
  ADD KEY `admin_alerts_type_index` (`type`),
  ADD KEY `admin_alerts_severity_index` (`severity`),
  ADD KEY `admin_alerts_family_id_index` (`family_id`),
  ADD KEY `admin_alerts_user_id_index` (`user_id`),
  ADD KEY `admin_alerts_read_at_index` (`read_at`);

--
-- Indexes for table `albums`
--
ALTER TABLE `albums`
  ADD PRIMARY KEY (`id`),
  ADD KEY `albums_created_at_type_index` (`created_at`,`type`),
  ADD KEY `albums_category_created_at_index` (`category`,`created_at`),
  ADD KEY `albums_user_id_index` (`user_id`);

--
-- Indexes for table `events`
--
ALTER TABLE `events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `events_user_id_foreign` (`user_id`),
  ADD KEY `events_start_at_type_index` (`start_at`,`type`);

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `family_groups`
--
ALTER TABLE `family_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `family_groups_owner_id_foreign` (`owner_id`);

--
-- Indexes for table `family_members`
--
ALTER TABLE `family_members`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `family_members_family_group_id_user_id_unique` (`family_group_id`,`user_id`),
  ADD KEY `family_members_user_id_foreign` (`user_id`),
  ADD KEY `family_members_family_group_id_user_id_index` (`family_group_id`,`user_id`);

--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Indexes for table `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `media`
--
ALTER TABLE `media`
  ADD PRIMARY KEY (`id`),
  ADD KEY `media_album_id_foreign` (`album_id`),
  ADD KEY `media_user_id_foreign` (`user_id`),
  ADD KEY `media_created_at_user_id_index` (`created_at`,`user_id`),
  ADD KEY `media_type_index` (`type`);

--
-- Indexes for table `media_comments`
--
ALTER TABLE `media_comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `media_comments_user_id_foreign` (`user_id`),
  ADD KEY `media_comments_media_id_created_at_index` (`media_id`,`created_at`);

--
-- Indexes for table `media_favorites`
--
ALTER TABLE `media_favorites`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `media_favorites_media_id_user_id_unique` (`media_id`,`user_id`),
  ADD KEY `media_favorites_user_id_foreign` (`user_id`);

--
-- Indexes for table `media_likes`
--
ALTER TABLE `media_likes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `media_likes_media_id_user_id_unique` (`media_id`,`user_id`),
  ADD KEY `media_likes_user_id_foreign` (`user_id`);

--
-- Indexes for table `memories`
--
ALTER TABLE `memories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `memories_user_id_foreign` (`user_id`),
  ADD KEY `memories_type_index` (`type`),
  ADD KEY `memories_occurred_at_index` (`occurred_at`);

--
-- Indexes for table `metric_dailies`
--
ALTER TABLE `metric_dailies`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `metric_dailies_day_unique` (`day`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `plans`
--
ALTER TABLE `plans`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `plans_code_unique` (`code`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indexes for table `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subscriptions_user_id_foreign` (`user_id`),
  ADD KEY `subscriptions_plan_id_foreign` (`plan_id`),
  ADD KEY `subscriptions_status_next_billing_at_index` (`status`,`next_billing_at`);

--
-- Indexes for table `subscription_orders`
--
ALTER TABLE `subscription_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `subscription_orders_reference_unique` (`reference`),
  ADD KEY `subscription_orders_user_id_foreign` (`user_id`),
  ADD KEY `subscription_orders_plan_id_foreign` (`plan_id`),
  ADD KEY `subscription_orders_approved_by_foreign` (`approved_by`),
  ADD KEY `subscription_orders_status_paid_at_index` (`status`,`paid_at`);

--
-- Indexes for table `user_activities`
--
ALTER TABLE `user_activities`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_activities_user_id_created_at_index` (`user_id`,`created_at`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admin_alerts`
--
ALTER TABLE `admin_alerts`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `albums`
--
ALTER TABLE `albums`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `events`
--
ALTER TABLE `events`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `family_groups`
--
ALTER TABLE `family_groups`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `family_members`
--
ALTER TABLE `family_members`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `media`
--
ALTER TABLE `media`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `media_comments`
--
ALTER TABLE `media_comments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `media_favorites`
--
ALTER TABLE `media_favorites`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `media_likes`
--
ALTER TABLE `media_likes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `memories`
--
ALTER TABLE `memories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `metric_dailies`
--
ALTER TABLE `metric_dailies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40;

--
-- AUTO_INCREMENT for table `plans`
--
ALTER TABLE `plans`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `subscriptions`
--
ALTER TABLE `subscriptions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `subscription_orders`
--
ALTER TABLE `subscription_orders`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `user_activities`
--
ALTER TABLE `user_activities`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `albums`
--
ALTER TABLE `albums`
  ADD CONSTRAINT `albums_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `events`
--
ALTER TABLE `events`
  ADD CONSTRAINT `events_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `family_groups`
--
ALTER TABLE `family_groups`
  ADD CONSTRAINT `family_groups_owner_id_foreign` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `family_members`
--
ALTER TABLE `family_members`
  ADD CONSTRAINT `family_members_family_group_id_foreign` FOREIGN KEY (`family_group_id`) REFERENCES `family_groups` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `family_members_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `media`
--
ALTER TABLE `media`
  ADD CONSTRAINT `media_album_id_foreign` FOREIGN KEY (`album_id`) REFERENCES `albums` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `media_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `media_comments`
--
ALTER TABLE `media_comments`
  ADD CONSTRAINT `media_comments_media_id_foreign` FOREIGN KEY (`media_id`) REFERENCES `media` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `media_comments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `media_favorites`
--
ALTER TABLE `media_favorites`
  ADD CONSTRAINT `media_favorites_media_id_foreign` FOREIGN KEY (`media_id`) REFERENCES `media` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `media_favorites_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `media_likes`
--
ALTER TABLE `media_likes`
  ADD CONSTRAINT `media_likes_media_id_foreign` FOREIGN KEY (`media_id`) REFERENCES `media` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `media_likes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `memories`
--
ALTER TABLE `memories`
  ADD CONSTRAINT `memories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD CONSTRAINT `subscriptions_plan_id_foreign` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subscriptions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `subscription_orders`
--
ALTER TABLE `subscription_orders`
  ADD CONSTRAINT `subscription_orders_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `subscription_orders_plan_id_foreign` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subscription_orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_activities`
--
ALTER TABLE `user_activities`
  ADD CONSTRAINT `user_activities_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

