From ec54f304ba73ee8b3658bafad5416c079ebeaeef Mon Sep 17 00:00:00 2001 From: Niko Noll Date: Tue, 27 Jun 2017 12:04:38 +0200 Subject: [PATCH] Moved to date_sources_exist from table_exists --- lib/lhm/atomic_switcher.rb | 4 ++-- lib/lhm/entangler.rb | 4 ++-- lib/lhm/locked_switcher.rb | 4 ++-- lib/lhm/migrator.rb | 4 ++-- spec/integration/atomic_switcher_spec.rb | 4 ++-- spec/integration/integration_helper.rb | 4 ++-- spec/integration/locked_switcher_spec.rb | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/lhm/atomic_switcher.rb b/lib/lhm/atomic_switcher.rb index 5004b5fd..eeb562b1 100644 --- a/lib/lhm/atomic_switcher.rb +++ b/lib/lhm/atomic_switcher.rb @@ -41,8 +41,8 @@ def atomic_switch end def validate - unless @connection.table_exists?(@origin.name) && - @connection.table_exists?(@destination.name) + unless @connection.data_source_exists?(@origin.name) && + @connection.data_source_exists?(@destination.name) error "`#{ @origin.name }` and `#{ @destination.name }` must exist" end end diff --git a/lib/lhm/entangler.rb b/lib/lhm/entangler.rb index c73bf2be..1345ac7d 100644 --- a/lib/lhm/entangler.rb +++ b/lib/lhm/entangler.rb @@ -68,11 +68,11 @@ def trigger(type) end def validate - unless @connection.table_exists?(@origin.name) + unless @connection.data_source_exists?(@origin.name) error("#{ @origin.name } does not exist") end - unless @connection.table_exists?(@destination.name) + unless @connection.data_source_exists?(@destination.name) error("#{ @destination.name } does not exist") end end diff --git a/lib/lhm/locked_switcher.rb b/lib/lhm/locked_switcher.rb index f3234990..13e39d8d 100644 --- a/lib/lhm/locked_switcher.rb +++ b/lib/lhm/locked_switcher.rb @@ -53,8 +53,8 @@ def uncommitted end def validate - unless @connection.table_exists?(@origin.name) && - @connection.table_exists?(@destination.name) + unless @connection.data_source_exists?(@origin.name) && + @connection.data_source_exists?(@destination.name) error "`#{ @origin.name }` and `#{ @destination.name }` must exist" end end diff --git a/lib/lhm/migrator.rb b/lib/lhm/migrator.rb index b0ee6608..bb46fd11 100644 --- a/lib/lhm/migrator.rb +++ b/lib/lhm/migrator.rb @@ -183,7 +183,7 @@ def filter(sql) private def validate - unless @connection.table_exists?(@origin.name) + unless @connection.data_source_exists?(@origin.name) error("could not find origin table #{ @origin.name }") end @@ -193,7 +193,7 @@ def validate dest = @origin.destination_name - if @connection.table_exists?(dest) + if @connection.data_source_exists?(dest) error("#{ dest } should not exist; not cleaned up from previous run?") end end diff --git a/spec/integration/atomic_switcher_spec.rb b/spec/integration/atomic_switcher_spec.rb index 6c934a02..3e30a64a 100644 --- a/spec/integration/atomic_switcher_spec.rb +++ b/spec/integration/atomic_switcher_spec.rb @@ -90,7 +90,7 @@ switcher.run slave do - table_exists?(@origin).must_equal true + data_source_exists?(@origin).must_equal true table_read(@migration.archive_name).columns.keys.must_include 'origin' end end @@ -100,7 +100,7 @@ switcher.run slave do - table_exists?(@destination).must_equal false + data_source_exists?(@destination).must_equal false table_read(@origin.name).columns.keys.must_include 'destination' end end diff --git a/spec/integration/integration_helper.rb b/spec/integration/integration_helper.rb index ed7432e9..221aed70 100644 --- a/spec/integration/integration_helper.rb +++ b/spec/integration/integration_helper.rb @@ -121,8 +121,8 @@ def table_read(fixture_name) Lhm::Table.parse(fixture_name, @connection) end - def table_exists?(table) - connection.table_exists?(table.name) + def data_source_exists?(table) + connection.data_source_exists?(table.name) end # diff --git a/spec/integration/locked_switcher_spec.rb b/spec/integration/locked_switcher_spec.rb index f40e0f34..cd0d2a67 100644 --- a/spec/integration/locked_switcher_spec.rb +++ b/spec/integration/locked_switcher_spec.rb @@ -32,7 +32,7 @@ switcher.run slave do - table_exists?(@origin).must_equal true + data_source_exists?(@origin).must_equal true table_read(@migration.archive_name).columns.keys.must_include 'origin' end end @@ -42,7 +42,7 @@ switcher.run slave do - table_exists?(@destination).must_equal false + data_source_exists?(@destination).must_equal false table_read(@origin.name).columns.keys.must_include 'destination' end end