aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #29850 from yahonda/test_with_mariadb_102_on_trustyRyuta Kamizono2017-09-011-0/+4
|\ | | | | CI with the latest stable(GA) version of MariaDB 10.2
| * Skip `test_remove_column_with_multi_column_index`Yasuo Honda2017-09-011-0/+4
| | | | | | | | | | | | | | | | | | | | 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.
* | `add_reference` should respect column position for both reference id and ↵Ryuta Kamizono2017-09-011-0/+10
|/ | | | | | type columns Fixes #30496.
* Improve `migration/column_attributes_test.rb` (#25286)Ryuta Kamizono2017-08-181-3/+17
| | | | | * 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
* Fix `test_add_column_with_timestamp_type` when using OracleKoichi ITO2017-07-251-0/+2
|
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-1917-0/+34
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0217-17/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-0117-0/+17
|
* Merge pull request #29455 from kirs/remove-column-with-fk-mysqlGuillermo Iguaran2017-06-161-0/+10
|\ | | | | Remove FK together with column in MySQL
| * Remove FK together with column in MySQLKir Shatrov2017-06-161-0/+10
| | | | | | | | | | | | | | 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.
* | Add test for backward compatibility when using change_tableKoichi ITO2017-06-131-0/+15
|/
* `rename_table` renames primary key index nameYaw Boakye2017-05-291-0/+23
| | | | | | | | | | 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.
* Remove a redundant test case of command_recorder_testKoichi ITO2017-05-291-5/+0
|
* Both reference id and type should be `NOT NULL` if `null: false` is specifiedRyuta Kamizono2017-05-191-0/+8
| | | | | | This is a regression due to #28282. Fixes #29136.
* Use a query that's compatible with PostgreSQL 9.2Matthew Draper2017-04-121-1/+1
| | | | | | 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.
* Don't share `options` with a reference type columnRyuta Kamizono2017-03-041-0/+7
| | | | | | | | | 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.
* `create_join_table` should respect `references` column typeRyuta Kamizono2017-02-281-1/+12
| | | | | | | | 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.
* Deprecate `supports_migrations?` on connection adaptersRyuta Kamizono2017-02-271-12/+0
| | | | | | | `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.
* Fix `change_column` to drop default with `null: false`Ryuta Kamizono2017-02-261-0/+10
| | | | | | | | | | | | | | | | 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
* Merge pull request #25285 from ↵Rafael França2017-02-231-0/+16
|\ | | | | | | | | kamipo/fix_remove_reference_to_multiple_foreign_keys_in_the_same_table Fix `remove_reference` to multiple foreign keys in the same table
| * Fix `remove_reference` to multiple foreign keys in the same tableRyuta Kamizono2017-02-111-0/+16
| |
* | Correctly dump native timestamp types for MySQLRyuta Kamizono2017-02-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) ```
* | Remove unused DdlHelper in ForeignKeyTestRyuta Kamizono2017-02-141-2/+0
| |
* | Use ActiveRecord `bigint` type, not SQL literal bigintYasuo Honda2017-02-141-11/+14
| | | | | | | | | | | | | | | | 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)`.
* | Deprecate passing `default` to `index_name_exists?`Ryuta Kamizono2017-02-131-2/+4
| |
* | The `default` arg of `index_name_exists?` makes to optionalRyuta Kamizono2017-02-131-8/+6
|/ | | | | | 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.
* `primary_key` and `references` columns should be identical typeRyuta Kamizono2017-02-073-14/+13
| | | | | | | | 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 PKsRyuta Kamizono2017-02-041-0/+104
| | | | | | | | | | | | | | | | | | | | | 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.
* Virtual/generated column support for MySQL 5.7.5+ and MariaDB 5.2.0+Ryuta Kamizono2017-02-011-6/+1
| | | | | | | | | | | | | | | | | | | 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
* show correct class name in migration inherited directly erroryuuji.yaginuma2017-01-241-2/+3
| | | | Follow up to 249f71a
* SQLite: Foreign Key SupportRyuta Kamizono2017-01-172-9/+47
| | | | https://www.sqlite.org/foreignkeys.html
* Raises when `ActiveRecord::Migration` is inherited directly.Rafael Mendonça França2016-12-291-12/+6
|
* `#tables` and `#table_exists?` and returns only tables and not viewsRafael Mendonça França2016-12-293-15/+13
|
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-1/+1
|
* Translate NOT NULL violation to the specific exceptionRyuta Kamizono2016-12-061-7/+11
| | | | | Raise `ActiveRecord::NotNullViolation` when a record cannot be inserted or updated because it would violate a not null constraint.
* Change MySQL and Postgresql to use Bigint primary keysJon McCartie2016-12-053-8/+13
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Merge pull request #26631 from kamipo/remove_duplicate_conditionMatthew Draper2016-10-061-3/+1
|\ | | | | Remove duplicated `unless current_adapter?(:SQLite3Adapter)` condition
| * Remove duplicated `unless current_adapter?(:SQLite3Adapter)` conditionRyuta Kamizono2016-09-271-3/+1
| | | | | | | | | | | | `test_native_decimal_insert_manual_vs_automatic` exists inside `unless current_adapter?(:SQLite3Adapter)`. This condition is duplicated.
* | `:text_too_big` column should be `:text`, not `:integer`Ryuta Kamizono2016-09-271-1/+1
|/
* improve error message when include assertions failMichael Grosser2016-09-162-5/+5
| | | | | | 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
* Remove duplicated `elsif` branchRyuta Kamizono2016-09-111-2/+0
| | | | The `elsif` branch is completely duplicated with `else` branch.
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-011-4/+4
|
* Add three new rubocop rulesRafael Mendonça França2016-08-167-40/+40
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* revises most Lint/EndAlignment offensesXavier Noria2016-08-071-3/+4
| | | | Some case expressions remain, need to think about those ones.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-063-3/+1
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-066-402/+402
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-1/+1
|
* modernizes hash syntax in activerecordXavier Noria2016-08-068-122/+122
|