-- --------------------------------------------------------
-- Server OS:                    Win64
-- HeidiSQL Version:             12.1.0.6537
-- --------------------------------------------------------



-- Dumping database structure for mong7876_rocha
CREATE DATABASE IF NOT EXISTS `mong7876_rocha` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `mong7876_rocha`;

-- Dumping structure for table mong7876_rocha.stores
CREATE TABLE IF NOT EXISTS `stores` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `logo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `stores_slug_unique` (`slug`),
  KEY `stores_user_id_foreign` (`user_id`),
  CONSTRAINT `stores_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.stores
REPLACE INTO `stores` (`id`, `user_id`, `name`, `slug`, `phone`, `logo`, `description`, `created_at`, `updated_at`) VALUES
	(1, 1, 'Toko Dwi Star Muda', 'toko-1', '08123456789', NULL, NULL, '2026-03-28 14:06:47', '2026-03-28 14:06:47');

-- Dumping structure for table mong7876_rocha.whatsapp_contacts
CREATE TABLE IF NOT EXISTS `whatsapp_contacts` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` text COLLATE utf8mb4_unicode_ci,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `whatsapp_contacts_phone_unique` (`phone`),
  KEY `whatsapp_contacts_user_id_foreign` (`user_id`),
  CONSTRAINT `whatsapp_contacts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.whatsapp_contacts
REPLACE INTO `whatsapp_contacts` (`id`, `user_id`, `name`, `phone`, `email`, `address`, `notes`, `created_at`, `updated_at`) VALUES
	(1, 1, 'Abangdsm', '6281264643110', NULL, NULL, NULL, '2026-03-28 14:30:13', '2026-03-28 14:32:36'),
	(2, 1, 'Wa Three', '6289531717717', NULL, NULL, NULL, '2026-03-28 15:14:32', '2026-03-28 15:14:32');

-- Dumping structure for table mong7876_rocha.whatsapp_groups
CREATE TABLE IF NOT EXISTS `whatsapp_groups` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `whatsapp_groups_user_id_foreign` (`user_id`),
  CONSTRAINT `whatsapp_groups_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.whatsapp_groups
REPLACE INTO `whatsapp_groups` (`id`, `user_id`, `name`, `description`, `created_at`, `updated_at`) VALUES
	(1, 1, 'Testing', 'Penguji Rocha Beta Version', '2026-03-28 14:41:45', '2026-03-28 14:43:08');

-- Dumping structure for table mong7876_rocha.whatsapp_tags
CREATE TABLE IF NOT EXISTS `whatsapp_tags` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#3B82F6',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `whatsapp_tags_user_id_foreign` (`user_id`),
  CONSTRAINT `whatsapp_tags_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.whatsapp_tags
REPLACE INTO `whatsapp_tags` (`id`, `user_id`, `name`, `color`, `created_at`, `updated_at`) VALUES
	(1, 1, 'Internal', '#f93434', '2026-03-28 14:42:00', '2026-03-28 14:43:15');

-- =====================================================
-- LEVEL 2: TABLES WITH FOREIGN KEYS TO LEVEL 1
-- =====================================================

-- Dumping structure for table mong7876_rocha.devices
CREATE TABLE IF NOT EXISTS `devices` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `store_id` bigint unsigned NOT NULL,
  `device_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'disconnected',
  `last_connected_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `devices_device_id_unique` (`device_id`),
  KEY `devices_user_id_foreign` (`user_id`),
  KEY `devices_store_id_foreign` (`store_id`),
  CONSTRAINT `devices_store_id_foreign` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE,
  CONSTRAINT `devices_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.devices
REPLACE INTO `devices` (`id`, `user_id`, `store_id`, `device_id`, `phone_number`, `status`, `last_connected_at`, `created_at`, `updated_at`) VALUES
	(1, 1, 1, 'poco', '6283837745971', 'connected', '2026-03-28 15:16:08', '2026-03-28 15:15:44', '2026-03-28 15:16:08');

-- Dumping structure for table mong7876_rocha.messages
CREATE TABLE IF NOT EXISTS `messages` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `device_id` bigint unsigned NOT NULL,
  `to_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'text',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `whatsapp_message_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sent_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `messages_user_id_foreign` (`user_id`),
  KEY `messages_device_id_foreign` (`device_id`),
  CONSTRAINT `messages_device_id_foreign` FOREIGN KEY (`device_id`) REFERENCES `devices` (`id`) ON DELETE CASCADE,
  CONSTRAINT `messages_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.messages (~0 rows)

-- Dumping structure for table mong7876_rocha.contact_whatsapp_group
CREATE TABLE IF NOT EXISTS `contact_whatsapp_group` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `contact_id` bigint unsigned NOT NULL,
  `group_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contact_whatsapp_group_contact_id_foreign` (`contact_id`),
  KEY `contact_whatsapp_group_group_id_foreign` (`group_id`),
  CONSTRAINT `contact_whatsapp_group_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `whatsapp_contacts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `contact_whatsapp_group_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `whatsapp_groups` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.contact_whatsapp_group
REPLACE INTO `contact_whatsapp_group` (`id`, `contact_id`, `group_id`, `created_at`, `updated_at`) VALUES
	(1, 1, 1, NULL, NULL),
	(2, 2, 1, NULL, NULL);

-- Dumping structure for table mong7876_rocha.contact_whatsapp_tag
CREATE TABLE IF NOT EXISTS `contact_whatsapp_tag` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `contact_id` bigint unsigned NOT NULL,
  `tag_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contact_whatsapp_tag_contact_id_foreign` (`contact_id`),
  KEY `contact_whatsapp_tag_tag_id_foreign` (`tag_id`),
  CONSTRAINT `contact_whatsapp_tag_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `whatsapp_contacts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `contact_whatsapp_tag_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `whatsapp_tags` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.contact_whatsapp_tag
REPLACE INTO `contact_whatsapp_tag` (`id`, `contact_id`, `tag_id`, `created_at`, `updated_at`) VALUES
	(1, 2, 1, NULL, NULL),
	(2, 1, 1, NULL, NULL);

-- =====================================================
-- LEVEL 3: TABLES DEPENDING ON DEVICES
-- =====================================================

-- Dumping structure for table mong7876_rocha.broadcasts
CREATE TABLE IF NOT EXISTS `broadcasts` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `device_id` bigint unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'text',
  `media_path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `total_contacts` int NOT NULL DEFAULT '0',
  `sent_count` int NOT NULL DEFAULT '0',
  `failed_count` int NOT NULL DEFAULT '0',
  `scheduled_at` timestamp NULL DEFAULT NULL,
  `started_at` timestamp NULL DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `broadcasts_user_id_foreign` (`user_id`),
  KEY `broadcasts_device_id_foreign` (`device_id`),
  CONSTRAINT `broadcasts_device_id_foreign` FOREIGN KEY (`device_id`) REFERENCES `devices` (`id`) ON DELETE CASCADE,
  CONSTRAINT `broadcasts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.broadcasts
REPLACE INTO `broadcasts` (`id`, `user_id`, `device_id`, `name`, `message`, `type`, `media_path`, `status`, `total_contacts`, `sent_count`, `failed_count`, `scheduled_at`, `started_at`, `completed_at`, `created_at`, `updated_at`) VALUES
	(1, 1, 1, 'Testing Broadcast', 'Ini adalah pesan yang dikirimkan melalui fitur broadcast rocha-12.', 'text', NULL, 'completed', 2, 2, 0, NULL, '2026-03-28 15:17:40', '2026-03-28 15:17:42', '2026-03-28 15:17:40', '2026-03-28 15:17:42');

-- Dumping structure for table mong7876_rocha.broadcast_contacts
CREATE TABLE IF NOT EXISTS `broadcast_contacts` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `broadcast_id` bigint unsigned NOT NULL,
  `contact_id` bigint unsigned NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `error` text COLLATE utf8mb4_unicode_ci,
  `sent_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `broadcast_contacts_broadcast_id_foreign` (`broadcast_id`),
  KEY `broadcast_contacts_contact_id_foreign` (`contact_id`),
  CONSTRAINT `broadcast_contacts_broadcast_id_foreign` FOREIGN KEY (`broadcast_id`) REFERENCES `broadcasts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `broadcast_contacts_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `whatsapp_contacts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.broadcast_contacts
REPLACE INTO `broadcast_contacts` (`id`, `broadcast_id`, `contact_id`, `status`, `error`, `sent_at`, `created_at`, `updated_at`) VALUES
	(1, 1, 1, 'sent', NULL, '2026-03-28 15:17:41', '2026-03-28 15:17:40', '2026-03-28 15:17:41'),
	(2, 1, 2, 'sent', NULL, '2026-03-28 15:17:42', '2026-03-28 15:17:40', '2026-03-28 15:17:42');

-- Dumping data for table mong7876_rocha.cache_locks (~0 rows)

-- Dumping structure for table mong7876_rocha.failed_jobs
CREATE TABLE IF NOT EXISTS `failed_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.failed_jobs (~0 rows)

-- Dumping structure for table mong7876_rocha.jobs
CREATE TABLE IF NOT EXISTS `jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `attempts` tinyint unsigned NOT NULL,
  `reserved_at` int unsigned DEFAULT NULL,
  `available_at` int unsigned NOT NULL,
  `created_at` int unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.jobs (~0 rows)

-- Dumping structure for table mong7876_rocha.job_batches
CREATE TABLE IF NOT EXISTS `job_batches` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_jobs` int NOT NULL,
  `pending_jobs` int NOT NULL,
  `failed_jobs` int NOT NULL,
  `failed_job_ids` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `options` mediumtext COLLATE utf8mb4_unicode_ci,
  `cancelled_at` int DEFAULT NULL,
  `created_at` int NOT NULL,
  `finished_at` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.job_batches (~0 rows)

-- Dumping structure for table mong7876_rocha.migrations
CREATE TABLE IF NOT EXISTS `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.migrations
REPLACE INTO `migrations` (`id`, `migration`, `batch`) VALUES
	(1, '0001_01_01_000000_create_users_table', 1),
	(9, '2026_03_28_205559_create_contacts_table', 4),
	(11, '0001_01_01_000001_create_cache_table', 5),
	(12, '0001_01_01_000002_create_jobs_table', 5),
	(13, '2026_03_28_131156_add_phone_and_store_name_to_users_table', 5),
	(14, '2026_03_28_131204_create_stores_table', 5),
	(15, '2026_03_28_131210_create_devices_table', 5),
	(16, '2026_03_28_131218_create_messages_table', 5),
	(17, '2026_03_28_194238_add_default_store_to_users_table', 5),
	(18, '2026_03_28_210431_create_whatsapp_contacts_table', 5),
	(19, '2026_03_28_210431_create_whatsapp_groups_table', 5),
	(20, '2026_03_28_210432_create_whatsapp_tags_table', 5),
	(21, '2026_03_28_210433_create_contact_whatsapp_group_table', 5),
	(23, '2026_03_28_210434_create_contact_whatsapp_tag_table', 6),
	(24, '2026_03_28_214557_create_broadcasts_table', 7),
	(25, '2026_03_28_214559_create_broadcast_contacts_table', 7);

-- Dumping data for table mong7876_rocha.password_reset_tokens (~0 rows)

-- Dumping structure for table mong7876_rocha.sessions
CREATE TABLE IF NOT EXISTS `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_activity` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.sessions
REPLACE INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
	('WukOHbwxxcW7neG1gZr3ivhNkYvu2DF8JGttxTOi', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiZDRkcGRtVUJkUVRTRnU3cUJUejhRZ2FNOGd6TjRoZTRyODFLdUg0TCI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MjY6Imh0dHA6Ly9yb2NoYS0xMi50ZXN0L2xvZ2luIjtzOjU6InJvdXRlIjtzOjU6ImxvZ2luIjt9fQ==', 1774736505);

-- =====================================================
-- OLD CONTACTS TABLE (NOT USED, KEPT FOR COMPATIBILITY)
-- =====================================================

-- Dumping structure for table mong7876_rocha.contacts
CREATE TABLE IF NOT EXISTS `contacts` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` text COLLATE utf8mb4_unicode_ci,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `contacts_phone_unique` (`phone`),
  KEY `contacts_user_id_foreign` (`user_id`),
  CONSTRAINT `contacts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.contacts (~0 rows)

-- Dumping structure for table mong7876_rocha.contact_group
CREATE TABLE IF NOT EXISTS `contact_group` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `contact_id` bigint unsigned NOT NULL,
  `group_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contact_group_contact_id_foreign` (`contact_id`),
  CONSTRAINT `contact_group_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table mong7876_rocha.contact_group (~0 rows)

