From 8e889717b5092e7b2c0ca446cd9e576bdbf688f3 Mon Sep 17 00:00:00 2001 From: "Georg J.P. Link" Date: Fri, 24 Aug 2018 16:20:00 -0500 Subject: [PATCH] reset table ids on reset --- app/libs/bugm_host.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/libs/bugm_host.rb b/app/libs/bugm_host.rb index a7fc2a27..a2d4fcfb 100644 --- a/app/libs/bugm_host.rb +++ b/app/libs/bugm_host.rb @@ -20,7 +20,12 @@ def reset def reset_postgres tables = %w(Tracker User Offer Escrow Position Amendment Contract Event) - tables.each {|el| Object.const_get(el).destroy_all} + tables.each {|el| + Object.const_get(el).destroy_all + # reset the IDs + sql = "TRUNCATE TABLE #{Object.const_get(el).table_name} RESTART IDENTITY;" + ActiveRecord::Base.connection.execute(sql) + } BugmTime.clear_offset PayproCmd::Create.new({}) UserCmd::Create.new({email: 'admin@bugmark.net', password: 'bugmark'}).project