refactor MediaGroup. Add database
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user