1. 10 10月, 2016 2 次提交
    • R
      `name` is not a column option · 24a1a6a8
      Ryuta Kamizono 提交于
      `migration_keys` includes `name` but `name` is not a column option.
      24a1a6a8
    • R
      Dump index options to pretty format · 5025fd3a
      Ryuta Kamizono 提交于
      ```ruby
        # Before
        t.index ["firm_id", "type", "rating"], name: "company_index", order: {"rating"=>:desc}, using: :btree
      
        # After
        t.index ["firm_id", "type", "rating"], name: "company_index", order: { rating: :desc }, using: :btree
      ```
      5025fd3a
  2. 08 10月, 2016 1 次提交
  3. 26 9月, 2016 2 次提交
    • A
      [ci skip] Update PG adapter documentation · 7caaee93
      Alex Kitchens 提交于
      Per discussion in pull request #26622:
      
      "Let's change it to PG::Error. The more specific classes mentioned are
      subclasses, and the fact the raised exception is a PG::UndefinedColumn
      doesn't change the fact that it's also a PG::Error." - matthewd
      7caaee93
    • A
      [ci skip] Clarify Postgresql Documentation · 65f694ff
      Alex Kitchens 提交于
      This clarifies the object that +ActiveRecord::Base.connection.execute+
      will return when using Postgresql.
      65f694ff
  4. 22 9月, 2016 1 次提交
  5. 16 9月, 2016 2 次提交
  6. 14 9月, 2016 1 次提交
  7. 08 9月, 2016 1 次提交
    • D
      activerecord/mysql2: Avoid setting @connection to nil, just close it · 01adc456
      Dylan Thacker-Smith 提交于
      By doing `@connection = nil` that means that we need nil checks before it
      is used anywhere, but we weren't doing those checks.  Instead, we get a
      NoMethodError after using a connection after it fails to reconnect.
      
      Neither of the other adapters set @connection to nil, just the mysql2
      adapter. By just closing it, we avoid the need to check if we have a
      connection object and it will produce an appropriate exception when used.
      01adc456
  8. 06 9月, 2016 1 次提交
  9. 02 9月, 2016 1 次提交
  10. 01 9月, 2016 3 次提交
    • S
      Remove deprecated handling of PG Points · b347156b
      Sean Griffin 提交于
      There are some minor changes to the point type as I had forgotten that
      this will affect the behavior of `t.point` in migrations and the schema
      dumper so we need to handle those as well.
      
      I'll say this again so I can convince myself to come up with a better
      structure... TYPES SHOULD NOT CARE ABOUT SCHEMA DUMPING AND WE NEED TO
      BETTER SEPARATE THESE.
      b347156b
    • S
      Revert "Extract `PredicateBuilder::CaseSensitiveHandler`" · 84efde74
      Sean Griffin 提交于
      This reverts commit 3a1f6fe7.
      
      This commit takes the code in a direction that I am looking to avoid.
      The predicate builder should be purely concerned with AST construction
      as it matters to methods like `where`. Things like case sensitivity
      should continue to be handled elsewhere.
      84efde74
    • S
      Attempt to maintain encoding for arrays of strings with PG · 7ba3a48d
      Sean Griffin 提交于
      I still think that this is something that should be handled in the pg
      gem, but it's not going to end up happening there so we'll do it here
      instead. Once we bump to pg 0.19 we can pass the encoding to the
      `encode` method instead.
      
      This issue occurs because C has no concept of encoding (or strings,
      really). The bytes that we pass here when sending the value to the
      database will always be interpreted as whatever encoding the connection
      is currently configured to use. That means that roundtripping to the
      database will lose no information
      
      However, after assigning we round trip through our type system without
      hitting the database. The only way that we can do the "correct" thin
      here would be to actually give a reference to the connection to the
      array type and have it check the current value of the connection's
      encoding -- which I'm strongly opposed to. We could also pass in the
      encoding when it's constructed, but since that can change independently
      of the type I'm not a huge fan of that either.
      
      This feels like a reasonable middle ground, where if we have an array of
      strings we simply use the encoding of the string we're given.
      
      Fixes #26326.
      7ba3a48d
  11. 26 8月, 2016 1 次提交
  12. 20 8月, 2016 1 次提交
  13. 19 8月, 2016 3 次提交
    • R
      Remove unused `blob_or_text_column?` method · 9e6a4553
      Ryuta Kamizono 提交于
      9e6a4553
    • R
      Revert "`sql_for_insert` returns values for passing to `exec_insert`" · 7db6bd7a
      Ryuta Kamizono 提交于
      This reverts #23067. #23067 is for propagating `pk` value from
      `sql_for_insert` to `exec_insert` (avoiding extra query for pg adapter).
      Now `exec_insert` includes `sql_for_insert` since #26002 therefore this
      propagating is no longer needed.
      7db6bd7a
    • R
      Remove text default treated as an empty string in non-strict mode · 99cb16a2
      Ryuta Kamizono 提交于
      Strict mode controls how MySQL handles invalid or missing values in
      data-change statements such as INSERT or UPDATE. If strict mode is not
      in effect, MySQL inserts adjusted values for invalid or missing values
      and produces warnings.
      
      ```ruby
        def test_mysql_not_null_defaults_non_strict
          using_strict(false) do
            with_mysql_not_null_table do |klass|
              record = klass.new
              assert_nil record.non_null_integer
              assert_nil record.non_null_string
              assert_nil record.non_null_text
              assert_nil record.non_null_blob
      
              record.save!
              record.reload
      
              assert_equal 0,  record.non_null_integer
              assert_equal "", record.non_null_string
              assert_equal "", record.non_null_text
              assert_equal "", record.non_null_blob
            end
          end
        end
      ```
      
      It is inconsistent with other types that only text/blob defaults treated
      as an empty string. This commit fixes the inconsistency.
      99cb16a2
  14. 18 8月, 2016 2 次提交
    • T
      Added nil case handling to allow rollback migration in case of · 906ff07e
      travis.h.oneill@gmail.com 提交于
      invalid column type
          /activerecord/lib/active_record/connection_adapters
          /abstract/schema_definitions.rb:306
          type = type.to_sym
      
      Changed to the following to handle nil case:
          type = type.to_sym if type
      
      Added regression test for this case:
        /activerecord/test/cases/migration_test.rb:554
        if current_adapter?(:SQLite3Adapter)
          def test_allows_sqlite3_rollback_on_invalid_column_type
            Person.connection.create_table :something, force: true do |t|
              t.column :number, :integer
              t.column :name, :string
              t.column :foo, :bar
            end
            assert Person.connection.column_exists?(:something, :foo)
            assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar }
            assert !Person.connection.column_exists?(:something, :foo)
            assert Person.connection.column_exists?(:something, :name)
            assert Person.connection.column_exists?(:something, :number)
          ensure
            Person.connection.drop_table :something, if_exists: true
          end
        end
      906ff07e
    • R
      Remove unnecessary `test_sql_for_insert_with_returning_disabled` · c48630b1
      Ryuta Kamizono 提交于
      Because `sql_for_insert` is only called in `use_insert_returning?` is
      true since #26002.
      c48630b1
  15. 16 8月, 2016 3 次提交
  16. 14 8月, 2016 2 次提交
  17. 10 8月, 2016 2 次提交
    • G
      Fix a NoMethodError schema_statements.rb · 01fbdb31
      Genadi Samokovarov 提交于
      If you call `remove_index` with wrong options, say a type, like I did,
      you get:
      
      ```
      == 20160810072541 RemoveUniqueIndexOnGoals: migrating =========================
      -- remove_index(:goal, {:coulmn=>:kid_id, :unique=>true})
      rails aborted!
      StandardError: An error has occurred, this and all later migrations canceled:
      
      undefined method `ArgumentError' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x007fb7dec91b28>
      ```
      
      What happened is that I mistyped column (coulmn) and got a
      `NoMethodError`, because of a missing comma during the raise. This made
      Ruby think we're calling the method `ArgumentError`.
      01fbdb31
    • R
      Fix broken alignments caused by auto-correct commit 411ccbda · f006de5d
      Ryuta Kamizono 提交于
      Hash syntax auto-correcting breaks alignments. 411ccbda
      f006de5d
  18. 07 8月, 2016 7 次提交
  19. 06 8月, 2016 2 次提交
  20. 05 8月, 2016 2 次提交