aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql2
Commit message (Collapse)AuthorAgeFilesLines
* Remove passing needless empty string `options` in `create_table`Ryuta Kamizono2017-12-201-3/+3
| | | | Follow up of #31177.
* Merge pull request #31177 from ↵Matthew Draper2017-12-202-3/+78
|\ | | | | | | | | albertoalmagro/remove-default-mysql-engine-from-ar-5-2 Remove default ENGINE=InnoDB for Mysql2 adapter
| * Remove default ENGINE=InnoDB for Mysql2 adapterAlberto Almagro2017-12-112-3/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit ENGINE=InnoDB was added by default to Mysql2 adapter +create_table+ if no +options+ option was provided. This default ENGINE was lost as soon as something was passed in at +options+ option, making its goal and propagation inconsistent, as the programmer needed to remember including ENGINE=InnoDB when something was passed in. This commit removes default ENGINE as its use isn't needed anymore for current MySQL and MariaDB versions. It adds compatibility support and tests to ensure that default ENGINE is still present for migrations with version 5.1 and before. It also ensures we still dump the ENGINE option to +schema.rb+ in order to avoid inconsistencies.
* | Suppress expected exceptions by `report_on_exception` = `false`Yasuo Honda2017-12-141-0/+2
|/ | | | Follow up #31428 to address similar exceptions with mysql2 adapter
* Merge pull request #31230 from dinahshi/postgresql_extract_sqlMatthew Draper2017-12-031-2/+2
|\ | | | | Extract sql fragment generators from PostgreSQL adapter
| * Extract sql fragment generators for alter table from PostgreSQL adapterDinah Shi2017-12-021-2/+2
| |
* | Add new error class `QueryCanceled` which will be raised when canceling ↵Ryuta Kamizono2017-11-271-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | statement due to user request (#31235) This changes `StatementTimeout` to `QueryCanceled` for PostgreSQL. In MySQL, errno 1317 (`ER_QUERY_INTERRUPTED`) is only used when the query is manually cancelled. But in PostgreSQL, `QUERY_CANCELED` error code (57014) which is used `StatementTimeout` is also used when the both case. And, we can not tell which reason happened. So I decided to introduce new error class `QueryCanceled` closer to the error code name.
* | Rename `TransactionTimeout` to more descriptive `LockWaitTimeout` (#31223)Ryuta Kamizono2017-11-271-2/+2
|/ | | | | | Since #31129, new error class `StatementTimeout` has been added. `TransactionTimeout` is caused by the timeout shorter than `StatementTimeout`, but its name is too generic. I think that it should be a name that understands the difference with `StatementTimeout`.
* Merge pull request #30980 from sobrinho/sobrinho/arel-star-ignored-columnsRafael França2017-11-131-11/+11
|\ | | | | Do not use `Arel.star` when `ignored_columns`
| * Change tests to use models which don't ignore any columnsJon Moss2017-11-131-11/+11
| |
* | Add new error class `StatementTimeout` which will be raised when statement ↵Ryuta Kamizono2017-11-131-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | timeout exceeded (#31129) We are sometimes using The MAX_EXECUTION_TIME hint for MySQL depending on the situation. It will prevent catastrophic performance down by wrong performing queries. The new error class `StatementTimeout` will make to be easier to handle that case. https://dev.mysql.com/doc/refman/5.7/en/optimizer-hints.html#optimizer-hints-execution-time
* | Raise `TransactionTimeout` when lock wait timeout exceeded for PG adapterRyuta Kamizono2017-11-111-1/+1
| | | | | | | | Follow up of #30360.
* | Should test actual error which is raised from the databaseRyuta Kamizono2017-11-111-1/+23
| |
* | Enable `Style/RedundantReturn` rubocop rule, and fixed a couple moreRyuta Kamizono2017-11-011-1/+1
|/ | | | Follow up of #31004.
* Remove deprecated arguments from `#verify!`Rafael Mendonça França2017-10-231-12/+0
|
* MySQL: Don't lose `auto_increment: true` in the `db/schema.rb`Ryuta Kamizono2017-10-151-0/+34
| | | | | | | | | | Currently `AUTO_INCREMENT` is implicitly used in the default primary key definition. But `AUTO_INCREMENT` is not only used for single column primary key, but also for composite primary key. In that case, `auto_increment: true` should be dumped explicitly in the `db/schema.rb`. Fixes #30894.
* Omit the default limit for float columns (#28041)Ryuta Kamizono2017-08-271-1/+1
|
* Prefer to place a table options before `force: :cascade` (#28005)Ryuta Kamizono2017-08-271-4/+4
| | | | | | I was added a table options after `force: :cascade` in #17569 for not touching existing tests (reducing diff). But `force: :cascade` is not an important information. So I prefer to place a table options before `force: :cascade`.
* Merge pull request #30360 from gcourtemanche/transaction_timedoutRafael França2017-08-221-0/+6
|\ | | | | Add TransactionTimeout for MySQL error code 1205
| * Add TransactionTimeout for MySQL error code 1205Gabriel Courtemanche2017-08-221-0/+6
| |
* | Update links to use https instead of http [ci skip]Yoshiyuki Hirano2017-08-221-1/+1
|/
* Merge remote-tracking branch 'origin/master' into unlock-minitestRafael Mendonça França2017-08-0119-0/+38
|\
| * Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-1919-0/+38
| |
* | Merge pull request #29380 from ↵Kasper Timm Hansen2017-07-151-0/+4
|\ \ | |/ |/| | | | | y-yagi/insert_environment_value_to_table_before_check_environment Insert environment value to `InternalMetadata` table before check environment
| * Insert environment value to `InternalMetadata` after recreating the tableyuuji.yaginuma2017-06-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes `ActiveRecord::DatabaseTasksUtilsTask#test_raises_an_error_when_called_with_protected_environment` test fails. https://travis-ci.org/rails/rails/jobs/238861562 https://travis-ci.org/rails/rails/jobs/239950092 There seems to be an error because `environment` value is not exist. This is because did not set the environment after recreating the table in `SchemaMigrationsTest#test_initializes_internal_metadata_for_encoding_utf8mb4`. Therefore, we create value after the test to maintain the original state.
* | Use `information_schema` to extract `generation_expression` for MariaDBRyuta Kamizono2017-07-071-1/+1
| | | | | | | | | | | | Since MariaDB 10.2.5, `information_schema` supports Virtual Columns. Fixes #29670.
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0219-19/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* | Enforce frozen string in RubocopKir Shatrov2017-07-0119-0/+19
| |
* | Testing `ReservedWordTest` for all adaptersRyuta Kamizono2017-06-051-151/+0
|/ | | | | `ReservedWordTest` expects that any identifiers are quoted properly. It should be tested for all adapters.
* Consolidate database specific JSON types to `Type::Json`Ryuta Kamizono2017-05-301-11/+4
|
* Extract `JSONSharedTestCases`Ryuta Kamizono2017-05-221-171/+5
| | | | | Both `mysql2/json_test.rb` and `postgresql/json_test.rb` have same test cases.
* Should escape meta characters in regexpRyuta Kamizono2017-05-072-6/+6
|
* Don't fallback to utf8mb3 after MySQL 8.0.0Ryuta Kamizono2017-04-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `internal_string_options_for_primary_key` is used for creating internal tables in newly apps. But it is no longer needed after MySQL 8.0.0. MySQL 5.7 has introduced `innodb_default_row_format` (default `DYNAMIC`) and has deprecated `innodb_large_prefix` and `innodb_file_format`. The purpose of the deprecated options was for compatibility with earlier versions of InnoDB. https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_large_prefix > innodb_large_prefix is deprecated and will be removed in a future release. innodb_large_prefix was introduced in MySQL 5.5 to disable large index key prefixes for compatibility with earlier versions of InnoDB that do not support large index key prefixes. https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_file_format > The innodb_file_format option is deprecated and will be removed in a future release. The purpose of the innodb_file_format option was to allow users to downgrade to the built-in version of InnoDB in MySQL 5.1. Now that MySQL 5.1 has reached the end of its product lifecycle, downgrade support provided by this option is no longer necessary. The deprecated options has removed in MySQL 8.0.0. It is no longer needed to take care newly created internal tables as a legacy format after MySQL 8.0.0. Fixes #28730.
* Remove duplicated "test" prefixRyuta Kamizono2017-04-071-2/+2
|
* `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
|