FIX: The name changes if the top function changes

FIX: The name changes if the top function changes

diff --git a/db/migrate/20200902225712_fix_query_ids.rb b/db/migrate/20200902225712_fix_query_ids.rb
index 7c53e16..0b68bbd 100644
--- a/db/migrate/20200902225712_fix_query_ids.rb
+++ b/db/migrate/20200902225712_fix_query_ids.rb
@@ -58,7 +58,7 @@ class FixQueryIds < ActiveRecord::Migration[6.0]
       SQL
 
       # insert additional_conflicts to temporary table
-      new_id = DB.query("select greatest(max(id), 1) from tmp_data_explorer_queries").first.max + 1
+      new_id = DB.query("select greatest(max(id), 1) from tmp_data_explorer_queries").first.greatest + 1
       additional_conflicts.each do |conflict_id|
         DB.exec <<-SQL
           INSERT INTO tmp_data_explorer_queries(id, name, description, sql, user_id, last_run_at, hidden, created_at, updated_at)

GitHub sha: 0e7e51ae