public inbox for [email protected]
 help / color / mirror / Atom feed
From: Muhammad Rizki <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Muhammad Rizki <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: [RFC PATCH v2 12/17] discord: Add database tables for Discord bot
Date: Tue, 13 Sep 2022 17:24:53 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Add some tables for Discord bot in the same database with Telegram bot
in db.sql

Signed-off-by: Muhammad Rizki <[email protected]>
---
 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


  parent reply	other threads:[~2022-09-13 10:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 10:24 [RFC PATCH v2 00/17] Refactor Telegram & initial work Discord Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 01/17] telegram: Move the Telegram bot source code Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 02/17] telegram: Refactor Telegram bot database method Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 03/17] telegram: Renaming some functions in scraper/bot.py Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 04/17] Add ignore file for .env Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 05/17] telegram: Refactor the Telegram bot Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 06/17] telegram: Renames in telegram mailer directory Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 07/17] Move scraper and utility file Muhammad Rizki
2022-09-17 17:14   ` Ammar Faizi
2022-09-17 17:16     ` Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 08/17] discord: Initial work Discord bot Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 09/17] discord: Add success run notice on_ready event Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 10/17] discord: Add error handler on events Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 11/17] Move db.sql to combine database with Discord and Telegram Muhammad Rizki
2022-09-13 10:24 ` Muhammad Rizki [this message]
2022-09-13 10:24 ` [RFC PATCH v2 13/17] discord: Add initial Discord bot database instance Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 14/17] discord: Add save_atom() in database insertion Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 15/17] discord: Add save_broadcast() " Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 16/17] discord: Add save_discord_mail() " Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 17/17] discord: Add save_email() " Muhammad Rizki
2022-09-17 17:08 ` [RFC PATCH v2 00/17] Refactor Telegram & initial work Discord Ammar Faizi
2022-09-17 17:16   ` Muhammad Rizki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox