Skip to content

Commit 5a8d713

Browse files
BuonOmorafiss
authored andcommitted
fix: do not flush cache unnecessarily
Follows rails changes introduced in [rails/rails#48069][rails_pr]. The `exec_query` now flushes the schema cache. As we now our queries do not alter this cache, we'd rather not flush. Might fix #320 [rails_pr]: rails/rails#48069
1 parent 39c43fa commit 5a8d713

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.1
1+
3.2.3

lib/active_record/connection_adapters/cockroachdb/schema_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def primary_key(table_name)
4747
# so we append it manually.
4848
def foreign_keys(table_name)
4949
scope = quoted_scope(table_name)
50-
fk_info = exec_query(<<~SQL, "SCHEMA")
50+
fk_info = internal_exec_query(<<~SQL, "SCHEMA")
5151
SELECT CASE
5252
WHEN n2.nspname = current_schema()
5353
THEN ''

lib/active_record/relation/query_methods_ext.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ def index_hint!(hint)
7676
self
7777
end
7878

79-
# TODO: reset or no reset?
80-
8179
def show_create
82-
connection.execute("show create table #{connection.quote_table_name self.table_name}").first["create_statement"]
80+
quoted_table = connection.quote_table_name self.table_name
81+
connection.select_one("show create table #{quoted_table}")["create_statement"]
8382
end
8483

8584
private

0 commit comments

Comments
 (0)