aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql2
Commit message (Collapse)AuthorAgeFilesLines
* `valid_type?` should accept only supported typesRyuta Kamizono2017-02-281-11/+0
| | | | | | | | | | | | | | | | | | | | `valid_type?` is used in schema dumper to determine if a type is supported. So if `valid_type?(:foobar)` is true, it means that schema dumper is allowed to create `t.foobar`. But it doesn't work. I think that `valid_type?` should accept only supported types. https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/schema_dumper.rb#L135-L142 ```ruby columns.each do |column| raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type) next if column.name == pk type, colspec = @connection.column_spec(column) tbl.print " t.#{type} #{column.name.inspect}" tbl.print ", #{format_colspec(colspec)}" if colspec.present? tbl.puts end ```
* Merge pull request #28167 from kirs/deprecate-verify-argsMatthew Draper2017-02-261-0/+12
|\ | | | | Deprecate AbstractAdapter#verify! with arguments
| * Deprecate AbstractAdapter#verify! with argumentsKir Shatrov2017-02-251-0/+12
| |
* | Merge pull request #28169 from kirs/ensure-conn-verifyMatthew Draper2017-02-261-1/+1
|\ \ | | | | | | Use ensure block for things we cleanup in tests
| * | Use ensure block for things we cleanup in testsKir Shatrov2017-02-251-1/+1
| |/
* | Fix `wait_timeout` to configurable for mysql2 adapterRyuta Kamizono2017-02-241-0/+16
| | | | | | | | Fixes #26556.
* | Refactor `ColumnDefinition` to contain `options` hashRyuta Kamizono2017-02-091-2/+2
| | | | | | | | | | | | Column options are passed as an hash args then used as `options` hash in `add_column_options!`. Converting args to attributes is inconvinient for using options as an hash.
* | Merge pull request #27389 from kamipo/fix_mysql_pk_dumping_correctlyJeremy Daer2017-02-061-60/+0
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Restore the behaviour of the compatibility layer for integer-like PKs * kamipo/fix_mysql_pk_dumping_correctly: Restore custom primary key tests lost at #26266 Restore the behaviour of the compatibility layer for integer-like PKs Correctly dump integer-like primary key with default nil
| * | Restore the behaviour of the compatibility layer for integer-like PKsRyuta Kamizono2017-02-041-60/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PR #27384 changed migration compatibility behaviour. ```ruby class CreateMasterData < ActiveRecord::Migration[5.0] def change create_table :master_data, id: :integer do |t| t.string :name end end end ``` Previously this migration created non-autoincremental primary key expected. But after the PR, the primary key changed to autoincremental, it is unexpected. This change restores the behaviour of the compatibility layer.
* / Correct spellingBenjamin Fleischer2017-02-052-3/+3
|/ | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* Virtual/generated column support for MySQL 5.7.5+ and MariaDB 5.2.0+Ryuta Kamizono2017-02-012-8/+74
| | | | | | | | | | | | | | | | | | | MySQL generated columns: https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html MariaDB virtual columns: https://mariadb.com/kb/en/mariadb/virtual-computed-columns/ Declare virtual columns with `t.virtual name, type: …, as: "expression"`. Pass `stored: true` to persist the generated value (false by default). Example: create_table :generated_columns do |t| t.string :name t.virtual :upper_name, type: :string, as: "UPPER(name)" t.virtual :name_length, type: :integer, as: "LENGTH(name)", stored: true t.index :name_length # May be indexed, too! end Closes #22589
* Deprecate `initialize_schema_migrations_table` and ↵Ryuta Kamizono2017-01-201-2/+2
| | | | | | `initialize_internal_metadata_table` These internal initialize methods are no longer used internally.
* Revert "Merge pull request #27718 from kamipo/remove_internal_public_methods"Matthew Draper2017-01-201-2/+2
| | | | | This reverts commit 39c77eb1843f79925c7195e8869afc7cb7323682, reversing changes made to 9f6f51be78f8807e18fc6562c57af2fdbf8ccb56.
* Remove `initialize_schema_migrations_table` and ↵Ryuta Kamizono2017-01-181-2/+2
| | | | | | | | | | | | `initialize_internal_metadata_table` internal public methods These internal methods accidentally appeared in the doc, and so almost useless. It is enough to create these internal tables directly, and indeed do so in several places. https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/schema.rb#L55 https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/railties/databases.rake#L6 https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/tasks/database_tasks.rb#L230
* activerecord/test: Fix Mysql2ConnectionTest#test_execute_after_disconnectDylan Thacker-Smith2017-01-091-1/+2
| | | | | | | | | | | | | Mysql2ConnectionTest#test_execute_after_disconnect was originally added to catch a NoMethodError occuring in execute when the Mysql2Adapter has a nil `@connection`. Pull request #26869 removed the error message check in that test because the error message changed in the mysql2 gem, which caused the test to fail. Now the test wouldn't catch the original bug since the NoMethodError would get turned into a ActiveRecord::StatementInvalid exception. Check the cause of the StatementInvalid exception to make sure it is of the correct type.
* "Use assert_nil if expecting nil from ...:in `...'. This will fail in MT6."Akira Matsuda2016-12-251-2/+2
|
* Privatize unneededly protected methods in Active Record testsAkira Matsuda2016-12-241-1/+1
|
* Merge pull request #27329 from kamipo/simplify_unsigned_regexEileen M. Uchitelle2016-12-171-1/+1
|\ | | | | Simplify the regex for `unsigned?` method
| * Simplify the regex for `unsigned?` methodRyuta Kamizono2016-12-111-1/+1
| | | | | | | | | | It is enough to distinguish only the trailing `unsigned` and `unsigned zerofill`.
* | fix new warning in ruby 2.4yuuji.yaginuma2016-12-141-1/+1
|/ | | | | | | | | | | | | | This fixes the following warning. ``` test/caching_test.rb:986: warning: parentheses after method name is interpreted as test/caching_test.rb:986: warning: an argument list, not a decomposed argument test/cases/adapters/mysql2/reserved_word_test.rb:146: warning: parentheses after method name is interpreted as test/cases/adapters/mysql2/reserved_word_test.rb:146: warning: an argument list, not a decomposed argument ``` Ref: https://github.com/ruby/ruby/commit/65e27c8b138d6959608658ffce2fa761842b8d24
* Translate numeric value out of range to the specific exceptionRyuta Kamizono2016-12-061-2/+2
| | | | Raise `ActiveRecord::RangeError` when values that executed are out of range.
* Merge pull request #26687 from kamipo/fix_add_index_to_normalize_optionsMatthew Draper2016-12-061-0/+3
|\ | | | | Fix `add_index` to normalize column names and options
| * Fix `add_index` to normalize column names and optionsRyuta Kamizono2016-10-031-0/+3
| | | | | | | | | | | | | | | | | | | | Currently does not work the following code. ```ruby add_index(:people, ["last_name", "first_name"], order: { last_name: :desc, first_name: :asc }) ``` Normalize column names and options to fix the issue.
* | Make pg adapter use bigserial for pk by defaultPavel Pravosud2016-12-052-0/+73
| |
* | Fix that unsigned with zerofill is treated as signedRyuta Kamizono2016-11-271-0/+1
| | | | | | | | Fixes #27125.
* | abort_on_exception can't be disabled for a single threadMatthew Draper2016-11-271-2/+4
| | | | | | | | | | If it's enabled globally, it's on regardless of how individual threads are set.
* | We expect exceptions; abort will just raise in the wrong placeMatthew Draper2016-11-271-9/+13
| |
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-294-13/+13
| |
* | Use Regexp#match? rather than Regexp#===Ryuta Kamizono2016-10-261-1/+1
| | | | | | | | Follow up to 99cf7558000090668b137085bfe6bcc06c4571dc.
* | Fix brittle tests which were relying on the error message text from mysql2 gemPrathamesh Sonpatki2016-10-231-4/+4
| | | | | | | | | | | | | | - These tests were fixed earlier on master in https://github.com/rails/rails/commit/f13ec72664fd13d33d617103ca964a7592295854. - They started failing in first place due to change in https://github.com/brianmario/mysql2/commit/f14023fcfee9e85e6fc1b0e568048811518f8c23. - They will fail again when the message is changed in mysql2 so let's not rely on the error message.
* | Update mysql adapter error message when disconnectedGuillermo Iguaran2016-10-221-2/+2
|/
* Serialize JSON attribute value nil as SQL NULL, not JSON 'null'Trung Duc Tran2016-09-231-0/+16
| | | | | | Test: JSON attribute value nil can be used in where(attr: nil) Add changelog entry
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-3/+3
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Address `warning: ambiguous first argument; put parentheses or a space even ↵Yasuo Honda2016-09-131-2/+2
| | | | after `/' operator`
* activerecord/mysql2: Avoid setting @connection to nil, just close itDylan Thacker-Smith2016-09-081-0/+21
| | | | | | | | | | 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.
* Remove unused `blob_or_text_column?` methodRyuta Kamizono2016-08-191-5/+0
|
* Add three new rubocop rulesRafael Mendonça França2016-08-165-21/+21
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-062-2/+1
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-065-168/+168
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-062-9/+9
|
* modernizes hash syntax in activerecordXavier Noria2016-08-065-34/+34
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-0618-149/+149
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* The problem isn't the detection but the deadlock itselfDavid Heinemeier Hansson2016-08-041-2/+2
|
* Merge pull request #25107 from Erol/introduce-new-ar-transaction-error-classesRafael Mendonça França2016-08-031-20/+13
|\ | | | | | | | | | | Introduce new ActiveRecord transaction error classes Closes #26018
| * Introduce new ActiveRecord transaction error classesErol Fornoles2016-05-241-20/+13
| |
* | Extract foreign key action from `information_schema`Ryuta Kamizono2016-06-071-0/+21
| | | | | | | | Fixes #25300.
* | Do not include default column limit in schema.rbRyuta Kamizono2016-05-311-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up of #20815. ```ruby class CreatePeople < ActiveRecord::Migration[5.0] def change create_table :people do |t| t.integer :int t.bigint :bint t.text :txt t.binary :bin end end end ``` Result. In postgresql and sqlite3 adapters: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade do |t| t.integer "int" t.bigint "bint" t.text "txt" t.binary "bin" end end ``` In mysql2 adapter: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "int" t.bigint "bint" t.text "txt", limit: 65535 t.binary "bin", limit: 65535 end end ``` After this patch: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "int" t.bigint "bint" t.text "txt" t.binary "bin" end end ```
* Add AR::TransactionSerializationError for transaction serialization failures ↵Erol Fornoles2016-05-211-0/+62
| | | | or deadlocks
* Should quote `lock_name` to pass to `get_advisory_lock`Ryuta Kamizono2016-05-101-3/+3
|
* Followup of #24835Vipul A M2016-05-031-2/+2
| | | | Fix failing tests