File: /home/dmstechonline/whatsapp.dmstech.online/backup-2.7-swiftchats/modules/Webhook/Webhook.sql
INSERT INTO `addons` (`id`, `uuid`, `category`, `name`, `logo`, `description`, `metadata`, `license`, `status`, `created_at`, `updated_at`) VALUES
(12, 'd27e56ba-f881-49d4-8a93-875360176aa2', 'utility', 'Webhooks', 'webhook_icon.png', 'Webhooks enable real-time data transfer by sending automated notifications on specific events.', '{\"input_fields\":[{\"element\":\"toggle\",\"type\":\"checkbox\",\"name\":\"webhook\",\"label\":\"Enable Webhooks\",\"class\":\"col-span-2\"}]}', 'standalone', 1, '2024-11-14 10:57:59', '2024-11-14 10:57:59');
CREATE TABLE `webhooks` (
`id` bigint(20) UNSIGNED NOT NULL,
`uuid` char(50) NOT NULL,
`organization_id` int(11) NOT NULL,
`url` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `webhook_events` (
`id` bigint(20) UNSIGNED NOT NULL,
`webhook_id` bigint(20) UNSIGNED NOT NULL,
`event` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE `webhooks`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `webhooks_organization_id_url_unique` (`organization_id`,`url`),
ADD UNIQUE KEY `webhooks_uuid_unique` (`uuid`);
ALTER TABLE `webhook_events`
ADD PRIMARY KEY (`id`),
ADD KEY `webhook_events_webhook_id_foreign` (`webhook_id`);
ALTER TABLE `webhooks`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `webhook_events`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `webhook_events`
ADD CONSTRAINT `webhook_events_webhook_id_foreign` FOREIGN KEY (`webhook_id`) REFERENCES `webhooks` (`id`) ON DELETE CASCADE;