ソースを参照

Change SQL query to reflect UNIQUE CONTSTRAINT (utctime, state) on race_program

Foppe Hemminga 6 年 前
コミット
8be1ca2b24
1 ファイル変更2 行追加3 行削除
  1. 2 3
      races.py

+ 2 - 3
races.py

@@ -9,11 +9,10 @@ query = """
     INSERT INTO race_program (
         race_date, venue, state, race, start_time, utctime)
     VALUES (%s, %s, %s, %s, %s, %s)
-    ON CONFLICT (utctime) DO UPDATE SET
+    ON CONFLICT (utctime, state) DO UPDATE SET
         race_date = excluded.race_date,
         race = excluded.race,
-        start_time = excluded.start_time,
-        state = excluded.state
+        start_time = excluded.start_time
 """
 db = database.db
 cursor = db.cursor()