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

db:schema:load fails with error NoMethodError: undefined method 'to_sym' for {:type=>:string, :limit=>36}:Hash #2340

Open
roygopal opened this issue May 19, 2023 · 5 comments

Comments

@roygopal
Copy link

Steps to reproduce

In schema.rb/oracle_schema.rb file the syntax that is generated for default id column is in hash notation.
It happens because of id: { type: :string, limit: 191 } syntax in oracle_schema.rb. When we change manually it to id: :string, limit: 36 then schema load passes.
Generated migration (schema.rb/oracle_schema.rb)file has syntax as below
create_table "settings", primary_key: "name", id: { type: :string, limit: 191 }, force: :cascade do |t|

Expected behavior

db:schema:load should pass.

Actual behavior

On db:schema:load, it fails with error NoMethodError: undefined method to_sym' for {:type=>:string, :limit=>36}:Hash`

System configuration

Rails version: 6.1

Oracle enhanced adapter version: 6.1.0

Ruby version: >=3.0

Oracle Database version: XE
Screenshot 2023-05-19 at 10 24 52 PM

@roygopal roygopal changed the title db:schema:load fails with error NoMethodError: undefined method to_sym' for {:type=>:string, :limit=>36}:Hash` db:schema:load fails with error NoMethodError: undefined method 'to_sym' for {:type=>:string, :limit=>36}:Hash May 24, 2023
@Physium
Copy link

Physium commented Jul 13, 2023

Hey i am facing this issue as well. is there a fix to this?

Currently on:

  • rails version 6.1
  • oracle enhanced adapter version: 6.1.0
  • ruby 2.7.8

@roygopal
Copy link
Author

roygopal commented Jul 13, 2023

@Physium For now, we solved it by applying monkey patches to our application. Added below patch and loaded this in config/initializers. See the attached screenshot. It worked for us.
Screenshot 2023-07-13 at 10 06 52 PM
Screenshot 2023-07-13 at 10 08 54 PM

@Physium
Copy link

Physium commented Jul 17, 2023

@roygopal thanks for sharing! Is there a reason why you patch here and not at this gem adapter level?

@roygopal
Copy link
Author

@roygopal thanks for sharing! Is there a reason why you patch here and not at this gem adapter level?

No particular reason. Its just that in our app it was blocking other priority changes and due to time constraint we patched in our app.

@Physium
Copy link

Physium commented Jul 19, 2023

Apologies, what i meant was that i notice that the code is to override TableDefinitation class which seems like an ActiveRecord thing. Shouldn't the patch be targeting some class under the gem adapter layer? I dont know enough about this adapter and the underlyng of how it work hence would just like to understand how this patch works.

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

2 participants