FIX: Sequences need to be set to at least 1
This commit is contained in:
parent
933fd9ac46
commit
b831d736ca
|
@ -58,7 +58,7 @@ class FixQueryIds < ActiveRecord::Migration[6.0]
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
# insert additional_conflicts to temporary table
|
# insert additional_conflicts to temporary table
|
||||||
new_id = DB.query("select max(id) from tmp_data_explorer_queries").first.max + 1
|
new_id = DB.query("select greatest(max(id), 1) from tmp_data_explorer_queries").first.max + 1
|
||||||
additional_conflicts.each do |conflict_id|
|
additional_conflicts.each do |conflict_id|
|
||||||
DB.exec <<-SQL
|
DB.exec <<-SQL
|
||||||
INSERT INTO tmp_data_explorer_queries(id, name, description, sql, user_id, last_run_at, hidden, created_at, updated_at)
|
INSERT INTO tmp_data_explorer_queries(id, name, description, sql, user_id, last_run_at, hidden, created_at, updated_at)
|
||||||
|
@ -92,7 +92,7 @@ class FixQueryIds < ActiveRecord::Migration[6.0]
|
||||||
SELECT
|
SELECT
|
||||||
setval(
|
setval(
|
||||||
pg_get_serial_sequence('data_explorer_queries', 'id'),
|
pg_get_serial_sequence('data_explorer_queries', 'id'),
|
||||||
(select max(id) from data_explorer_queries)
|
(select greatest(max(id), 1) from data_explorer_queries)
|
||||||
);
|
);
|
||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue