Skip to content

Commit

Permalink
fix order of migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfagun74 committed May 8, 2024
1 parent 6996f54 commit 44a31dc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 44a31dc

Please sign in to comment.