From 77f2f6ca100905222baa815666ed4cc8057219b2 Mon Sep 17 00:00:00 2001 From: Przemek Sobstel Date: Tue, 20 Nov 2018 23:15:26 +0100 Subject: [PATCH] Restore test for postgres on conflict nothing --- test/bulk_insert/worker_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/bulk_insert/worker_test.rb b/test/bulk_insert/worker_test.rb index 65e90e5..735972b 100644 --- a/test/bulk_insert/worker_test.rb +++ b/test/bulk_insert/worker_test.rb @@ -326,6 +326,23 @@ class BulkInsertWorkerTest < ActiveSupport::TestCase end test "adapter dependent postgresql methods" do + pgsql_worker = BulkInsert::Worker.new( + Testing.connection, + Testing.table_name, + 'id', + %w(greeting age happy created_at updated_at color), + 500, # batch size + true, # ignore + false, # update duplicates + true # return primary keys + ) + pgsql_worker.adapter_name = 'PostgreSQL' + pgsql_worker.add ["Yo", 15, false, nil, nil] + + assert_equal pgsql_worker.compose_insert_query, "INSERT INTO \"testings\" (\"greeting\",\"age\",\"happy\",\"created_at\",\"updated_at\",\"color\") VALUES ('Yo',15,0,NULL,NULL,'chartreuse') ON CONFLICT DO NOTHING RETURNING id" + end + + test "adapter dependent postgresql methods (with update_duplicates)" do pgsql_worker = BulkInsert::Worker.new( Testing.connection, Testing.table_name,