1. 23 4月, 2020 1 次提交
  2. 22 4月, 2020 6 次提交
  3. 21 4月, 2020 7 次提交
  4. 20 4月, 2020 6 次提交
  5. 19 4月, 2020 4 次提交
  6. 18 4月, 2020 2 次提交
  7. 17 4月, 2020 6 次提交
  8. 16 4月, 2020 4 次提交
    • E
      Add `if_exists` option to `remove_index` · 36ea1084
      eileencodes 提交于
      This PR allows for passing `if_exists` options to the `remove_index`
      method so that we can ignore already removed indexes. This work follows
      column `if/if_not_exists` from #38352 and `:if_not_exists` on `add_index`
      from #38555.
      
      We've found this useful at GitHub, there are migrations where we don't
      want to raise if an index was already removed. This will allow us to
      remove a monkey patch on `remove_index`.
      
      I considered raising after the `index_name_for_remove` method is called
      but that method will raise if the index doesn't exist before we get to
      execute. I have a commit that refactors this but after much
      consideration this change is cleaner and more straightforward than other
      ways of implementing this.
      
      This change also adds a little extra validation to the `add_index` test.
      Fix `nodoc` on edited methods.
      36ea1084
    • R
      Merge pull request #38929 from kamipo/fix_unscoping_association_scope · ab18f608
      Ryuta Kamizono 提交于
      Fix unscoping association scope on joins not to raise an error
      ab18f608
    • E
      Merge pull request #38959 from cjilbert504/master · 9303873e
      Eugene Kenny 提交于
      active_record_validations.md grammer fix [ci skip]
      9303873e
    • C
      active_record_validations.md grammer fix [ci skip] · 1583d8ee
      cjilbert504 提交于
      An extremely small readability change to line 269 [ci skip].
      1583d8ee
  9. 15 4月, 2020 4 次提交
    • R
      Fix unscoping association scope on joins not to raise an error · e93f416a
      Ryuta Kamizono 提交于
      #29589 changed merging scope order to allow to unscope default scopes on
      association scope (#29611), but that caused a regression #38811 that
      accidentally allow join constraint which is required.
      
      ```
      % bin/test test/cases/associations/has_many_associations_test.rb -n test_unscopes_the_default_scope_of_associated_model_when_used_with_include
      Run options: -n test_unscopes_the_default_scope_of_associated_model_when_used_with_include --seed 32978
      
      # Running:
      
      E
      
      Error:
      HasManyAssociationsTest#test_unscopes_the_default_scope_of_associated_model_when_used_with_include:
      NoMethodError: undefined method `children' for nil:NilClass
          ~/rails/activerecord/lib/active_record/associations/join_dependency/join_association.rb:39:in `block in join_constraints'
          ~/rails/activerecord/lib/active_record/associations/join_dependency/join_association.rb:30:in `reverse_each'
          ~/rails/activerecord/lib/active_record/associations/join_dependency/join_association.rb:30:in `with_index'
          ~/rails/activerecord/lib/active_record/associations/join_dependency/join_association.rb:30:in `join_constraints'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:171:in `make_constraints'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:196:in `block in walk'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:196:in `each'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:196:in `flat_map'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:196:in `walk'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:90:in `block in join_constraints'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:87:in `each'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:87:in `flat_map'
          ~/rails/activerecord/lib/active_record/associations/join_dependency.rb:87:in `join_constraints'
          ~/rails/activerecord/lib/active_record/relation/query_methods.rb:1226:in `build_join_query'
          ~/rails/activerecord/lib/active_record/relation/query_methods.rb:1211:in `build_joins'
          ~/rails/activerecord/lib/active_record/relation/query_methods.rb:1091:in `build_arel'
          ~/rails/activerecord/lib/active_record/relation/query_methods.rb:1063:in `arel'
          ~/rails/activerecord/lib/active_record/relation/finder_methods.rb:419:in `block in limited_ids_for'
          ~/rails/activerecord/lib/active_record/relation.rb:867:in `skip_query_cache_if_necessary'
          ~/rails/activerecord/lib/active_record/relation/finder_methods.rb:419:in `limited_ids_for'
          ~/rails/activerecord/lib/active_record/relation/finder_methods.rb:398:in `apply_join_dependency'
          ~/rails/activerecord/lib/active_record/relation.rb:839:in `block in exec_queries'
          ~/rails/activerecord/lib/active_record/relation.rb:867:in `skip_query_cache_if_necessary'
          ~/rails/activerecord/lib/active_record/relation.rb:834:in `exec_queries'
          ~/rails/activerecord/lib/active_record/relation.rb:639:in `load'
          ~/rails/activerecord/lib/active_record/relation.rb:250:in `records'
          ~/rails/activerecord/lib/active_record/relation/finder_methods.rb:508:in `find_take'
          ~/rails/activerecord/lib/active_record/relation/finder_methods.rb:98:in `take'
          ~/rails/activerecord/lib/active_record/relation/finder_methods.rb:458:in `find_one'
          ~/rails/activerecord/lib/active_record/relation/finder_methods.rb:442:in `find_with_ids'
          ~/rails/activerecord/lib/active_record/relation/finder_methods.rb:69:in `find'
          ~/rails/activerecord/test/cases/associations/has_many_associations_test.rb:2689:in `block in <class:HasManyAssociationsTest>'
      
      bin/test test/cases/associations/has_many_associations_test.rb:2683
      ```
      
      Required join constraint should not be allowed to unscoping.
      
      Fixes #38811.
      e93f416a
    • R
      Fixup CHANGELOGs [ci skip] · 6f2126c7
      Ryuta Kamizono 提交于
      6f2126c7
    • R
      Merge pull request #38946 from kamipo/remove_unused_visitors · 943f1ea1
      Ryuta Kamizono 提交于
      Remove unused Arel visitors in the code base
      943f1ea1
    • R
      Remove unused Arel visitors in the code base · a2040ee3
      Ryuta Kamizono 提交于
      This removes ibm_db, informix, mssql, oracle, and oracle12 Arel visitors
      which are not used in the code base.
      
      Actually oracle and oracle12 visitors are used at oracle-enhanced
      adapter, but now I think that those visitors should be in the adapter's
      repo like sqlserver adapter and the dedicated Arel visitor
      (https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/master/lib/arel/visitors/sqlserver.rb),
      otherwise it is hard to find a bug and review PRs for the oracle
      visitors (e.g. #35838, #37646), since we don't have knowledge and
      environment enough for Oracle.
      a2040ee3