Skip to content
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

ActiveRecord::ConnectionAdapters::OracleEnhanced::SchemaStatements#table_comment not working correctly in 6.x #2285

Open
istrasci opened this issue Apr 11, 2022 · 0 comments

Comments

@istrasci
Copy link

istrasci commented Apr 11, 2022

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

  1. Add to Gemfile:
    gem 'activerecord-oracle_enhanced-adapter', '6.1.4'
    gem 'rails', '6.1.5'
  2. 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
  3. Open rails console, then call ApplicationRecord.connection.table_comment(MySchema::MyModel.table_name)
  4. Exit rails consle, change Gemfile to use
    gem 'activerecord-oracle_enhanced-adapter', '5.2.3'
    gem 'rails', '5.2.3'
    re-bundle, then repeat step 3.

Expected behavior

It should return the string "This model has a comment" with all versions of the gem

Actual behavior

  • It returns nil with the 6.x version of the gem
  • It correctly returns the string "This model has a comment" with the 5.2.x version of the gem

System 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant