Calling this method on a model with a table name in a different schema now only gives nil. Whereas in version 5.2.x, it would correctly fetch the table's comment.
Create a model (w/ migration) that lives in a non-standard DB schema.
# app/models/my_schema/my_model.rb
module MySchema
class MyModel < ApplicationRecord # which inherits from ActiveRecord::Base
self.table_name = 'my_schema.my_model' # intentionally using singular name
# other stuff...
end
end
# db/migrate/01_create_my_schema_my_model.rb
class CreateMySchemaMyModel < ActiveRecord::Migration[6.1]
def change
create_table 'my_schema.my_model', comment: "This model has a comment" do |t|
# Some column definitions...
end
end
end
then migrate
Open rails console, then call ApplicationRecord.connection.table_comment(MySchema::MyModel.table_name)
Calling this method on a model with a table name in a different schema now only gives
nil
. Whereas in version 5.2.x, it would correctly fetch the table's comment.Steps to reproduce
Create a model (w/ migration) that lives in a non-standard DB schema.
then migrate
ApplicationRecord.connection.table_comment(MySchema::MyModel.table_name)
re-bundle, then repeat step 3.
Expected behavior
It should return the string
"This model has a comment"
with all versions of the gemActual behavior
nil
with the 6.x version of the gem"This model has a comment"
with the 5.2.x version of the gemSystem configuration
Rails version: 6.1.5 / 5.2.3 for these examples
Oracle enhanced adapter version: 6.1.4 / 5.2.3 for these examples
Ruby version: 2.6.6 / 2.7.5
Oracle Database version: Oracle Database 19c Enterprise Edition - 19.14.0.0.0