From 7b080d7a7ff38d375a7f703c7c0c39f8814afb36 Mon Sep 17 00:00:00 2001 From: Soso Playz Date: Sun, 15 Aug 2021 13:10:00 +0300 Subject: [PATCH] add database generators --- tools/sqlite/generate_db_archive.py | 21 +++++++++++++++++++++ tools/sqlite/generate_db_tags.py | 16 ++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tools/sqlite/generate_db_archive.py create mode 100644 tools/sqlite/generate_db_tags.py diff --git a/tools/sqlite/generate_db_archive.py b/tools/sqlite/generate_db_archive.py new file mode 100644 index 0000000..46d6ab5 --- /dev/null +++ b/tools/sqlite/generate_db_archive.py @@ -0,0 +1,21 @@ +import sqlite3 +from sqlite3 import Error +# if you decide to change the file name you will have to update the code accordingly +connection = sqlite3.connect("msgarchive.sqlite") + +with connection: + connection.execute(""" + CREATE TABLE ARCHIVE ( + id TEXT not null, + author TEXT not null, + content TEXT not null, + clean_content TEXT not null, + jump_url TEXT not null, + attachment_url TEXT, + date TEXT not null, + date_edited TEXT, + hash TEXT not null, + uuid TEXT not null + unique (id) + ); + """) diff --git a/tools/sqlite/generate_db_tags.py b/tools/sqlite/generate_db_tags.py new file mode 100644 index 0000000..a707b55 --- /dev/null +++ b/tools/sqlite/generate_db_tags.py @@ -0,0 +1,16 @@ +# This script creates a database intended to be used with the main bot for the tagging command +import sqlite3 +from sqlite3 import Error +# if you decide to change the file name you will have to update the code accordingly +connection = sqlite3.connect("tagbot.sqlite") + +with connection: + connection.execute(""" + CREATE TABLE TAG ( + id INTEGER, + name TEXT not null, + content TEXT not null, + date INTEGER, + unique (name) + ); + """)