From 44a31dce3e7b4674d11907b2ca50005b43462390 Mon Sep 17 00:00:00 2001 From: Alper Alkan Date: Thu, 9 May 2024 01:38:48 +0200 Subject: [PATCH] fix order of migrations --- src/main.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index 65f8639..16ea620 100755 --- a/src/main.py +++ b/src/main.py @@ -181,14 +181,12 @@ def log_request(response): return response if __name__ == "__main__": - - #Migrations - cursor.execute('''DROP TABLE IF EXISTS games''') - cursor.execute('''DROP TABLE IF EXISTS games_v2''') - cursor.execute('''DELETE FROM cache WHERE timestamp < 1715210567''') - #Init cursor.execute('''CREATE TABLE IF NOT EXISTS cache (url TEXT PRIMARY KEY, data TEXT, timestamp REAL)''') cursor.execute('''CREATE TABLE IF NOT EXISTS stats (stat TEXT PRIMARY KEY, count INTEGER)''') cursor.execute('''CREATE INDEX IF NOT EXISTS idx_url ON cache (url)''') + #Migrations + cursor.execute('''DROP TABLE IF EXISTS games''') + cursor.execute('''DROP TABLE IF EXISTS games_v2''') + cursor.execute('''DELETE FROM cache WHERE timestamp < 1715210567''') serve(app, host="0.0.0.0", port=9999)