crashtech/torque-postgresql

[issue] undefined method `foreign_key_in_create' for #<ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaCreation:0x0000000106d2e0e0

Closed this issue · 1 comments

Rails version: 7.0.4
This error is happening when there is a migration that has a foreign key constraint in it
The migration file looks this

    create_table :sample_table do |t|
      t.belongs_to :account, null: false, index: true, foreign_key: true
     end

Error log:

Caused by: NoMethodError: undefined method `foreign_key_in_create' for #ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaCreation:0x0000000106d2e0e0

          foreign_key_in_create(o.name, to_table, options)
          ^^^^^^^^^^^^^^^^^^^^^

.rvm/gems/ruby-3.1.2/gems/torque-postgresql-3.0.1/lib/torque/postgresql/adapter/schema_creation.rb:23:in `block in visit_TableDefinition'

.rvm/gems/ruby-3.1.2/gems/torque-postgresql-3.0.1/lib/torque/postgresql/adapter/schema_creation.rb:22:in `map'

. rvm/gems/ruby-3.1.2/gems/torque-postgresql-3.0.1/lib/torque/postgresql/adapter/schema_creation.rb:22:in `visit_TableDefinition'

.rvm/gems/ruby-3.1.2/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/schema_creation.rb:13:in `accept'

.rvm/gems/ruby-3.1.2/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:325:in `create_table'

.rvm/gems/ruby-3.1.2/gems/torque-postgresql-3.0.1/lib/torque/postgresql/adapter/schema_statements.rb:70:in `create_table'

I'm about to publish version 3.2.0, which will include the fix for this problem. Thanks for taking the time to open the ticket.