aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
Commit message (Collapse)AuthorAgeFilesLines
* Consolidate database specific JSON types to `Type::Json`Ryuta Kamizono2017-05-302-29/+13
|
* Fix UUID column with `null: true` and `default: nil`Ryuta Kamizono2017-05-301-0/+10
| | | | | | | `quote_default_expression` can be passed nil value when `null: true` and `default: nil`. This addressed in that case. Fixes #29222.
* Prevent extra `current_database` query for `encoding`/`collation`/`ctype`Ryuta Kamizono2017-05-281-3/+9
|
* Merge pull request #29176 from bogdanvlviv/define-path-with__dir__Matthew Draper2017-05-261-1/+1
|\ | | | | Define path with __dir__
| * Define path with __dir__bogdanvlviv2017-05-231-1/+1
| | | | | | | | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* | Remove a duplicate test of schema_authorization_test in ARKoichi ITO2017-05-251-11/+0
| |
* | Extract `JSONSharedTestCases`Ryuta Kamizono2017-05-222-351/+7
|/ | | | | Both `mysql2/json_test.rb` and `postgresql/json_test.rb` have same test cases.
* Should escape meta characters in regexpRyuta Kamizono2017-05-077-15/+15
|
* Extract `bind_param` and `bind_attribute` into `ActiveRecord::TestCase`Ryuta Kamizono2017-05-045-23/+15
| | | | These are used in tests from anywhere.
* Revert "Merge pull request #27636 from ↵Rafael Mendonça França2017-04-261-107/+68
| | | | | | | | | mtsmfm/disable-referential-integrity-without-superuser-privilege-take-2" This reverts commit c1faca6333abe4b938b98fedc8d1f47b88209ecf, reversing changes made to 8c658a0ecc7f2b5fc015d424baf9edf6f3eb2b0b. See https://github.com/rails/rails/pull/27636#issuecomment-297534129
* 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.
* Use a query that's compatible with PostgreSQL 9.2Matthew Draper2017-04-121-3/+7
| | | | | | Also, explicitly apply the order: generate_subscripts is unlikely to start returning values out of order, but we should still be clear about what we want.
* Remove duplicated "test" prefixRyuta Kamizono2017-04-071-2/+2
|
* Merge pull request #28478 from kamipo/fix_primary_keys_across_multiple_schemasAndrew White2017-03-291-1/+2
|\ | | | | Fix `primary_keys` across multiple schemas
| * Fix `primary_keys` across multiple schemasRyuta Kamizono2017-03-201-1/+2
| | | | | | | | Fixes #28470.
* | Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser ↵Fumiaki MATSUSHIMA2017-03-261-68/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | privileges (take 2) Re-create https://github.com/rails/rails/pull/21233 eeac6151a5 was reverted (127509c071b4) because it breaks tests. ---------------- ref: 72c1557254 - We must use `authors` fixture with `author_addresses` because of its foreign key constraint. - Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
* | Merge pull request #28531 from yahonda/suppress_pg_warningMatthew Draper2017-03-231-0/+1
|\ \ | | | | | | Suppress `WARNING: nonstandard use of \\ in a string literal` warning
| * | Suppress `WARNING: nonstandard use of \\ in a string literal` warningYasuo Honda2017-03-221-0/+1
| |/ | | | | | | by setting `escape_string_warning = off`
* / [PostgreSQL]: Replace deprecated PG constants.Lars Kanis2017-03-221-4/+4
|/ | | | | The old top level classes PGconn, PGresult and PGError were deprecated since pg-0.13.0: https://github.com/ged/ruby-pg/blob/master/History.rdoc#v0130-2012-02-09-michael-granger-gedfaeriemudorg
* Merge pull request #28068 from kamipo/refactor_data_sourcesRafael França2017-03-131-4/+2
|\ | | | | Extract `data_source_sql` to refactor data source statements
| * Extract `data_source_sql` to refactor data source statementsRyuta Kamizono2017-02-201-4/+2
| |
* | Fix `deserialize` with JSON arrayRyuta Kamizono2017-03-061-0/+10
| | | | | | | | Fixes #28285.
* | `valid_type?` should accept only supported typesRyuta Kamizono2017-02-283-38/+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 ```
* | Use `max_identifier_length` for `index_name_length` in PostgreSQL adapterRyuta Kamizono2017-02-271-2/+1
| | | | | | | | | | Actually `index_name_length` depend on `max_identifier_length`, not always 63.
* | 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-262-1/+2
|\ \ \ | | | | | | | | Use ensure block for things we cleanup in tests
| * | | Use ensure block for things we cleanup in testsKir Shatrov2017-02-252-1/+2
| |/ /
* | | Extract `TypeCastingTest` into `test/cases/quoting_test.rb`Ryuta Kamizono2017-02-242-52/+0
| | |
* | | Fix `wait_timeout` to configurable for mysql2 adapterRyuta Kamizono2017-02-241-0/+16
| |/ |/| | | | | Fixes #26556.
* | Simplify and optimize Postgres query for primary_keys()Jordan Lewis2017-02-132-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | primary_keys(table) needs to query various metadata tables in Postgres to determine the primary key for the table. Previously, it did so using a complex common table expression against pg_constraint and pg_attribute. This patch simplifies the query by using information_schema tables. This simplifies the logic, making the query far easier to understand, and additionally avoids an expensive unnest, window function query, and common table expression.
* | Merge pull request #26655 from kamipo/fix_remove_expression_indexRafael França2017-02-131-2/+5
|\ \ | | | | | | Fix `remove_index` to be able to remove expression indexes
| * | Fix `remove_index` to be able to remove expression indexesRyuta Kamizono2016-12-251-2/+5
| | | | | | | | | | | | Fixes #26635, #26641.
* | | The `default` arg of `index_name_exists?` makes to optionalRyuta Kamizono2017-02-131-7/+7
| | | | | | | | | | | | | | | | | | The `default` arg of `index_name_exists?` is only used the adapter does not implemented `indexes`. But currently all adapters implemented `indexes` (See #26688). Therefore the `default` arg is never used.
* | | Schema dumping support for PostgreSQL oid typeRyuta Kamizono2017-02-121-1/+1
| | | | | | | | | | | | Closes #27980
* | | Schema dumping support for PostgreSQL interval typeRyuta Kamizono2017-02-121-2/+2
| | | | | | | | | | | | Closes #27979
* | | Add `Style/EmptyLinesAroundMethodBody` in `.rubocop.yml` and remove extra ↵Ryuta Kamizono2017-02-122-2/+0
| | | | | | | | | | | | empty lines
* | | Refactor `ColumnDefinition` to contain `options` hashRyuta Kamizono2017-02-093-6/+6
| | | | | | | | | | | | | | | | | | 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-063-173/+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-043-173/+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
* | Add assertion messagesAkira Matsuda2017-01-252-2/+2
| | | | | | | | | | This message could be generated by `assert_predicate`, https://github.com/rails/rails/commit/1853a4f2c8b2bddfbde6aae80abb08310295201c#commitcomment-20546113 but I'd rather handwrite the message string if I could reduce magic from the code by doing so.
* | 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.
* | assert_send is going to be deprecated since minitest 5.10.0Akira Matsuda2017-01-182-2/+2
| |
* | :warning: "Use assert_nil if expecting nil. This will fail in MT6."Akira Matsuda2017-01-181-3/+4
| | | | | | | | | | | | These are followups for 307065f959f2b34bdad16487bae906eb3bfeaf28, but TBH I'm personally not very much confortable with this style. Maybe we could override assert_equal in our test_helper not to warn?
* | 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
* | Merge pull request #27618 from kamipo/fix_uuid_default_nilKasper Timm Hansen2017-01-151-19/+36
|\ \ | | | | | | Fix UUID primary key with default nil in legacy migration
| * | Fix UUID primary key with default nil in legacy migrationRyuta Kamizono2017-01-091-0/+19
| | | | | | | | | | | | | | | | | | UUID primary key with no default value feature (#10404, #18206) was lost in legacy migration caused by #25395 got merged. Restore the feature again in legacy migration.