Fixed migrate synthax

This commit is contained in:
Verox001 2024-02-13 09:40:07 +01:00
parent 05b5869be7
commit 979bfc24f9

View File

@ -21,7 +21,7 @@ def init_db():
def create_migration(conn: Connection, migration: str): def create_migration(conn: Connection, migration: str):
conn.execute(f""" conn.execute(f"""
INSERT INTO migrations (file, created_at) VALUES ("{migration}", "{datetime.datetime.now()}"); INSERT INTO migrations (file, created_at) VALUES ('{migration}', '{datetime.datetime.now()}');
""") """)
""" """
@ -29,7 +29,7 @@ Returns True, if the migration has already been migrates once.
""" """
def check_migration(conn: Connection, migration: str): def check_migration(conn: Connection, migration: str):
res = conn.cursor().execute(f""" res = conn.cursor().execute(f"""
SELECT EXISTS(SELECT file FROM migrations WHERE file = "{migration}"); SELECT EXISTS(SELECT file FROM migrations WHERE file = '{migration}');
""") """)
return res.fetchone()[0] == 1 return res.fetchone()[0] == 1