Skip to content

Commit

Permalink
Add spec to ensure special tables are ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
faridco committed Apr 29, 2024
1 parent 981b92c commit e7a0957
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 11 additions & 0 deletions spec/database_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ def setup(connection_url, user = "james-bond")
index(:id)
end
end

unless conn.table_exists?("spatial_ref_sys")
conn.create_table("spatial_ref_sys") do
primary_key(:id)
column(:name, String)
column(:last_purchase_at, Time)
foreign_key(:seller_id, :sellers, on_delete: :cascade)
index(:seller_id)
index(:id)
end
end
ensure
conn&.disconnect
end
Expand Down
9 changes: 7 additions & 2 deletions spec/pg_easy_replicate/orchestrate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@
end

it "succesfully for all tables" do
tables = described_class.determine_tables(
schema: test_schema,
conn_string: connection_url,
)

described_class.add_tables_to_publication(
group_name: "cluster1",
schema: test_schema,
conn_string: connection_url,
tables: %w[items sellers],
tables: tables,
)

expect(pg_publication_tables(connection_url: connection_url)).to eq(
Expand Down Expand Up @@ -133,7 +138,7 @@
schema: test_schema,
conn_string: connection_url,
)
expect(r.sort).to eq(%w[items sellers])
expect(r.sort).to eq(%w[items sellers spatial_ref_sys])
end
end

Expand Down

0 comments on commit e7a0957

Please sign in to comment.