This repository is a patch for TG-FileStream. It allows you to use MySQL as Database instead of mongodb
First, clone and setup the base project:
https://github.com/SpringsFern/TG-FileStream
Follow the setup instructions provided in that repository's README file.
Make sure TG-FileStream is fully working before continuing.
You can install this plugin using either of the following methods.
You can install this plugin directly via pip using the Git repository:
pip3 install git+https://github.com/SpringsFern/tgfs-mysql
This method uses TGFS entry-point plugin loading and does not require placing files inside the patches directory.
Clone this repository inside the patches directory of TG-FileStream.
Your folder structure should look like this:
<TG-FileStream base folder>/
│
├── .git
├── tgfs/
│ ├── patches/
│ │ └── tgfs-mysql ← clone this repo here
Example:
cd <TG-FileStream base folder>/tgfs/patches
git clone https://github.com/SpringsFern/tgfs-mysqlInstall required dependency:
pip3 install aiomysqlSet the following variables if you choose MySQL as the database in DB_BACKEND
| Variable | Required/Default | Description |
|---|---|---|
DB_BACKEND |
✅ | Set it to mysql |
MYSQL_HOST |
✅ | MySQL DataBase Host Name |
MYSQL_PORT |
✅ | MySQL Database Port Number |
MYSQL_USER |
✅ | MySQL Database Username |
MYSQL_PASSWORD |
✅ | MySQL Database Password |
MYSQL_DB |
✅ | MySQL Database Name |
MYSQL_MINSIZE |
1 |
Minimum sizes of the MySQL Connection pool |
MYSQL_MAXSIZE |
5 |
Maximum sizes of the MySQL Connection pool |
After installation, start or restart TG-FileStream:
python3 -m tgfs
Or restart the service if running in the background.
The MySQL Database patch should now be active.
Make sure you restart the bot after adding the patch.