aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Added docs for TableDefinition #coloumns & #remove_column [ci skip]sjain11072015-08-181-0/+3
|/ / /
* / / descriptive error message when fixtures contian a missing column.Yves Senn2015-08-131-2/+6
|/ / | | | | | | Closes #21201.
* | Fixes documentation typo.Дмитро Будник2015-07-231-2/+2
| | | | | | Documentation had extra colon after keyword.
* | Revert "Revert "Reduce allocations when running AR callbacks.""Guo Xiang Tan2015-07-161-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bdc1d329d4eea823d07cf010064bd19c07099ff3. Before: Calculating ------------------------------------- 22.000 i/100ms ------------------------------------------------- 229.700 (± 0.4%) i/s - 1.166k Total Allocated Object: 9939 After: Calculating ------------------------------------- 24.000 i/100ms ------------------------------------------------- 246.443 (± 0.8%) i/s - 1.248k Total Allocated Object: 7939 ``` begin require 'bundler/inline' rescue LoadError => e $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' raise e end gemfile(true) do source 'https://rubygems.org' # gem 'rails', github: 'rails/rails', ref: 'bdc1d329d4eea823d07cf010064bd19c07099ff3' gem 'rails', github: 'rails/rails', ref: 'd2876141d08341ec67cf6a11a073d1acfb920de7' gem 'arel', github: 'rails/arel' gem 'sqlite3' gem 'benchmark-ips' end require 'active_record' require 'benchmark/ips' ActiveRecord::Base.establish_connection('sqlite3::memory:') ActiveRecord::Migration.verbose = false ActiveRecord::Schema.define do create_table :users, force: true do |t| t.string :name, :email t.boolean :admin t.timestamps null: false end end class User < ActiveRecord::Base default_scope { where(admin: true) } end admin = true 1000.times do attributes = { name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", email: "foobar@email.com", admin: admin } User.create!(attributes) admin = !admin end GC.disable Benchmark.ips(5, 3) do |x| x.report { User.all.to_a } end key = if RUBY_VERSION < '2.2' :total_allocated_object else :total_allocated_objects end before = GC.stat[key] User.all.to_a after = GC.stat[key] puts "Total Allocated Object: #{after - before}" ```
* Merge pull request #20699 from ↵Rafael Mendonça França2015-06-271-1/+4
|\ | | | | | | | | vngrs/foreign_key_with_table_name_suffix_and_prefix Add table name prefix and suffix support for foreign keys
| * Add table name prefix and suffix support to add_foreign_key and ↵Mehmet Emin İNAÇ2015-06-251-1/+4
| | | | | | | | | | | | remove_foreign_key methods fix tests
* | Add reversible syntax for change_column_defaultPrem Sichanugrist2015-06-262-3/+17
|/ | | | | | | | | | | | | Passing `:from` and `:to` to `change_column_default` makes this command reversible as user has defined its previous state. So, instead of having the migration command as: change_column_default(:posts, :state, "draft") They can write it as: change_column_default(:posts, :state, from: nil, to: "draft")
* make `remove_index :table, :column` reversible.Yves Senn2015-06-151-1/+1
| | | | | | | | | This used to raise a `IrreversibleMigration` error (since #10437). However since `remove_index :table, :column` is probably the most basic use-case we should make it reversible again. Conflicts: activerecord/CHANGELOG.md
* Merge pull request #20226 from EpicH0liday/reversible-remove-foreign-keyYves Senn2015-06-121-1/+5
|\ | | | | | | | | | | | | Make remove_foreign_key reversible Conflicts: activerecord/CHANGELOG.md
| * Add an invert method for remove_foreign_keyAster Ryan2015-06-111-1/+6
|/
* A few documentation tweaks [ci skip]Robin Dupret2015-06-071-1/+1
| | | | [Robin Dupret & Shunsuke Aida]
* Updated postgresql documentation link to use latest version [ci skip]Ronak Jangir2015-05-201-1/+1
|
* Remove unused already requireRyuta Kamizono2015-05-191-4/+0
|
* Merge pull request #20175 from eugeneius/copy_schema_cache_after_forkRafael Mendonça França2015-05-181-1/+3
|\ | | | | Add schema cache to new connection pool after fork
| * Add schema cache to new connection pool after forkEugene Kenny2015-05-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Active Record detects when the process has forked and automatically creates a new connection pool to avoid sharing file descriptors. If the existing connection pool had a schema cache associated with it, the new pool should copy it to avoid unnecessarily querying the database for its schema. The code to detect that the process has forked is in ConnectionHandler, but the existing test for it was in the ConnectionManagement test file. I moved it to the right place while I was writing the new test for this change.
* | Merge pull request #20192 from kamipo/divide_to_column_options_handling_methodsRafael Mendonça França2015-05-181-4/+24
|\ \ | | | | | | Divide methods for handling column options separately
| * | Divide methods for handling column options separatelyRyuta Kamizono2015-05-181-4/+24
| |/
* / better `add_reference` documentation. [ci skip]Yves Senn2015-05-182-20/+18
|/ | | | | | | | | This patch - reduces the duplication among the `reference`-family methods. - better explains all the optians available for `add_reference`. - redirects to user from `references` to `add_reference`. Originated by #20184.
* Merge pull request #14938 from thedarkone/pool-lock-fixMatthew Draper2015-05-161-80/+394
|\ | | | | Reducing AR::ConPool's critical (synchronized) section
| * AR::ConPool - remove synchronization around connection cache.thedarkone2015-05-141-79/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renamed `@reserved_connections` -> `@thread_cached_conns`. New name clearly conveys the purpose of the cache, which is to speed-up `#connection` method. The new `@thread_cached_conns` now also uses `Thread` objects as keys (instead of previously `Thread.current.object_id`). Since there is no longer any synchronization around `@thread_cached_conns`, `disconnect!` and `clear_reloadable_connections!` methods now pre-emptively obtain ownership (via `checkout`) of all existing connections, before modifying internal data structures. A private method `release` has been renamed `thread_conn_uncache` to clear-up its purpose. Fixed some brittle `thread.status == "sleep"` tests (threads can go into sleep even without locks).
| * AR::ConPool - establish connections outside of critical section.thedarkone2015-05-141-27/+101
| |
| * AR::ConPool - reduce post checkout critical section.thedarkone2015-05-141-8/+23
| | | | | | | | Move post checkout connection verification out of mutex.synchronize.
* | Remove redundant require 'set' linesMehmet Emin İNAÇ2015-05-152-2/+0
|/
* Merge pull request #20024 from ↵Matthew Draper2015-05-051-2/+3
|\ | | | | | | | | kamipo/use_select_rows_instead_of_select_one_in_select_values Use `select_rows` instead of `select_one` in `select_value`
| * Use `select_rows` instead of `select_one` in `select_value`Ryuta Kamizono2015-05-051-2/+3
| | | | | | | | | | `select_one` create `ActiveRecord::Result` instance. It is better to use `select_rows` instead of `select_one` for performance.
* | Merge pull request #17632 from eugeneius/schema_cache_dump_connection_poolAaron Patterson2015-05-041-2/+4
|\ \ | |/ |/| Apply schema cache dump when creating connections
| * Apply schema cache dump when creating connectionsEugene Kenny2015-04-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `db:schema:cache:dump` rake task dumps the database schema structure to `db/schema_cache.dump`. If this file is present, the schema details are loaded into the currently checked out connection by a railtie while Rails is booting, to avoid having to query the database for its schema. The schema cache dump is only applied to the initial connection used to boot the application though; other connections from the same pool are created with an empty schema cache, and still have to load the structure of each table directly from the database. With this change, a copy of the schema cache is associated with the connection pool and applied to connections as they are created.
* | More exercise the create index sql testsRyuta Kamizono2015-05-041-2/+2
| |
* | Merge pull request #17569 from kamipo/dump_table_optionsRafael Mendonça França2015-05-031-0/+4
|\ \ | | | | | | | | | Correctly dump `:options` on `create_table` for MySQL
| * | Correctly dump `:options` on `create_table` for MySQLRyuta Kamizono2015-05-031-0/+4
| | |
* | | Merge pull request #19978 from kamipo/collation_option_support_for_postgresqlRafael Mendonça França2015-05-033-2/+12
|\ \ \ | | | | | | | | PostgreSQL: `:collation` support for string and text columns
| * | | Move the collation handling code from the MySQL adapter to common classesRyuta Kamizono2015-05-043-2/+12
| | | | | | | | | | | | | | | | | | | | Some databases like MySQL allow defining collation charset for specific columns.
* | | | Merge pull request #19989 from kamipo/change_visit_addcolumn_visibiltyRafael Mendonça França2015-05-032-6/+9
|\ \ \ \ | | | | | | | | | | Change the `visit_AddColumn` visiblity for the internal API
| * | | | Change the `visit_AddColumn` visiblity for the internal APIRyuta Kamizono2015-05-032-6/+9
| | |/ / | |/| |
* | | | Missing `:bigint` [ci skip]Ryuta Kamizono2015-05-041-1/+1
| |/ / |/| |
* | | Move comment about microseconds [ci skip]Ryuta Kamizono2015-05-031-0/+2
|/ / | | | | | | The microseconds handling was already moved to `Quoting#quoted_date`.
* | Merge pull request #19962 from prathamesh-sonpatki/nodoc-validate-index-lengthYves Senn2015-04-301-1/+1
|\ \ | | | | | | Nodoc validate_index_length! method
| * | Nodoc validate_index_length! methodPrathamesh Sonpatki2015-04-301-1/+1
| |/ | | | | | | - This method is used only by adapters to validate length of new index names.
* / Added documentation for PostGreSQL database_statements [ci skip]Prathamesh Sonpatki2015-04-301-2/+2
|/ | | | | | - Added documentation for index_name_exists? and rename_index. - Also changed rails to \Rails in documentation of allowed_index_name_length.
* use a more descriptive example. [ci skip]Yves Senn2015-04-241-6/+4
| | | | follow up to 107526e809ea2b6de8b2775ecf83e55d60833206
* docs for `create_table` and non-int primary keys. [ci skip]Yves Senn2015-04-241-0/+17
|
* Fix missing index when using timestamps with indexPaul Mucur2015-04-151-0/+1
| | | | | | | | | | | The `index` option used with `timestamps` should be passed to both `column` definitions for `created_at` and `updated_at` rather than just the first. This was happening because `Hash#delete` is used to extract the `index` option passed to `timestamps`, thereby mutating the `options` hash in-place. Now take a copy of the `options` before deleting so that the original is not modified.
* Document that partial indexes are only supported by Postgres and SQLite.Grey Baker2015-04-131-0/+2
| | | | Fixes #18106
* Add a note regarding add_column restricted API [ci skip]Zachary Scott2015-04-121-0/+4
| | | | | | We should document current behavior, and this is design of API for now. Closes #17597
* fix documentation for SchemaStatements#add_foreign_keySimon Stemplinger2015-04-081-2/+2
| | | | | | The implementation of the generation of the foreign key name was changed between Rails 4.2.0 and 4.2.1 from a random to a deterministic behavior, however the documentation still describes the old randomized behavior.
* Merge pull request #19448 from tgxworld/fix_activesupport_callbacks_clash_on_runRafael Mendonça França2015-04-061-2/+2
|\ | | | | Fix AS::Callbacks raising an error when `:run` callback is defined.
| * Revert "Reduce allocations when running AR callbacks."Guo Xiang Tan2015-03-221-2/+2
| | | | | | | | This reverts commit 796cab45561fce268aa74e6587cdb9cae3bb243e.
* | No need to document drop_table in the PostgreSQLAdapterRafael Mendonça França2015-04-061-0/+3
| | | | | | | | | | | | It behaves in the same way that the abstract adapter. [ci skip]
* | use singular table name if pluralize_table_names is setted as false while ↵Mehmet Emin İNAÇ2015-04-062-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | creating foreign key test case for use singular table name if pluralize_table_names is setted as false while creating foreign key refactor references foreign key addition tests use singular table name while removing foreign key merge foreign key singular table name methods remove unnecessary drop table from test
* | Freeze static arguments for gsubbrainopia2015-04-021-1/+1
| |