aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration
Commit message (Collapse)AuthorAgeFilesLines
...
* fix remove_index for postgresql when running legacy migrationsLachlan Sylvester2016-01-061-0/+16
|
* Remove unnecessary enable,disable_extension on testsFumiaki MATSUSHIMA2016-01-021-2/+0
| | | | | | | uuid-ossp extension is alreadly enabled on test schema. And `disable_extension!('uuid-ossp', connection)` can be a cause of test failure. `ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR: function uuid_generate_v1() does not exist` will happen depending on the execution order.
* Remove legacy mysql adapterRyuta Kamizono2015-12-211-2/+0
| | | | Follow up to #22642.
* Merge pull request #19456 from greysteil/index-exists-behaviourMatthew Draper2015-12-182-0/+52
|\ | | | | | | Ignore index name in `index_exists?` when not passed a name to check for
| * Support removing custom-names indexes when only specifying column namesGrey Baker2015-12-152-0/+50
| |
| * Ignore index name in `index_exists?` when not passed a name to check forGrey Baker2015-12-151-0/+2
| |
* | Remove legacy mysql adapterAbdelkader Boudih2015-12-176-10/+10
|/
* Internal test migrations use the private 'Current' versionMatthew Draper2015-12-152-3/+3
| | | | | | | | 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.
* Move `migration/postgresql_geometric_types_test.rb` in ↵Ryuta Kamizono2015-11-241-93/+0
| | | | `adapters/postgresql/geometric_test.rb`
* Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`yui-knk2015-11-094-16/+18
| | | | | | | | | | Reported on #21509, how views is treated by `#tables` are differ by each adapters. To fix this different behavior, after Rails 5.0 is released, deprecate `#tables`. And `#table_exists?` would check both tables and views. To make their behavior consistent with `#tables`, after Rails 5.0 is released, deprecate `#table_exists?`.
* `:to_table` when adding a fk through `add_reference`.Yves Senn2015-10-131-0/+9
| | | | | | | | | | | | Closes #21563. The `name` argument of `add_references` was both used to generate the column name `<name>_id` and as the target table for the foreign key `name.pluralize`. It's primary purpose is to define the column name. In cases where the `to_table` of the foreign key is different than the column name we should be able to specify it individually.
* tests, use `if_exists: true` instead of `rescue nil`.Yves Senn2015-09-221-1/+1
|
* Support for foreign keys in create tableRyuta Kamizono2015-09-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | If foreign keys specified in create table, generated SQL is slightly more efficient. Definition: ``` create_table :testings do |t| t.references :testing_parent, foreign_key: true end ``` Before: ``` CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer); ALTER TABLE "testings" ADD CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id"); ``` After: ``` CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer, CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id")); ```
* Removed mocha from Active Record Part 2Ronak Jangir2015-09-161-1/+2
|
* no more require minitest mockGaurav Sharma2015-08-272-2/+0
|
* Merge pull request #20459Sean Griffin2015-08-061-0/+93
|\
| * Add missing data types for ActiveRecord migrationsMehmet Emin İNAÇ2015-06-081-0/+93
| |
* | Merge pull request #20699 from ↵Rafael Mendonça França2015-06-271-0/+31
|\ \ | | | | | | | | | | | | vngrs/foreign_key_with_table_name_suffix_and_prefix Add table name prefix and suffix support for foreign keys
| * | 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
* | | Add reversible syntax for change_column_defaultPrem Sichanugrist2015-06-262-0/+17
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Passing `:from` and `:to` to `change_column_default` makes this command reversible as user has defined its previous state. So, instead of having the migration command as: change_column_default(:posts, :state, "draft") They can write it as: change_column_default(:posts, :state, from: nil, to: "draft")
* | make `remove_index :table, :column` reversible.Yves Senn2015-06-151-0/+5
| | | | | | | | | | | | | | | | | | This used to raise a `IrreversibleMigration` error (since #10437). However since `remove_index :table, :column` is probably the most basic use-case we should make it reversible again. Conflicts: activerecord/CHANGELOG.md
* | Add an invert method for remove_foreign_keyAster Ryan2015-06-111-1/+30
|/
* Map :bigint as NUMBER(19) sql_type by using `:limit => 19` for OracleYasuo Honda2015-06-011-1/+1
| | | | | | | | | | | | | | | | | | | since NUMBER(8) is not enough to store the maximum number of bigint. Oracle NUMBER(p,0) as handled as integer because there is no dedicated integer sql data type exist in Oracle database. Also NUMBER(p,s) precision can take up to 38. p means the number of digits, not the byte length. bigint type needs 19 digits as follows. $ irb 2.2.2 :001 > limit = 8 => 8 2.2.2 :002 > maxvalue_of_bigint = 1 << ( limit * 8 - 1) => 9223372036854775808 2.2.2 :003 > puts maxvalue_of_bigint.to_s.length 19 => nil 2.2.2 :004 >
* test, for `create_table` and `foreign_key: true` no-op. Closes #19794.Yves Senn2015-04-271-0/+20
| | | | | | | | | | Add a test-case to make sure that `create_table` with a `foreign_key: true` and an adapter without foreign key support does not blow up. Motivated by #19794. Originating from: https://github.com/rails/rails/commit/99a6f9e60ea55924b44f894a16f8de0162cf2702#commitcomment-10855210
* use singular table name if pluralize_table_names is setted as false while ↵Mehmet Emin İNAÇ2015-04-061-0/+22
| | | | | | | | | | | | | | creating foreign key test case for use singular table name if pluralize_table_names is setted as false while creating foreign key refactor references foreign key addition tests use singular table name while removing foreign key merge foreign key singular table name methods remove unnecessary drop table from test
* Closes rails/rails#18864: Renaming transactional fixtures to transactional testsBrandon Weiss2015-03-166-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | I’m renaming all instances of `use_transcational_fixtures` to `use_transactional_tests` and “transactional fixtures” to “transactional tests”. I’m deprecating `use_transactional_fixtures=`. So anyone who is explicitly setting this will get a warning telling them to use `use_transactional_tests=` instead. I’m maintaining backwards compatibility—both forms will work. `use_transactional_tests` will check to see if `use_transactional_fixtures` is set and use that, otherwise it will use itself. But because `use_transactional_tests` is a class attribute (created with `class_attribute`) this requires a little bit of hoop jumping. The writer method that `class_attribute` generates defines a new reader method that return the value being set. Which means we can’t set the default of `true` using `use_transactional_tests=` as was done previously because that won’t take into account anyone using `use_transactional_fixtures`. Instead I defined the reader method manually and it checks `use_transactional_fixtures`. If it was set then it should be used, otherwise it should return the default, which is `true`. If someone uses `use_transactional_tests=` then it will overwrite the backwards-compatible method with whatever they set.
* tests, favor `drop_table` and `:if_exists` over raw SQL.Yves Senn2015-03-021-1/+1
| | | | | We've replaced most querues using DROP TABLE in our tests already. This patch replaces the last couple calls.
* The short-hand methods should be able to define multiple columnsRyuta Kamizono2015-02-231-1/+19
|
* Extract the short-hand methods into `ColumnMethods`Ryuta Kamizono2015-02-231-0/+8
|
* Extract `primary_key` method into `ColumnMethods`Ryuta Kamizono2015-02-221-0/+7
|
* `Type#type_cast_from_database` -> `Type#deserialize`Sean Griffin2015-02-172-5/+5
|
* 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.
* | prefer `drop_table :table, if_exists: true` over explicit checks.Yves Senn2015-02-111-2/+2
| |
* | add test to ensure `remove_reference` with index and fk is invertable.Yves Senn2015-02-111-0/+5
| |
* | fix `remove_reference` with `foreign_key: true` on MySQL. #18664.Yves Senn2015-02-111-0/+10
| | | | | | | | | | | | | | | | | | | | MySQL rejects to remove an index which is used in a foreign key constraint: ``` ActiveRecord::StatementInvalid: Mysql2::Error: Cannot drop index 'index_copies_on_title_id': needed in a foreign key constraint: ALTER TABLE `copies` DROP `title_id` ``` Removing the constraint before removing the column (and the index) solves this problem.
* | Add `auto_increment?` instead of `extra == 'auto_increment'`Ryuta Kamizono2015-02-081-1/+1
| |
* | 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
| | |
* | | Remove most type related predicates from `Column`Sean Griffin2015-01-302-5/+5
| |/ |/| | | | | | | | | Remaining are `limit`, `precision`, `scale`, and `type` (the symbol version). These will remain on the column, since they mirror the options to the `column` method in the schema definition DSL
* | Replace `if exists` with `table_exists?` and drop table statement with ↵Yasuo Honda2015-01-211-2/+2
| | | | | | | | | | | | | | `drop_table` since 'drop table if exists' statement does not always work with some databases such as Oracle. also Oracle drop table statement will not drop sequence objects.
* | tests, use `drop_table if_exists: true` in our test suite.Yves Senn2015-01-204-7/+7
| |
* | Add an `:if_exists` option to `drop_table`Stefan Kanev2015-01-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | If set to `if_exists: true`, it generates a statement like: DROP TABLE IF EXISTS posts This syntax is supported in the popular SQL servers, that is (at least) SQLite, PostgreSQL, MySQL, Oracle and MS SQL Sever. Closes #16366.
* | Remove unused accessorRyuta Kamizono2015-01-191-1/+1
|/
* Use IO::NULL alwaysNobuyoshi Nakada2015-01-101-1/+1
|
* Add firebird support to test suiteRay Zane2015-01-051-18/+20
|
* Change the default `null` value for `timestamps` to `false`Rafael Mendonça França2015-01-041-10/+7
|
* Remove deprecated methods at `Kernel`.Rafael Mendonça França2015-01-041-1/+13
| | | | `silence_stderr`, `silence_stream`, `capture` and `quietly`.