memindahkan db dan membuat fungsi untuk membuat folder db

This commit is contained in:
Kusaeni 2024-10-03 18:49:56 +07:00
parent 815ee6d52c
commit 15b4df3696
2 changed files with 11 additions and 4 deletions

View file

@ -167,9 +167,9 @@ async def jalan():
await asyncio.sleep(2)
await getNotif()
await asyncio.sleep(5)
await kirim_ke_tele()
await asyncio.sleep(5)
await tandai_notif()
# await kirim_ke_tele()
# await asyncio.sleep(5)
# await tandai_notif()
#

View file

@ -7,9 +7,16 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
cwd = os.getcwd()
db_dir = f"{cwd}/db"
if not os.path.exists(db_dir):
print("Folder db tidak ditemukan, membuat folder db")
os.makedirs(db_dir)
else:
print("Tidak bisa membuat folder db, silakan membuat secara manual folder db")
# Engine
engine = create_engine(f"sqlite:///{cwd}/gotodon.db")
engine = create_engine(f"sqlite:///{db_dir}/gotodon.db")
# Base
Base = declarative_base()