aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-0615-162/+162
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Oracle TIMESTAMP sql type is associated with Rails `DateTime` type nowYasuo Honda2016-07-201-8/+1
| | | | | | - Refer https://github.com/rsim/oracle-enhanced/pull/845 Remove `set_date_columns` which has been deprecated in Oracle enhanced adapter - Refer https://github.com/rsim/oracle-enhanced/pull/869
* Fix wrong test namePrathamesh Sonpatki2016-07-161-1/+1
| | | | - Followup of https://github.com/rails/rails/pull/23179
* 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.
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-1/+1
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Merge pull request #24221 from gregmolnar/uuidKasper Timm Hansen2016-04-201-0/+7
|\ | | | | create_join_table should work with uuid
| * add column type option to create_join_table to support uuidGreg Molnar2016-03-171-0/+7
| |
* | `foreign_key` respects `table_name_prefix` and `table_name_suffix`Ryuta Kamizono2016-04-191-0/+30
| |
* | Add test to verify named unique index, when creating reference via add_referenceVipul A M2016-04-161-0/+5
|/
* Merge pull request #23419 from ↵Matthew Draper2016-02-231-1/+13
|\ | | | | | | | | prathamesh-sonpatki/fix-showing-of-deprecation-warning-for-legacy-migrations Correctly show deprecation warning for incompatible migrations
| * Fix random failures of tests on TravisPrathamesh Sonpatki2016-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | - Tests on Travis are randomly failing because schema_migrations table does not exist in teardown block. - Also checked that all other places where we have used `ActiveRecord::SchemaMigration.delete_all` we have rescued it, so used it here also. This failure was not specifically related to the test added in this PR but to overall compatibility migration tests, so adding as separate commit.
| * Correctly show deprecation warning for incompatible migrationsPrathamesh Sonpatki2016-02-121-0/+12
| |
* | Merge pull request #23614 from georgemillo/foreign_keyYves Senn2016-02-161-0/+16
|\ \ | |/ |/| | | | | | | | | Let t.foreign_key use the same `to_table` twice Conflicts: activerecord/CHANGELOG.md
| * Let t.foreign_key use the same `to_table` twiceGeorge Millo2016-02-151-0/+20
|/ | | | | | | | | | | | | | | | | | | | | Previously if you used `t.foreign_key` twice within the same `create_table` block using the same `to_table`, all statements except the final one would fail silently. For example, the following code: def change create_table :flights do |t| t.integer :from_id, index: true, null: false t.integer :to_id, index: true, null: false t.foreign_key :airports, column: :from_id t.foreign_key :airports, column: :to_id end end Would only create one foreign key, on the column `from_id`. This commit allows multiple foreign keys to the same table to be created within one `create_table` block.
* Merge pull request #23359 from kamipo/make_to_primary_keyRafael França2016-02-011-24/+0
|\ | | | | Make to primary key instead of an unique index for internal tables
| * Make to primary key instead of an unique index for internal tablesRyuta Kamizono2016-01-311-24/+0
| |
* | Added test for backward compatibility of null constraints on timestamp columnsPrathamesh Sonpatki2016-01-311-0/+30
|/
* Pare back default `index` option for the migration generatorPrathamesh Sonpatki2016-01-244-11/+29
| | | | | | | | | | - Using `references` or `belongs_to` in migrations will always add index for the referenced column by default, without adding `index:true` option to generated migration file. - Users can opt out of this by passing `index: false`. - Legacy migrations won't be affected by this change. They will continue to run as they were before. - Fixes #18146
* 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