| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Previously there was no separator between the two code examples so it looked like:
```ruby
CREATE INDEX by_name ON accounts(name(10))
add_index(:accounts, [:name, :surname], name: 'by_name_surname', length: {name: 10, surname: 15})
```
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If foreign keys specified in create table, generated SQL is slightly more
efficient.
Definition:
```
create_table :testings do |t|
t.references :testing_parent, foreign_key: true
end
```
Before:
```
CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer);
ALTER TABLE "testings" ADD CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id");
```
After:
```
CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer, CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id"));
```
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | | |
kamipo/eliminate_duplicated_visit_table_definition
Eliminate the duplication code of `visit_TableDefinition`
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Do not dump a view as a table in sqlite3, mysql and mysql2 adapters
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Remove unnecessary display width
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The **(11)** does not affect the storage size of the data type, which for an
INT will always be 4 bytes. It affects the **display width**.
http://www.tocker.ca/2015/07/02/proposal-to-deprecate-mysql-integer-display-width-and-zerofill.html
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
kamipo/eliminate_duplicated_options_include_default_method
Eliminate the duplicated `options_include_default?` method
|
| | |/ / /
| |/| | |
| | | | |
| | | | | |
Follow up 7ba2cd06.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Correctly dump composite primary key
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Example:
create_table :barcodes, primary_key: ["region", "code"] do |t|
t.string :region
t.integer :code
end
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The thread_safe gem is being deprecated and all its code has been merged
into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly
the same as its predecessor except for fixes to two bugs discovered
during the merge.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Improved ActiveRecord Connection Pool docs [ci skip]
|
| | |/ / /
| |/| | | |
|
|/ / / /
| | | |
| | | |
| | | | |
[ci skip]
|
| | | | |
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Follow up #21591.
The document of limit option for a text column is incorrect.
MySQL: the limit is byte length, not character length
Pg, Sqlite3: variable unlimited length
|
| | |
| | |
| | |
| | |
| | | |
skip]
Bumps from `5.6` to `5.7`
|
| | |
| | |
| | |
| | | |
It is always passed in
|
|\ \ \
| | | |
| | | |
| | | | |
Define `SchemaStatements#tables` as interface
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
These 3 methods expect `ConnectionAdapters` to have `tables` method,
so make it clear that `tables` method is interface.
* `ConnectionAdapters::SchemaCache#prepare_tables`
* `db:schema:cache:dump` task
* `SchemaDumper#tables`
|
| | |
| | |
| | |
| | |
| | | |
See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html
for more details.
|
|\ \ \
| | | |
| | | |
| | | | |
Added docs for TableDefinition #coloumns & #remove_column [ci skip]
|
|/ / / |
|
|/ /
| |
| |
| | |
Closes #21201.
|
| |
| |
| | |
Documentation had extra colon after keyword.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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}"
```
|
|\
| |
| |
| |
| | |
vngrs/foreign_key_with_table_name_suffix_and_prefix
Add table name prefix and suffix support for foreign keys
|
| |
| |
| |
| |
| |
| | |
remove_foreign_key methods
fix tests
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
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")
|
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| |
| |
| |
| |
| | |
Make remove_foreign_key reversible
Conflicts:
activerecord/CHANGELOG.md
|
|/ |
|
|
|
|
| |
[Robin Dupret & Shunsuke Aida]
|
| |
|
| |
|
|\
| |
| | |
Add schema cache to new connection pool after fork
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
Divide methods for handling column options separately
|
| |/ |
|
|/
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
Reducing AR::ConPool's critical (synchronized) section
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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).
|
| | |
|
| |
| |
| |
| | |
Move post checkout connection verification out of mutex.synchronize.
|
|/ |
|
|\
| |
| |
| |
| | |
kamipo/use_select_rows_instead_of_select_one_in_select_values
Use `select_rows` instead of `select_one` in `select_value`
|
| |
| |
| |
| |
| | |
`select_one` create `ActiveRecord::Result` instance. It is better to use
`select_rows` instead of `select_one` for performance.
|
|\ \
| |/
|/| |
Apply schema cache dump when creating connections
|