Comments (11)
Thank you! I'm looking into it and will try to provide a fix ASAP.
from database_consistency.
Hi, thank you for letting me know. It's known issue, could you please try latest version and let me if it didn't help.
from database_consistency.
Feel free to reopen the issue if needed.
from database_consistency.
after updating to 0.8.7
I still have the same issue (the only change is that row shifted to 101)
<===begin===> �[1mTraceback�[m (most recent call last): 24: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/bin/ruby_executable_hooks:24:in
23: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/bin/ruby_executable_hooks:24:in
eval' 22: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/bin/database_consistency:23:in
'21: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/bin/database_consistency:23:in
load' 20: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/bin/database_consistency:44:in
<top (required)>'19: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency.rb:46:in
run' 18: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:12:in
reports'17: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:12:in
flat_map' 16: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:12:in
each'15: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:13:in
block in reports' 14: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:28:in
reports'13: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:15:in
check' 12: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:15:in
flat_map'11: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:15:in
each' 10: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:18:in
block in check'9: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:18:in
flat_map' 8: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:18:in
each'7: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:19:in
block (2 levels) in check' 6: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:19:in
map'5: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:21:in
block (3 levels) in check' 4: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/base_checker.rb:30:in
report_if_enabled?'3: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/base_checker.rb:23:in
report' 2: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/association_checkers/foreign_key_type_checker.rb:36:in
check'1: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/association_checkers/foreign_key_type_checker.rb:108:in
converted_type' /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/association_checkers/foreign_key_type_checker.rb:101:in
type': �[1mundefined method sql_type' for nil:NilClass (�[1;4mNoMethodError�[m�[1m)�[m <===end===> <===begin===> �[1mTraceback�[m (most recent call last): 24: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/bin/ruby_executable_hooks:24:in
'23: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/bin/ruby_executable_hooks:24:in
eval' 22: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/bin/database_consistency:23:in
'21: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/bin/database_consistency:23:in
load' 20: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/bin/database_consistency:44:in
<top (required)>'19: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency.rb:46:in
run' 18: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:12:in
reports'17: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:12:in
flat_map' 16: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:12:in
each'15: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:13:in
block in reports' 14: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/base_processor.rb:28:in
reports'13: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:15:in
check' 12: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:15:in
flat_map'11: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:15:in
each' 10: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:18:in
block in check'9: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:18:in
flat_map' 8: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:18:in
each'7: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:19:in
block (2 levels) in check' 6: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:19:in
map'5: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/processors/associations_processor.rb:21:in
block (3 levels) in check' 4: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/base_checker.rb:30:in
report_if_enabled?'3: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/base_checker.rb:23:in
report' 2: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/association_checkers/foreign_key_type_checker.rb:36:in
check'1: from /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/association_checkers/foreign_key_type_checker.rb:108:in
converted_type' /Users/user/.rvm/gems/ruby-2.7.1@my_project/gems/database_consistency-0.8.7/lib/database_consistency/checkers/association_checkers/foreign_key_type_checker.rb:101:in
type': �[1mundefined method sql_type' for nil:NilClass (�[1;4mNoMethodError�[m�[1m)�[m <===end===>
from database_consistency.
Then I need a little bit more context, could you please debug it and give the context how the association (which raises such issue is defined)? Let me please know if you need a help to track it
from database_consistency.
If you have some practice of how to find the association which causes the error, it would be helpful
from database_consistency.
Yes, on the method "type" where checker does "sql_type" add "p association if column.nil?" before, that should help to understand which association fails
from database_consistency.
I found model which caused an error (and I think it's default implementation of Rolify gem):
- association:
#<ActiveRecord::Reflection::HasAndBelongsToManyReflection:0x00007fcca75de2f8
@active_record=
User(id: integer, first_name: string, last_name: string, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: inet, last_sign_in_ip: inet, created_at: datetime, updated_at: datetime),
@active_record_primary_key="id",
@association_scope_cache=#<Concurrent::Map:0x00007fcca75de1e0 entries=0 default_proc=nil>,
@class_name="Role",
@constructable=true,
@foreign_key="user_id",
@foreign_type=nil,
@klass=Role(id: integer, name: string, resource_type: string, resource_id: integer, created_at: datetime, updated_at: datetime),
@name=:roles,
@options={:class_name=>"Role", :join_table=>"users_roles"},
@plural_name="roles",
@scope=nil,
@type=nil>
- Role model:
class Role < ApplicationRecord
scopify
has_many :users_roles, dependent: :destroy
has_many :users, through: :users_roles
belongs_to :resource, polymorphic: true, optional: true
enum name: { admin: 'admin' }
validates :resource_type, inclusion: { in: Rolify.resource_types }, allow_nil: true
validates :name, presence: true
end
- UsersRole model:
class UsersRole < ApplicationRecord
belongs_to :user
belongs_to :role
end
- migration for these models:
class RolifyCreateRoles < ActiveRecord::Migration[6.0]
def change
create_table(:roles) do |t|
t.string :name, null: false
t.references :resource, polymorphic: true
t.timestamps
end
create_table(:users_roles) do |t|
t.references :user, null: false, foreign_key: true
t.references :role, null: false, foreign_key: true
t.timestamps
end
add_index(:roles, %i[name resource_type resource_id])
add_index(:users_roles, %i[user_id role_id])
end
end
from database_consistency.
Hey @denys-husiev , I believe I have fixed it in 0.8.8
. Could you please try it out and let me know if it still has the issue? Feel free to reopen the issue.
from database_consistency.
Hi @djezzzl , error disappeared. Thank you very much for your work and such quick reaction!
from database_consistency.
Thank you too!
from database_consistency.
Related Issues (20)
- Excluding Database Connections to Non Primary Databases Including sqlserver HOT 2
- Ensure that generated todo files are created with consistent ordering HOT 6
- MissingIndexChecker violation on polymorphic association HOT 3
- ForeignKeyCascadeChecker default mapping HOT 3
- "undefined method `null' for nil:NilClass" in column_presence_checker.rb:54 HOT 7
- UniqueIndexChecker and postgresql partial indexes HOT 1
- Extendable database_consistency HOT 5
- Checker for implicit_order_column for table with uuid as primary key HOT 8
- False-positive when index columns are defined as a string and not array HOT 4
- ActiveRecord 7.0.5 internal error HOT 3
- MissingAssociationClassChecker fails with `undefined method klass for nil:NilClass` HOT 4
- undefined method `split' for nil:NilClass HOT 2
- ColumnPresenceChecker is incompatible with Rails' new default `belongs_to` validation behavior HOT 5
- Error when running ForeignKeyCascadeChecker HOT 1
- Add a file extension to debug output HOT 3
- Improve Documentation to describe how to work with indexes
- Error in NullConstraintChecker and other checkers
- Database_сonsistency Gem Does Not Detect Some Validations HOT 2
- `MissingUniqueIndexChecker` autocorrect is wrong when column is a function
- Error on on length check
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from database_consistency.