refactor MediaGroup. Add database

This commit is contained in:
KatykhinAA
2024-07-20 16:54:43 +03:00
parent 54234e59ec
commit 0b7f718f8a
11 changed files with 193 additions and 92 deletions

View File

@@ -1,17 +1,14 @@
import os
from helper_bot.utils.base_dependency_factory import BaseDependencyFactory
# Получаем текущий рабочий каталог
current_dir = os.path.dirname(os.path.abspath(__file__))
from database.db import BotDB
# Переходим на уровень выше, чтобы выйти из папки migrations/
# Получаем текущую директорию
current_dir = os.path.dirname(__file__)
# Переходим на уровень выше
parent_dir = os.path.dirname(current_dir)
# Строим путь до файла
tg_bot_database_path = os.path.join(parent_dir, "tg-bot-database")
bdf = BaseDependencyFactory()
BotDB = bdf.get_db()
BotDB = BotDB(parent_dir, 'database/tg-bot-database')
def get_filename():
@@ -32,5 +29,6 @@ def main():
BotDB.create_table(migrations_init)
BotDB.update_version(0, get_filename())
if __name__ == "__main__":
main()