| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |/
|/|
| |
| |
| | |
Extra `data_source_exists?(table_name)` is unneeded if
`drop_table(table_name, if_exists: true)` directly.
|
|\ \
| | |
| | | |
Fix `remove_index` to be able to remove expression indexes
|
| | |
| | |
| | |
| | | |
Fixes #26635, #26641.
|
|\ \ \
| | | |
| | | | |
The `default` arg of `index_name_exists?` makes to optional
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| |/ / /
|/| | | |
Extract `quoted_binary` and use it rather than override `_quote`
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Each databases have different binary representation. Therefore all
adapters overrides `_quote` for quoting binary.
Extract `quoted_binary` for quoting binary and use it rather than
override `_quote`.
|
| |_|/
|/| |
| | |
| | | |
Closes #27979
|
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Follow up to #26266.
The default type of `primary_key` and `references` were changed to
`bigint` since #26266. But legacy migration and sqlite3 adapter should
keep its previous behavior.
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The PR #27384 changed integer-like primary key to be autoincrement
unless an explicit default. This means that integer-like primary key is
restored as autoincrement unless dumping the default nil explicitly.
We should dump integer-like primary key with default nil correctly.
|
|/ / /
| | |
| | |
| | |
| | |
| | | |
`ColumnDumper#migration_keys` was extracted to customize keys for
standardized column arguments widths. But the feature was removed in
df84e98. The internal method is no longer used for that.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | | |
this probably fixes #25840
|
| | |
| | |
| | |
| | |
| | |
| | | |
`initialize_internal_metadata_table`
These internal initialize methods are no longer used internally.
|
| | |
| | |
| | |
| | |
| | | |
This reverts commit 39c77eb1843f79925c7195e8869afc7cb7323682, reversing
changes made to 9f6f51be78f8807e18fc6562c57af2fdbf8ccb56.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`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
|
| | |
| | |
| | |
| | | |
https://www.sqlite.org/foreignkeys.html
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If a process is forked more than once, the pool was grabbing the oldest
spec, not the most recent spec. This wasn't noticed before because most
folks are lilely forking the process only once.
If you're forking the process multiple times however the wrong spec name
will be returned and an incorrect connection will be used for the
process.
This fixes the issue by reversing the list of spec names so we can grab
the most recent spec rather than the oldest spec.
|
| | |
| | |
| | |
| | | |
because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
kamipo/fix_select_rows_method_signature_for_consistency
Fix `select_rows` method signature for consistency
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Related #22973, #24708.
`select_all`, `select_one`, `select_value`, and `select_values` method
signature is `(arel, name = nil, binds = [])`.
But `select_rows` is `(sql, name = nil, binds = [])`.
|
|/ / /
| | |
| | |
| | |
| | | |
Passing `name` to `tables` is already deprecated at #21601.
Passing `name` to `indexes` is also unused.
|
|\ \ \
| | | |
| | | | |
Add a quote to an SQL insert statement of schema migration
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| |_|/
|/| |
| | |
| | |
| | |
| | | |
Some methods were added to public API in
5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of
the public API.
|
| | | |
|
| | | |
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
make sql statements frozen
dup if arel is not our string
expect runtime error
dont wrap runtime error in invalid
log errors will now be treated as runtime errors
update changelog
|
|\ \
| | |
| | | |
Fix `add_index` to normalize column names and options
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Currently does not work the following code.
```ruby
add_index(:people, ["last_name", "first_name"], order: { last_name: :desc, first_name: :asc })
```
Normalize column names and options to fix the issue.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
SQLite's default query interface ignores anything after the first
semicolon in a query. This is actually quite common behavior in database
drivers, especially when dealing with code paths for prepared statements
(which we are). While this should only affect SQLite, as I'm not aware
of any drivers which don't support multi-insert. Even if this does
affect other third party drivers though, I'd prefer not to assume that
more than one query can be executed per call to `execute`.
Fixes #26948.
Close #27242.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It'll be re-cleared when it's rebuilt in with_new_connections_blocked's
ensure, but we still need to clear it inside this synchronize -- we've
disconnected connections that may be available in the queue, and while
other threads are not allowed to make *new* connections, they are still
allowed to take existing ones from there.
This was incorrectly removed in d314646c965b045724e6bdb9d61dcecfabc0ba8f.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Two methods block new connections; we were already doing the right thing
for clear_reloadable_connections, but it's better placed in
with_new_connections_blocked, where it can work for disconnect too.
|
|\ \ \
| | | |
| | | |
| | | | |
Fix the race condition caused by `with_new_connections_blocked`
|
|/ / /
| | |
| | |
| | |
| | |
| | | |
`with_new_connections_blocked` was introduced at #14938.
But the method sometimes causes `@new_cons_enabled = false` then never
toggled to true.
|
|\ \ \
| | | |
| | | | |
Add missing `+` around a some literals.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Mainly around `nil`
[ci skip]
|
|\ \ \ \
| | | | |
| | | | | |
Configure query caching (per thread) on the connection pool
|
| | | | | |
|
|/ / / / |
|
|\ \ \ \
| | | | |
| | | | | |
Clear query cache during checkin, instead of an execution callback
|