-
Notifications
You must be signed in to change notification settings - Fork 21
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
Better check for whether or not a table is_chrono? #98
base: master
Are you sure you want to change the base?
Changes from 4 commits
37c5c45
e1dd13b
85bb457
19905b5
accaa5b
ea28153
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,25 @@ | |
it { expect(adapter.is_chrono?(table)).to be(false) } | ||
end | ||
|
||
context "when passing a fully specified schema" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the failing spec, but to speed up things I need to better understand what it is the use case that this change is addressing. Any chance to fork https://github.com/diowa/ruby3-rails7-bootstrap-heroku/tree/chronomodel and add a commit with the minimum amount of code needed to understand the impact of this issue on an existing application? |
||
before(:all) do | ||
adapter.execute "BEGIN" | ||
adapter.execute "CREATE SCHEMA test_schema" | ||
|
||
table "test_schema.#{table}" | ||
adapter.execute "CREATE TABLE #{table} (id integer)" | ||
end | ||
|
||
after(:all) do | ||
table "test_table" | ||
adapter.execute "ROLLBACK" | ||
end | ||
|
||
it { expect { adapter.is_chrono?(table) }.to_not raise_error } | ||
|
||
it { expect(adapter.is_chrono?(table)).to be(false) } | ||
end | ||
|
||
context 'when schemas are not there yet' do | ||
before(:all) do | ||
adapter.execute 'BEGIN' | ||
|
@@ -150,5 +169,53 @@ | |
|
||
it { expect(adapter.is_chrono?(table)).to be(false) } | ||
end | ||
|
||
context "within a different search_path" do | ||
before(:all) do | ||
schema_name = "schema_#{Random.uuid.tr("-", "_")}" | ||
|
||
adapter.execute "BEGIN" | ||
adapter.execute "CREATE SCHEMA #{schema_name}" | ||
adapter.execute "SET search_path TO #{schema_name}" | ||
end | ||
|
||
after(:all) do | ||
adapter.execute "ROLLBACK" | ||
end | ||
|
||
with_temporal_table do | ||
it { expect(adapter.is_chrono?(table)).to be(true) } | ||
end | ||
|
||
with_plain_table do | ||
it { expect(adapter.is_chrono?(table)).to be(false) } | ||
end | ||
end | ||
|
||
context "with a table in a different schema" do | ||
before(:all) do | ||
schema_name = "schema_#{Random.uuid.tr("-", "_")}" | ||
|
||
adapter.execute "BEGIN" | ||
adapter.execute "CREATE SCHEMA #{schema_name}" | ||
adapter.execute "SET search_path TO #{schema_name}" | ||
|
||
table "different_schema_table" | ||
end | ||
|
||
after(:all) do | ||
table "test_table" | ||
|
||
adapter.execute "ROLLBACK" | ||
end | ||
|
||
with_temporal_table do | ||
it { expect(adapter.is_chrono?(table)).to be(true) } | ||
end | ||
|
||
with_plain_table do | ||
it { expect(adapter.is_chrono?(table)).to be(false) } | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest this change for the moment, if you think it is the same thing (specs are green)