Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved to date_source_exist from table_exists #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/lhm/atomic_switcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/lhm/entangler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/lhm/locked_switcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/lhm/migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/atomic_switcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/integration_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

#
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/locked_switcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down