Skip to content
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
2 changes: 2 additions & 0 deletions lib/pgsync/sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def perform
print_description("From", source)
print_description("To", destination)

raise Error, "Destination must be different from source" if source.url == destination.url

if (opts[:preserve] || opts[:overwrite]) && destination.server_version_num < 90500
raise Error, "Postgres 9.5+ is required for --preserve and --overwrite"
end
Expand Down
4 changes: 4 additions & 0 deletions test/sync_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def test_preserve_no_primary_key
assert_error "No primary key", "chapters --preserve", config: true
end

def test_same_source_destination
assert_error "Destination must be different from source", "--from pgsync_test1 --to pgsync_test1", config: true
end

def test_no_shared_fields
assert_prints "authors: No fields to copy", "authors", config: true
end
Expand Down