From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.149]) by gnuweeb.org (Postfix) with ESMTPSA id 1E34980E1F; Sun, 25 Sep 2022 21:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664140510; bh=D5bQKUrRLv3XTP484AtqLybLlzYtainirXmlMOSsmiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4I3qUzeezQdq7Dk1IkTyqTA7aOMTT3uvBMLdWuM1EUQnLdA9rOkn+sRZm6SElUw/ BNvaAwEuCiL5ZXJYY6i0OHnGHW9pYzy560+G6EAze0CsWydInyA0LkWFvfvtsk8abs L3z0Aq+tQGWBhXYte9iphbVBl1iOZyiImQTsjRilQ3/CrdcmdnsAoNWiZGl+BQLZ6B lg2b8KZW6kRjlzrxitMkyt779eV6N53eIAgRYCwd33+RAX7AuE705LjUG83YeS7gts 6kTmgWzSmn5sm1jZPWyuj2iU8vQsLQRUXPj0O87bsr8a2G5WHKyOUwwhm0uUjTtDl3 B6MfBMEhgC0/w== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [RFC PATCH v5 12/18] discord: Add database tables for the Discord bot Date: Mon, 26 Sep 2022 04:14:21 +0700 Message-Id: <20220925211427.412-13-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220925211427.412-1-kiizuha@gnuweeb.org> References: <20220925211427.412-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add some tables for the Discord bot in the same database as the Telegram bot in db.sql Reviewed-by: Alviro Iskandar Setiawan Signed-off-by: Muhammad Rizki --- daemon/db.sql | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/daemon/db.sql b/daemon/db.sql index c55c464..d7665db 100644 --- a/daemon/db.sql +++ b/daemon/db.sql @@ -59,4 +59,60 @@ CREATE TABLE `tg_broadcasts` ( KEY `created_at` (`created_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; +-- [ SPLITTER ] ------------------------------------------------------------------------------ + +DROP TABLE IF EXISTS `dc_emails`; +CREATE TABLE `dc_emails` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `message_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, + `created_at` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `message_id` (`message_id`), + KEY `created_at` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; + + +DROP TABLE IF EXISTS `dc_mail_msg`; +CREATE TABLE `dc_mail_msg` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `email_id` bigint unsigned NOT NULL, + `channel_id` bigint NOT NULL, + `dc_msg_id` bigint unsigned NOT NULL, + `created_at` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `email_id` (`email_id`), + KEY `channel_id` (`channel_id`), + KEY `dc_msg_id` (`dc_msg_id`), + KEY `created_at` (`created_at`), + CONSTRAINT `dc_mail_msg_ibfk_2` FOREIGN KEY (`email_id`) REFERENCES `dc_emails` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; + + +DROP TABLE IF EXISTS `dc_atoms`; +CREATE TABLE `dc_atoms` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, + `created_at` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `url` (`url`), + KEY `created_at` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; + + +DROP TABLE IF EXISTS `dc_broadcasts`; +CREATE TABLE `dc_broadcasts` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `guild_id` BIGINT UNSIGNED NOT NULL, + `channel_id` BIGINT UNSIGNED NOT NULL, + `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, + `channel_link` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, + `created_at` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `guild_id` (`guild_id`), + UNIQUE KEY `channel_id` (`channel_id`), + KEY `channel_name` (`channel_name`), + KEY `channel_link` (`channel_link`), + KEY `created_at` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; + -- 2022-07-07 14:25:28 -- Muhammad Rizki