From e5e266b8f177b9bc8dddd1513047cae145b2d6d8 Mon Sep 17 00:00:00 2001 From: norohind <60548839+norohind@users.noreply.github.com> Date: Mon, 4 Apr 2022 18:14:07 +0300 Subject: [PATCH] Add note how to sync serial action_id --- model/postgres_sql_requests.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/model/postgres_sql_requests.py b/model/postgres_sql_requests.py index 9b7bd3d..9697e6c 100644 --- a/model/postgres_sql_requests.py +++ b/model/postgres_sql_requests.py @@ -17,6 +17,15 @@ foreign key (action_id) references squads_stats_states_action_info(action_id) ); """ +""" +In order to sync action_id with appropriate serial sequence, execute +SELECT + setval( + 'squads_stats_states_action_info_action_id_seq', + (SELECT MAX(action_id) FROM squads_stats_states_action_info)+1 + ); +""" + create_new_action_id = """ insert into squads_stats_states_action_info (leaderboard_type, platform) values (%(LB_type)s, %(platform)s);