| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| | |
The default 'now'::date is CURRENT_DATE.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Example:
create_table :posts do |t|
t.datetime :published_at, default: -> { 'NOW()' }
end
|
|\ \
| | |
| | |
| | |
| | | |
kamipo/sql_for_insert_returns_values_for_passing_to_exec_insert
`sql_for_insert` returns values for passing to `exec_insert`
|
| | | |
|
|/ /
| |
| |
| | |
These methods are private and unused from anywhere.
|
|/
|
|
| |
Arel handles substitution for bind parameters by now.
|
|
|
|
| |
Closes #22584.
|
|
|
|
| |
`connection_adapters/mysql/type_metadata.rb`
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an alternate implementation to #22875, that generalizes a lot of
the logic that type decorators are going to need, in order to have them
work with arrays, ranges, etc. The types have the ability to map over a
value, with the default implementation being to just yield that given
value. Array and Range give more appropriate definitions.
This does not automatically make ranges time zone aware, as they need to
be added to the `time_zone_aware` types config, but we could certainly
make that change if we feel it is appropriate. I do think this would be
a breaking change however, and should at least have a deprecation cycle.
Closes #22875.
/cc @matthewd
|
|\
| |
| | |
Prevent destructive action on production database
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
This PR introduces a key/value type store to Active Record that can be used for storing internal values. It is an alternative implementation to #21237 cc @sgrif @matthewd.
It is possible to run your tests against your production database by accident right now. While infrequently, but as an anecdotal data point, Heroku receives a non-trivial number of requests for a database restore due to this happening. In these cases the loss can be large.
To prevent against running tests against production we can store the "environment" version that was used when migrating the database in a new internal table. Before executing tests we can see if the database is a listed in `protected_environments` and abort. There is a manual escape valve to force this check from happening with environment variable `DISABLE_DATABASE_ENVIRONMENT_CHECK=1`.
|
|\ \
| | |
| | | |
Fix `select_values` method signature for consistency
|
| | | |
|
|/ /
| |
| |
| | |
Simply `{update|delete}_sql` aliases to `{update|delete}`.
|
| |
| |
| |
| |
| | |
`sql += " WHERE 1=1"` was introduced in 69cb942.
But it is not needed. ref https://www.sqlite.org/lang_delete.html
|
| |
| |
| |
| | |
`connection.insert_sql` is almost the same as `connection.insert`.
|
|\ \
| | |
| | | |
Autoload ReferenceDefinition class in abstract adapter so that it can be used by #add_reference in schema_statements
|
| | |
| | |
| | |
| | |
| | |
| | | |
used by #add_reference in schema_statements
- Fixes #22916.
|
|\ \ \
| | | |
| | | |
| | | | |
Add short-hand methods for text and blob types in MySQL
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In Pg and Sqlite3, `:text` and `:binary` have variable unlimited length.
But in MySQL, these have limited length for each types (ref #21591, #21619).
This change adds short-hand methods for each text and blob types.
Example:
create_table :foos do |t|
t.tinyblob :tiny_blob
t.mediumblob :medium_blob
t.longblob :long_blob
t.tinytext :tiny_text
t.mediumtext :medium_text
t.longtext :long_text
end
|
|\ \ \
| |/ /
|/| | |
Fix `connection#create` in PG adapter
|
| | |
| | |
| | |
| | |
| | |
| | | |
Originally `connection#create` had aliased to `connection#insert` in PG
adapter. But it was broken by #7447. Re-alias `create` to `insert` for
fixing it.
|
|\ \ \
| |/ /
|/| | |
Fix `unsigned?` and `blob_or_text_column` for Enum columns in MySQL
|
| | | |
|
|\ \ \
| |/ /
|/| | |
Allow add_to_transaction with null transaction
|
| | |
| | |
| | |
| | | |
Fixes https://github.com/rails/rails/issues/22819
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Before:
```
SELECT 1 AS one FROM "topics" WHERE "topics"."title" = 'abc' LIMIT $1 [["LIMIT", 1]]
```
After:
```
SELECT 1 AS one FROM "topics" WHERE "topics"."title" = $1 LIMIT $2 [["title", "abc"], ["LIMIT", 1]]
```
|
|\ \ \
| | | |
| | | | |
Make `postgresql_version` public
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This is useful to libraries that want to feature gate based on the
version of PostgreSQL the user is connected to. For instance, I want to
know if the user is connected to a version of Postgres that supports
concurrent materialized view refreshes. I could add that as a method on
the adapter as a PR, but rails has no need for this itself.
Rails is already using the postgresql_version for its own feature gating
and this makes that possible for other libraries.
|
|\ \ \ \
| | | | |
| | | | | |
Add `columns_for_distinct` for MySQL 5.7 with ONLY_FULL_GROUP_BY
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In MySQL 5.7.5 and up, ONLY_FULL_GROUP_BY affects handling of queries
that use DISTINCT and ORDER BY. It requires the ORDER BY columns in the
select list for distinct queries, and requires that the ORDER BY include
the distinct column.
See https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
|
| | | | |
| | | | |
| | | | |
| | | | | |
Follow up to #19359 and avoid #22241.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Improve `select_one` in `Mysql2Adapter`
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
These `select_*` methods improved already.
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | | |
Avoid instanciate `ActiveRecord::Result` and calling
`ActiveRecord::Result#hash_rows` for the performance.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Correctly cache create_table_info
|
| | |_|/
| |/| |
| | | |
| | | | |
Follow up to #21664.
|
| |_|/
|/| |
| | |
| | |
| | |
| | |
| | | |
A `(?:var)?binary` with default '' is a correct definition.
Remove `missing_default_forged_as_empty_string?` method for fixing this
issue because this method is a workaround for older mysql legacy adapter
(19c99ac, f7015336).
|
|\ \ \
| | | |
| | | | |
`join_to_delete` is same as `join_to_update`
|
| | | |
| | | |
| | | |
| | | | |
Reapply #22615.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Follow up to #22642.
|
| |_|/
|/| | |
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | | |
byroot/do-not-include-column-limit-if-it-is-default
Do not include column limit in schema.rb if it matches the default
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When working on engines that supports multiple databases, it's
very annoying to have a different schema.rb output based on which
database you use. MySQL being the primary offender.
This patch should reduce the disparities a bit.
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Support passing the schema name prefix to `conenction.indexes`
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | | |
Support passing the schema name as a prefix to table name in
`ConnectionAdapters::SchemaStatements#indexes`. Previously the prefix would
be considered a full part of the index name, and only the schema in the
current search path would be considered.
|