aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge pull request #29273 from ↵Rafael França2017-05-292-15/+0
|\ \ | | | | | | | | | | | | kamipo/deserialize_raw_value_from_database_for_json Deserialize a raw value from the database in `changed_in_place?` for `AbstractJson`
| * | Deserialize a raw value from the database in `changed_in_place?` for ↵Ryuta Kamizono2017-05-302-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | `AbstractJson` Structured type values sometimes caused representation problems (keys sort order, spaces, etc). A raw value from the database should be deserialized (normalized) to prevent the problems.
* | | Fix UUID column with `null: true` and `default: nil`Ryuta Kamizono2017-05-301-1/+1
|/ / | | | | | | | | | | | | `quote_default_expression` can be passed nil value when `null: true` and `default: nil`. This addressed in that case. Fixes #29222.
* | Merge pull request #29248 from yawboakye/rename-should-rename-table-pkeyGuillermo Iguaran2017-05-291-4/+5
|\ \ | | | | | | `rename_table` should rename primary key index name
| * | `rename_table` renames primary key index nameYaw Boakye2017-05-291-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Formerly, `rename_table` only renamed primary key index name if the column's data type was sequential (serial, etc in PostgreSQL). The problem with that is tables whose primary keys had other data types (e.g. UUID) maintained the old primary key name. So for example, if the `cats` table has a UUID primary key, and the table is renamed to `felines`, the primary key index will still be called `cats_pkey` instead of `felines_pkey`. This PR corrects it.
* | | Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-291-2/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
* | Prevent extra `current_database` query for `encoding`/`collation`/`ctype`Ryuta Kamizono2017-05-281-3/+3
| |
* | Merge pull request #29145 from kamipo/reference_type_should_be_not_nullMatthew Draper2017-05-241-1/+1
|\ \ | | | | | | Both reference id and type should be `NOT NULL` if `null: false` is specified
| * | Both reference id and type should be `NOT NULL` if `null: false` is specifiedRyuta Kamizono2017-05-191-1/+1
| |/ | | | | | | | | | | This is a regression due to #28282. Fixes #29136.
* / [Foreign Key] Don't worry about the building identifier if name is already ↵Mohit Natoo2017-05-101-2/+3
|/ | | | present.
* Merge pull request #28989 from matthewd/quoted_id-deprecationMatthew Draper2017-05-061-1/+8
|\ | | | | Clarify deprecation message for #quoted_id
| * Clarify deprecation message for #quoted_idMatthew Draper2017-05-051-1/+8
| | | | | | | | | | In this case, it's the method definition that's more at fault, rather than the current caller.
* | Don't pass `arel.engine` to `Arel::SelectManager.new`Ryuta Kamizono2017-05-051-6/+4
|/ | | | | | The argument of `Arel::SelectManager.new` is `table`, not `engine`. https://github.com/rails/arel/blob/v8.0.0/lib/arel/select_manager.rb#L10
* Deprecate `supports_statement_cache?`Ryuta Kamizono2017-05-014-20/+3
| | | | | | | | | | | | | | `supports_statement_cache?` was introduced in 3.1.0.beta1 (104d0b2) for bind parameter substitution, but it is no longer used in 3.1.0.rc1 (73ff679). Originally it should respect `prepared_statements` rather than `supports_statement_cache?` (fd39847). One more thing, named `supports_statement_cache?` is pretty misreading. We have `StatementCache` and `StatementPool`. However, `supports_statement_cache?` doesn't mean `StatementCache`, but `StatementPool` unlike its name. https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/statement_cache.rb https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/connection_adapters/statement_pool.rb
* Merge pull request #28883 from yahonda/fix28797Rafael França2017-04-261-1/+1
|\ | | | | PostgreSQL 10 does not convert `CURRENT_DATE` into `('now'::text)::date`
| * PostgreSQL 10 allows `CURRENT_DATE` and `CURRENT_TIMESTAMP` as default functionsYasuo Honda2017-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | Address #28797 In the previous versions of PostgreSQL, `CURRENT_DATE` converted to `('now'::text)::date` and `CURRENT_TIMESTAMP` converted to `now()`. Refer these discussions and commit at PostgreSQL : https://www.postgresql.org/message-id/flat/5878.1463098164%40sss.pgh.pa.us#5878.1463098164@sss.pgh.pa.us https://github.com/postgres/postgres/commit/0bb51aa96783e8a6c473c2b5e3725e23e95db834
* | Merge pull request #28891 from sodabrew/patch-1Rafael França2017-04-261-2/+0
|\ \ | | | | | | Remove mysql2 database adapter default username root
| * | Remove mysql2 database adapter default username rootAaron Stone2017-04-261-2/+0
| | |
* | | Revert "Merge pull request #27636 from ↵Rafael Mendonça França2017-04-262-49/+4
|/ / | | | | | | | | | | | | | | | | 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
* / Lock connection before checking it inMatthew Draper2017-04-261-6/+8
|/
* Fix typos [ci skip]Tobias Fankhänel2017-04-251-2/+2
| | | | | | | | | 'lookup' is the noun. 'to look up' is the verb. Looked it up just to be sure. cf. https://en.wiktionary.org/wiki/lookup https://en.wiktionary.org/wiki/look_up
* Merge pull request #28733 from kamipo/dont_fallback_to_utf8mb3_after_mysql_8.0.0Rafael França2017-04-192-8/+10
|\ | | | | Don't fallback to utf8mb3 after MySQL 8.0.0
| * Don't fallback to utf8mb3 after MySQL 8.0.0Ryuta Kamizono2017-04-172-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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.
* | Fix `extract_expression_for_virtual_column` for MariaDBRyuta Kamizono2017-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm not sure why `Mysql2VirtualColumnTest#test_schema_dumping` passed previously. But now the test not pass at least in MariaDB 10.1.9. I fixed the regexp to respect `COLLATE`. ``` % ARCONN=mysql2 be ruby -w -Itest test/cases/adapters/mysql2/virtual_column_test.rb -n test_schema_dumping Using mysql2 Run options: -n test_schema_dumping --seed 7131 F Finished in 0.466304s, 2.1445 runs/s, 4.2890 assertions/s. 1) Failure: Mysql2VirtualColumnTest#test_schema_dumping [test/cases/adapters/mysql2/virtual_column_test.rb:55]: Expected /t\.virtual\s+"upper_name",\s+type: :string,\s+as: "UPPER\(`name`\)"$/i to match "# This file is auto-generated from the current state of the database. Instead\n# of editing this file, please use the migrations feature of Active Record to\n# incrementally modify your database, and then regenerate this schema definition.\n#\n# Note that this schema.rb definition is the authoritative source for your\n# database schema. If you need to create the application database on another\n# system, you should be using db:schema:load, not running all the migrations\n# from scratch. The latter is a flawed and unsustainable approach (the more migrations\n# you'll amass, the slower it'll run and the greater likelihood for issues).\n#\n# It's strongly recommended that you check this file into your version control system.\n\nActiveRecord::Schema.define(version: 0) do\n\n create_table \"virtual_columns\", force: :cascade, options: \"ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci\" do |t|\n t.string \"name\"\n t.virtual \"upper_name\", type: :string, as: \n t.virtual \"name_length\", type: :integer, as: \"LENGTH(`name`)\", stored: true\n end\n\nend\n". 1 runs, 2 assertions, 1 failures, 0 errors, 0 skips ``` ``` > select @@version; +--------------------+ | @@version | +--------------------+ | 10.1.9-MariaDB-log | +--------------------+ 1 row in set (0.00 sec) ```
* | Use `quoted_scope` rather than `@config[:database]` to respect current databaseRyuta Kamizono2017-04-191-2/+3
| | | | | | | | Related #28399.
* | Fix the doc on the `IndexDefinition` [ci skip]Ryuta Kamizono2017-04-171-1/+1
|/ | | | Since 1a92ae83 all `indexes` methods are under the `SchemaStatements`.
* Support Descending Indexes for MySQLRyuta Kamizono2017-04-162-3/+2
| | | | | | | MySQL 8.0.1 and higher supports descending indexes: `DESC` in an index definition is no longer ignored. See https://dev.mysql.com/doc/refman/8.0/en/descending-indexes.html.
* Refactor `indexes` things in connection adaptersRyuta Kamizono2017-04-166-67/+114
| | | | | | | * Use keyword arguments in `IndexDefinition` to ease to ignore unused options and to avoid to initialize incorrect empty value. * Place it in `SchemaStatements` for consistency. * And tiny tweaks.
* Merge pull request #28726 from matthewd/transaction-lockingMatthew Draper2017-04-133-52/+70
|\ | | | | Add comprehensive locking around DB transactions
| * Add comprehensive locking around DB transactionsMatthew Draper2017-04-113-52/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transactional-fixture using tests with racing threads and inter-thread synchronisation inside transaction blocks will now deadlock... but without this, they would just crash. In 5.0, the threads didn't share a connection at all, so it would've worked... but with the main thread inside the fixture transaction, they wouldn't've been able to see each other. So: as far as I can tell, the set of operations this "breaks" never had a compelling use case. Meanwhile, it provides an increased level of coherency to the operational feel of transactional fixtures. If this does cause anyone problems, they're probably best off disabling transactional fixtures on the affected tests, and managing transactions themselves.
* | Use a query that's compatible with PostgreSQL 9.2Matthew Draper2017-04-121-7/+11
|/ | | | | | 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.
* Fix example usage of ActiveRecord::Base.establish_connectionSimon Dawson2017-03-301-1/+1
| | | `ActiveRecord::Base.establish_connection` accepts a single symbol argument to specify a named connection; a single string argument appears to be interpreted as a connection URI
* Merge pull request #28478 from kamipo/fix_primary_keys_across_multiple_schemasAndrew White2017-03-291-9/+7
|\ | | | | Fix `primary_keys` across multiple schemas
| * Fix `primary_keys` across multiple schemasRyuta Kamizono2017-03-201-9/+7
| | | | | | | | Fixes #28470.
* | Merge pull request #28052 from kamipo/make_internal_methods_to_privateRafael França2017-03-2811-184/+180
|\ \ | | | | | | Make internal methods to private
| * | Make internal methods to privateRyuta Kamizono2017-03-2711-184/+180
| | |
* | | Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser ↵Fumiaki MATSUSHIMA2017-03-262-4/+49
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Move comment to inside the method [ci skip]Fumiaki MATSUSHIMA2017-03-231-1/+1
| | | | | | | | | | | | Because this comment is not document for `supports_ranges?` ref: https://github.com/rails/rails/pull/27636#discussion_r107560081
* | Merge pull request #28526 from kamipo/fix_log_subscriber_to_allow_legacy_bindsRafael França2017-03-221-8/+7
|\ \ | | | | | | Fix `LogSubscriber` to allow legacy `binds`
| * | Fix `LogSubscriber` to allow legacy `binds`Ryuta Kamizono2017-03-231-8/+7
| | | | | | | | | | | | Follow up of #27939.
* | | [PostgreSQL]: Replace deprecated PG constants.Lars Kanis2017-03-225-16/+16
|/ / | | | | | | | | 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 #28487 from kamipo/remove_duplicated_columns_definitionRafael França2017-03-202-11/+5
|\ \ | | | | | | Remove duplicated `columns` definition
| * | Remove duplicated `columns` definitionRyuta Kamizono2017-03-202-11/+5
| |/
* | Merge pull request #27939 from kamipo/fix_select_all_with_legacy_bindsRafael França2017-03-201-1/+5
|\ \ | |/ |/| Fix `select_all` with legacy `binds`
| * Fix `select_all` with legacy `binds`Ryuta Kamizono2017-02-121-1/+5
| | | | | | | | Fixes #27923.
* | Revert "Merge pull request #28369 from ↵Matthew Draper2017-03-141-2/+2
| | | | | | | | | | | | | | | | | | mylake/reduce-postgresql-adapter-memory-bloat" This reverts commit 192db64452d148c7b51713979459e38407380dc6, reversing changes made to 9893955363cf6358556ed3b36f4538d5b54e9d17. We can't sacrifice correctness for performance.
* | Merge pull request #28369 from mylake/reduce-postgresql-adapter-memory-bloatRafael França2017-03-131-2/+2
|\ \ | | | | | | 500x memory reduction of 10k schemas for postgresql adapter
| * | Use “distinct” to filter redundant types from pg_typeto reduce memory ↵mylake2017-03-101-2/+2
| | | | | | | | | | | | bloat especially in multi-schema structure database
* | | Merge pull request #28068 from kamipo/refactor_data_sourcesRafael França2017-03-137-201/+154
|\ \ \ | | | | | | | | Extract `data_source_sql` to refactor data source statements
| * | | Prefer `USING (column_list)` for joining information_schemaRyuta Kamizono2017-02-251-3/+1
| | | |