| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
CI with the latest stable(GA) version of MariaDB 10.2
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
when tested with MariaDB 10.2.8 or higher
Refer #30485
https://mariadb.com/kb/en/the-mariadb-library/alter-table/#drop-column-if-exists-col_name-cascaderestrict
> MariaDB starting with 10.2.8
> Dropping a column that is part of a multi-column UNIQUE constraint is not permitted.
|
|/
|
|
|
|
| |
type columns
Fixes #30496.
|
|
|
|
|
| |
* Test `test_unabstracted_database_dependent_types` for `PostgreSQLAdapter`
* Add `test_change_column_with_new_precision_and_scale` for `SQLite3Adapter`
* This test case and comment was lost at 28bb02a78fd47527bb7a208d01a4594bb212812c
|
| |
|
| |
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
|\
| |
| | |
Remove FK together with column in MySQL
|
| |
| |
| |
| |
| |
| |
| | |
Unlike with other databses, MySQL doesn't let you remove the column
if there's a FK on this column.
For better developer experience we want to remove the FK together with
the column.
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
This is a regression due to #28282.
Fixes #29136.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
Sharing `options` causes some unexpected behavior. If `limit: 2` is
specified, this means that 2 bytes integer for a reference id column and
2 chars string for a reference type column. Another example, if
`unsigned: true` is specified, this means that unsigned integer for a
reference id column, but a invalid option for a reference type column.
So `options` should not be shared with a reference type column.
|
|
|
|
|
|
|
|
| |
Follow up of #26266.
The default type of `primary_key` and `references` were changed to
`bigint` since #26266. But `create_join_table` column type is still
`integer`. It should respect `references` column type.
|
|
|
|
|
|
|
| |
`supports_migrations?` was added at 4160b518 to determine if schema
statements (`create_table`, `drop_table`, etc) are implemented in the
adapter. But all tested databases has been supported migrations since
a4fc93c3 at least.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently `change_column` cannot drop default if `null: false` is
specified at the same time. This change fixes the issue.
```ruby
# cannot drop default
change_column "tests", "contributor", :boolean, default: nil, null: false
# we need the following workaround currently
change_column "tests", "contributor", :boolean, null: false
change_column "tests", "contributor", :boolean, default: nil
```
Closes #26582
|
|\
| |
| |
| |
| | |
kamipo/fix_remove_reference_to_multiple_foreign_keys_in_the_same_table
Fix `remove_reference` to multiple foreign keys in the same table
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The native timestamp type in MySQL is different from datetime type.
Internal representation of the timestamp type is UNIX time, This means
that timestamp columns are affected by time zone.
```
> SET time_zone = '+00:00';
Query OK, 0 rows affected (0.00 sec)
> INSERT INTO time_with_zone(ts,dt) VALUES (NOW(),NOW());
Query OK, 1 row affected (0.02 sec)
> SELECT * FROM time_with_zone;
+---------------------+---------------------+
| ts | dt |
+---------------------+---------------------+
| 2016-02-07 22:11:44 | 2016-02-07 22:11:44 |
+---------------------+---------------------+
1 row in set (0.00 sec)
> SET time_zone = '-08:00';
Query OK, 0 rows affected (0.00 sec)
> SELECT * FROM time_with_zone;
+---------------------+---------------------+
| ts | dt |
+---------------------+---------------------+
| 2016-02-07 14:11:44 | 2016-02-07 22:11:44 |
+---------------------+---------------------+
1 row in set (0.00 sec)
```
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Oracle database itself does not have `bigint` SQL type, then it gets `ORA-00902: invalid datatype`.
It can be addressed by using ActiveRecord `bigint` type
because Oracle enhanced adapter recognizes ActiveRecord `bigint` type
and transfer it to its equivalent SQL type `NUMBER(19)`.
|
| | |
|
|/
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The PR #27384 changed migration compatibility behaviour.
```ruby
class CreateMasterData < ActiveRecord::Migration[5.0]
def change
create_table :master_data, id: :integer do |t|
t.string :name
end
end
end
```
Previously this migration created non-autoincremental primary key
expected. But after the PR, the primary key changed to autoincremental,
it is unexpected.
This change restores the behaviour of the compatibility layer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Follow up to 249f71a
|
|
|
|
| |
https://www.sqlite.org/foreignkeys.html
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Raise `ActiveRecord::NotNullViolation` when a record cannot be inserted
or updated because it would violate a not null constraint.
|
| |
|
| |
|
|\
| |
| | |
Remove duplicated `unless current_adapter?(:SQLite3Adapter)` condition
|
| |
| |
| |
| |
| |
| | |
`test_native_decimal_insert_manual_vs_automatic` exists inside
`unless current_adapter?(:SQLite3Adapter)`. This condition is
duplicated.
|
|/ |
|
|
|
|
|
|
| |
assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message
assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
|
|
|
|
| |
The `elsif` branch is completely duplicated with `else` branch.
|
| |
|
|
|
|
|
|
|
|
| |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
|
|
|
| |
Some case expressions remain, need to think about those ones.
|
| |
|
| |
|
| |
|
| |
|
| |
|