1. 07 3月, 2019 7 次提交
  2. 06 3月, 2019 8 次提交
    • K
      Add some whitespace for readability. · 1818c4e8
      Kasper Timm Hansen 提交于
      1818c4e8
    • K
      Fix test case name after file extraction · 525e7720
      Kasper Timm Hansen 提交于
      Although the old name had a certain persistence, this ain't the kind of
      file we're in now.
      525e7720
    • K
      ba795c9e
    • R
      Allow `remove_foreign_key` with both `to_table` and `options` · fd18b98d
      Ryuta Kamizono 提交于
      Foreign keys could be created to the same table.
      So `remove_foreign_key :from_table, :to_table` is sometimes ambiguous.
      This allows `remove_foreign_key` to remove the select one on the same
      table with giving both `to_table` and `options`.
      fd18b98d
    • E
      Load YAML for rake tasks without parsing ERB · 37d1429a
      eileencodes 提交于
      This change adds a new method that loads the YAML for the database
      config without parsing the ERB. This may seem odd but bear with me:
      
      When we added the ability to have rake tasks for multiple databases we
      started looping through the configurations to collect the namespaces so
      we could do `rake db:create:my_second_db`. See #32274.
      
      This caused a problem where if you had `Rails.config.max_threads` set in
      your database.yml it will blow up because the environment that defines
      `max_threads` isn't loaded during `rake -T`. See #35468.
      
      We tried to fix this by adding the ability to just load the YAML and
      ignore ERB all together but that caused a bug in GitHub's YAML loading
      where if you used multi-line ERB the YAML was invalid. That led us to
      reverting some changes in #33748.
      
      After trying to resolve this a bunch of ways `@tenderlove` came up with
      replacing the ERB values so that we don't need to load the environment
      but we also can load the YAML.
      
      This change adds a DummyCompiler for ERB that will replace all the
      values so we can load the database yaml and create the rake tasks.
      Nothing else uses this method so it's "safe".
      
      DO NOT use this method in your application.
      
      Fixes #35468
      37d1429a
    • A
      [ci skip] Fix typo beacuse -> because · 66468568
      Abhay Nikam 提交于
      66468568
    • R
      Ensure `clear_cache!` clears the prepared statements cache · a67841eb
      Ryuta Kamizono 提交于
      Since #23461, all adapters supports prepared statements, so that clears
      the prepared statements cache is no longer database specific.
      
      Actually, I struggled to identify the cause of random CI failure in
      #23461, that was missing `@statements.clear` in `clear_cache!`.
      
      This extracts `clear_cache!` to ensure the common concerns in the
      abstract adapter.
      a67841eb
    • B
      Add insert_all to ActiveRecord models (#35077) · 91ed21b3
      Bob Lail 提交于
      Adds a method to ActiveRecord allowing records to be inserted in bulk without instantiating ActiveRecord models. This method supports options for handling uniqueness violations by skipping duplicate records or overwriting them in an UPSERT operation.
      
      ActiveRecord already supports bulk-update and bulk-destroy actions that execute SQL UPDATE and DELETE commands directly. It also supports bulk-read actions through `pluck`. It makes sense for it also to support bulk-creation.
      91ed21b3
  3. 05 3月, 2019 3 次提交
  4. 04 3月, 2019 6 次提交
  5. 03 3月, 2019 4 次提交
    • Y
      Remove unnecessary `current_adapter?(:OracleAdapter)` for index length · d7b61398
      Yasuo Honda 提交于
      Follow up #35455, there are two more test cases unnecessary `if current_adapter?(:OracleAdapter)`
      
      ```ruby
      $ ARCONN=oracle bin/test test/cases/associations/eager_test.rb -n test_include_has_many_using_primary_key
      Using oracle
      Run options: -n test_include_has_many_using_primary_key --seed 62842
      
      .
      
      Finished in 50.280024s, 0.0199 runs/s, 0.0398 assertions/s.
      1 runs, 2 assertions, 0 failures, 0 errors, 0 skips
      $
      ```
      
      ```
      $ ARCONN=oracle bin/test test/cases/migration/index_test.rb -n test_add_index
      Using oracle
      Run options: -n test_add_index --seed 52034
      
      .
      
      Finished in 13.152620s, 0.0760 runs/s, 0.0000 assertions/s.
      1 runs, 0 assertions, 0 failures, 0 errors, 0 skips
      $
      ```
      d7b61398
    • Y
      Oracle database can run `delete` statement with `order by` and`fetch first n rows only` · 417c2519
      Yasuo Honda 提交于
      Since https://github.com/rails/arel/pull/337 Oracle adapter uses better
      top N query using `fetch first n rows only`, which can remove this
      unless condition.
      
      * This commit passes with Oracle database
      ```ruby
      $ ARCONN=oracle bin/test test/cases/relation/delete_all_test.rb -n test_delete_all_with_order_and_limit_deletes_subset_only
      Using oracle
      Run options: -n test_delete_all_with_order_and_limit_deletes_subset_only --seed 1081
      
      .
      
      Finished in 8.068626s, 0.1239 runs/s, 0.6197 assertions/s.
      1 runs, 5 assertions, 0 failures, 0 errors, 0 skips
      $
      ```
      
      * SQL statement includes `ORDER BY` and `FETCH FIRST n ROWS ONLY`
      
      ```sql
        Post Destroy (12.5ms)  DELETE FROM "POSTS" WHERE "POSTS"."ID" IN (SELECT "POSTS"."ID" FROM "POSTS" WHERE "POSTS"."AUTHOR_ID" = :a1 ORDER BY "POSTS"."ID" ASC FETCH FIRST :a2 ROWS ONLY)  [["author_id", 1], ["LIMIT", 1]]
      ```
      417c2519
    • Y
      Rails `DateTime` type is mapped to Oracle `TIMESTAMP` since Rails 5.0 · df79aa31
      Yasuo Honda 提交于
      Kind of reverting https://github.com/rails/rails/commit/3a1cbc5c3b3bcb2de4be6e4469bb87b99759dc59
      
      ```
      From: test/cases/date_test.rb @ line 26 :
      
          21:
          22:     invalid_dates = [[2007, 11, 31], [1993, 2, 29], [2007, 2, 29]]
          23:
          24:     valid_dates.each do |date_src|
          25:       topic = Topic.new("last_read(1i)" => date_src[0].to_s, "last_read(2i)" => date_src[1].to_s, "last_read(3i)" => date_src[2].to_s)
       => 26:       binding.irb
          27:       assert_equal(topic.last_read, Date.new(*date_src))
          28:     end
          29:
          30:     invalid_dates.each do |date_src|
          31:       assert_nothing_raised do
      
      irb(#<DateTest:0x0000556618194668>):001:0> topic.last_read.class
      => Date
      ```
      
      Refer rsim/oracle-enhanced#845
      rails/rails#25897
      df79aa31
    • Y
      Oracle 12.2+ supports 128 byte identifier length · 2820c90a
      Yasuo Honda 提交于
      ```ruby
      $ ARCONN=oracle bin/test test/cases/migration/columns_test.rb -n test_rename_column_with_multi_column_index
      ... snip ...
      
      F
      
      Failure:
      ActiveRecord::Migration::ColumnsTest#test_rename_column_with_multi_column_index [/home/yahonda/git/rails/activerecord/test/cases/migration/columns_test.rb:113]:
      --- expected
      +++ actual
      @@ -1 +1 @@
      -["i_test_models_hat_style_size"]
      +["index_test_models_on_hat_style_and_size"]
      
      ```
      
      Kind of reverting #9395
      Refer https://github.com/rsim/oracle-enhanced/pull/1703
      2820c90a
  6. 02 3月, 2019 1 次提交
  7. 01 3月, 2019 6 次提交
  8. 28 2月, 2019 3 次提交
  9. 27 2月, 2019 2 次提交