aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration/foreign_key_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* 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)`.
* `primary_key` and `references` columns should be identical typeRyuta Kamizono2017-02-071-2/+2
| | | | | | | | 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.
* SQLite: Foreign Key SupportRyuta Kamizono2017-01-171-7/+27
| | | | https://www.sqlite.org/foreignkeys.html
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-1/+1
|
* Change MySQL and Postgresql to use Bigint primary keysJon McCartie2016-12-051-3/+3
|
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-232/+232
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-5/+5
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix typo: accidently -> accidentally.Hendy Tanata2016-07-021-1/+1
|
* Add regression test for foreign key schema dump cachingeileencodes2016-07-011-0/+13
| | | | | | | | | | | | | | | | | | | | If you had a foreign key set and then decided to add `on_delete: :cascade` later in another migration that migration would run but wouldn't refresh the schema dump. The reason for this was because `create_table_info` caches the statement and sets it to be the same as the original declaration for the foreign key (without the `on_delete: :cascade`. PR #25307 ended up fixing this bug because it removes the check for `create_table_info` and relies on reading from `information_schema`. The fix however was intended to patch another bug. The reason this fixes the issue is we're no longer parsing the regex from the cached `create_table_info`. This regression test is to ensure that the issue does not return if we for some reason go back to using `create_table_info` to set the foreign keys.
* Remove legacy mysql adapterAbdelkader Boudih2015-12-171-1/+1
|
* Internal test migrations use the private 'Current' versionMatthew Draper2015-12-151-2/+2
| | | | | | | | Apart from specific versioning support, our tests should focus on the behaviour of whatever version they're accompanying, regardless of when they were written. Application code should *not* do this.
* Add table name prefix and suffix support to add_foreign_key and ↵Mehmet Emin İNAÇ2015-06-251-0/+31
| | | | | | remove_foreign_key methods fix tests
* Merge pull request #18662 from estum/foreign-key-existsYves Senn2015-02-161-0/+21
|\ | | | | | | Add `foreign_key_exists?` method.
| * Add `foreign_key_exists?` method.Anton2015-01-241-0/+21
| |
* | tests, remove unused requires.Yves Senn2015-02-121-1/+0
| | | | | | | | | | | | "active_support/testing/stream" is already required in `test_case.rb`. Furthermore the test "test/cases/migration_test.rb" could no longer be executed directly.
* | Merge pull request #18526 from vipulnsward/add-silence-streamRafael Mendonça França2015-02-051-11/+2
|\ \ | | | | | | Extracted silence_stream method to new module in activesupport/testing
| * | - Extracted silence_stream method to new module in activesupport/testing.Vipul A M2015-01-201-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added include for the same in ActiveSupport::Test. - Removed occurrences of silence_stream being used elsewhere. - Reordered activesupport testcase requires alphabetically. - Removed require of silence stream from test_case - Moved quietly method to stream helper - Moved capture output to stream helper module and setup requires for the same elsewhere
* | | Generate consistent names for foreign keysChris Sinjakli2015-02-031-2/+2
| |/ |/|
* | tests, use `drop_table if_exists: true` in our test suite.Yves Senn2015-01-201-2/+2
|/
* Use IO::NULL alwaysNobuyoshi Nakada2015-01-101-1/+1
|
* Remove deprecated methods at `Kernel`.Rafael Mendonça França2015-01-041-1/+13
| | | | `silence_stderr`, `silence_stream`, `capture` and `quietly`.
* Support symbol foreign key to deletedtaniwaki2014-11-191-0/+8
|
* Force table creation in testsSean Griffin2014-11-171-2/+2
| | | | | | If something causes the teardown block to not get run (errors, interrupting test runs), we have to manually delete them, which is a pain.
* Replace drop sql statement to drop_table methodYasuo Honda2014-09-111-2/+2
| | | | to drop sequences at the same time each tables dropped for Oracle
* Remove 'if exists' from drop table statement then use `table_exists?`Yasuo Honda2014-09-031-2/+2
| | | | | Since 'drop table if exists' statement does not always work with some databases such as Oracle.
* fk: use random digest namesYves Senn2014-06-261-14/+17
| | | | | | The name of the foreign key is not relevant from a users perspective. Using random names resolves the urge to rename the foreign key when the respective table or column is renamed.
* fk: raise for invalid :on_update / :on_delete valuesYves Senn2014-06-261-0/+10
|
* fk: `add/remove_foreign_key` are noop for adapters that don't support fkYves Senn2014-06-261-0/+24
|
* fk: raise when identifiers are longer than `allowed_index_name_length`.Yves Senn2014-06-261-0/+9
|
* fk: support for on_updateYves Senn2014-06-261-3/+13
|
* fk: rename `dependent` to `on_delete`Yves Senn2014-06-261-13/+13
|
* fk: infere column name from table names.Yves Senn2014-06-261-2/+24
| | | | This allows to create and remove foreign keys without specifying a column.
* fk: make `add_foreign_key` reversible.Yves Senn2014-06-261-0/+19
|
* fk: support dependent option (:delete, :nullify and :restrict).Yves Senn2014-06-261-0/+42
|
* fk: dump foreign keys to schema.rbYves Senn2014-06-261-0/+7
| | | | respect `table_name_prefix` and `table_name_suffix`.
* fk: `:primary_key` option for non-standard pk's.Yves Senn2014-06-261-0/+20
|
* fk: generalize using `AlterTable` and `SchemaCreation`.Yves Senn2014-06-261-2/+4
|
* fk: `foreign_keys`, `add_foreign_key` and `remove_foreign_key` for MySQLYves Senn2014-06-261-0/+5
|
* fk: add `foreign_keys` for PostgreSQL adapter.Yves Senn2014-06-261-7/+27
|
* fk: `add_foreign_key` and `remove_foreign_key` for PostgreSQL adapter.Yves Senn2014-06-261-0/+49