aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #29869 from kamipo/make_type_map_to_privateRafael França2017-07-212-7/+7
|\ | | | | Make `type_map` to private because it is only used in the connection adapter
| * Make `type_map` to private because it is only used in the connection adapterRyuta Kamizono2017-07-202-7/+7
| | | | | | | | | | | | | | `type_map` is an internal API and it is only used in the connection adapter. And also, some type map initializer methods requires passed `type_map`, but those instances already has `type_map` in itself. So we don't need explicit passing `type_map` to the initializers.
* | Merge pull request #29732 from kirs/frozen-activerecordRafael França2017-07-2168-0/+136
|\ \ | | | | | | Use frozen-string-literal in ActiveRecord
| * | Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-1968-0/+136
| |/
* / Revert "Extract `bind_param` and `bind_attribute` into `ActiveRecord::TestCase`"Sean Griffin2017-07-215-15/+23
|/ | | | | | | | This reverts commit b6ad4052d18e4b29b8a092526c2beef013e2bf4f. This is not something that the majority of Active Record should be testing or care about. We should look at having fewer places rely on these details, not make it easier to rely on them.
* Merge pull request #29033 from kamipo/make_preload_query_to_prepared_statementsSean Griffin2017-07-182-2/+2
|\ | | | | Make preload query to preparable
| * Make preload query to preparableRyuta Kamizono2017-07-072-2/+2
| | | | | | | | | | | | | | Currently preload query cannot be prepared statements even if `prepared_statements: true` due to array handler in predicate builder doesn't support making bind params. This makes preload query to preparable by don't passing array value if possible.
* | Change sqlite3 boolean serialization to use 1 and 0Lisa Ugray2017-07-112-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Abstract boolean serialization has been using 't' and 'f', with MySQL overriding that to use 1 and 0. This has the advantage that SQLite natively recognizes 1 and 0 as true and false, but does not natively recognize 't' and 'f'. This change in serialization requires a migration of stored boolean data for SQLite databases, so it's implemented behind a configuration flag whose default false value is deprecated. The flag itself can be deprecated in a future version of Rails. While loaded models will give the correct result for boolean columns without migrating old data, where() clauses will interact incorrectly with old data. While working in this area, also change the abstract adapter to use `"TRUE"` and `"FALSE"` as quoted values and `true` and `false` for unquoted. These are supported by PostreSQL, and MySQL remains overriden.
* | Merge pull request #29715 from reverbdotcom/ptd/fix-invalid-uuidsMatthew Draper2017-07-091-1/+3
|\ \ | | | | | | Don't allow uuids with orphan curly braces
| * | Don't allow uuids with orphan curly bracespdebelak2017-07-071-1/+3
| |/ | | | | | | | | | | | | | | The uuid validation regex was allowing uuids to have a single leading curly brace or single trailing curly brace. Saving with such a uuid would cause Postgres to generate an exception even though the record seemed valid. With this change, the regex requires both a leading *and* a trailing curly brace or neither to be valid.
* / 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-0268-68/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-0268-0/+68
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-0168-0/+68
| |
* | Merge pull request #29506 from pat/frozen-string-literalsMatthew Draper2017-07-023-8/+8
|\ \ | |/ |/| | | Make ActiveSupport frozen-string-literal friendly.
| * Make ActiveRecord frozen string literal friendly.Pat Allan2017-06-203-8/+8
| |
* | Use bulk INSERT to insert fixturesKir Shatrov2017-06-201-0/+6
|/ | | | | | | | Improves the performance from O(n) to O(1). Previously it would require 50 queries to insert 50 fixtures. Now it takes only one query. Disabled on sqlite which doesn't support multiple inserts.
* Allow `uuid_test.rb` to be loaded on all adaptersEugene Kenny2017-06-141-1/+2
| | | | | | | | | Running `bin/test` from the activerecord directory produces this error: test/cases/adapters/postgresql/uuid_test.rb:43:in `<class:PostgresqlUUIDTest>': undefined method `supports_pgcrypto_uuid?' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x007fc405e72a68> (NoMethodError) The test only actually runs on the PostgreSQL adapter; we can avoid triggering the error on other adapters with this `respond_to?` guard.
* Merge pull request #28868 from yahonda/pg10_oid_unknown_to_textMatthew Draper2017-06-071-8/+8
|\ | | | | PostgreSQL 10 converts unknown type to text type
| * PostgreSQL 10 converts unknown OID 705 to text 25Yasuo Honda2017-06-061-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Rename test cases from `unknown` to `unrecognized` since unknown OID is one of possible unrecognized types by Rails - Use "select 'pg_catalog.pg_class'::regclass" whose OID is 2205, which will not be converted to recognized type in PostgreSQL 10. activerecord_unittest=# select oid, typname from pg_type where oid in (2205, 2277); oid | typname ------+---------- 2205 | regclass 2277 | anyarray (2 rows) Addresses #28868
* | Remove redundant `assert_nothing_raised` before another assertionsRyuta Kamizono2017-06-061-2/+0
|/ | | | These `assert_nothing_raised` are covered by following assertions.
* 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.
* Remove assert_nothing_raised, as test is already testing the required concernsPrathamesh Sonpatki2017-06-031-3/+3
|
* 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