aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/invertible_migration_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* make change_column_comment and change_table_comment invertibleYoshiyuki Kinjo2019-04-151-0/+59
| | | | | | | | | We can revert migrations using `change_column_comment` or `change_table_comment` at current master. However, results are not what we expect: comments are remained in new status. This change tells previous comment to these methods in a way like `change_column_default`.
* Support Optimizer HintsRyuta Kamizono2019-03-161-0/+2
| | | | | | | | | | | | | | | | | | We as Arm Treasure Data are using Optimizer Hints with a monkey patch (https://gist.github.com/kamipo/4c8539f0ce4acf85075cf5a6b0d9712e), especially in order to use `MAX_EXECUTION_TIME` (refer #31129). Example: ```ruby class Job < ApplicationRecord default_scope { optimizer_hints("MAX_EXECUTION_TIME(50000) NO_INDEX_MERGE(jobs)") } end ``` Optimizer Hints is supported not only for MySQL but also for most databases (PostgreSQL on RDS, Oracle, SQL Server, etc), it is really helpful to turn heavy queries for large scale applications.
* Fix `transaction` reverting for migrationsfatkodima2018-09-261-0/+16
| | | | [fatkodima & David Verhasselt]
* Fix `CustomCops/AssertNot` to allow it to have failure messageRyuta Kamizono2018-05-131-4/+4
| | | | Follow up of #32605.
* Replace `assert !` with `assert_not`Daniel Colson2018-04-191-9/+9
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Fix CI failure due to invalid `up_only` for MySQLRyuta Kamizono2017-11-151-5/+7
| | | | | | | | `oldie = 'true'` to `tinyint(1)` column is invalid value for MySQL: ``` Mysql2::Error: Incorrect integer value: 'true' for column 'oldie' at row 1: update horses set oldie = 'true' ```
* Add a #populate method to migrations (#31082)Rich2017-11-141-0/+25
| | | | | | | | | | | * Add a #populate method to migrations * Address rubocop issues * Rename to #up_only and use #execute in the examples intead of the model * Update CHANGELOG [Rich Daley & Rafael Mendonça França]
* Enable `hstore` extention disabled at the end of ↵Yasuo Honda2017-10-181-0/+2
| | | | | | | `InvertibleMigrationTest#test_migrate_enable_and_disable_extension` to avoid failure of `PostgresqlArrayTest#test_schema_dump_with_shorthand` which expects `hstore` extension enabled.
* 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
|
* `#tables` and `#table_exists?` and returns only tables and not viewsRafael Mendonça França2016-12-291-31/+23
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-2/+2
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-8/+8
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Respect options passed to `foreign_key` when reverting `add_reference`Sean Griffin2016-05-311-0/+15
| | | | | | | | | | | | The code incorrectly assumes that the option was written as `foreign_key: true`, but that is not always the case. This now mirrors the behavior of reverting `add_foreign_key`. The code was changed to use kwargs while I was touching it, as well. This could really use a refactoring to go through the same code paths as `add_refernce` in the future, so we don't duplicate default values. Fixes #25169
* 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.
* Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`yui-knk2015-11-091-23/+31
| | | | | | | | | | 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?`.
* Make revert of `disable_extension` to workyui-knk2015-08-301-0/+33
| | | | | | This is fix of #11826 which miss to add `disable_extension` to `ReversibleAndIrreversibleMethods`. So `CommandRecorder#method_missing` catches `change_column_default` and @delegate's method is called.
* Fix the unused variable warningakihiro172015-08-261-1/+0
| | | | | | | | This fixes the following warning. ```ruby warning: assigned but unused variable - index_definition ```
* Make `change_column_default` to workyui-knk2015-08-251-0/+33
| | | | | | | | | | | | This is fix of #20018 which removes `change_column_default` from array, so `CommandRecorder#method_missing` catches `change_column_default` and @delegate's method is called. This PR * fix this bug * define `ReversibleAndIrreversibleMethods` const making clear which this array means to prevent these miss
* make `remove_index :table, :column` reversible.Yves Senn2015-06-151-6/+10
| | | | | | | | | 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
* Silence another test that runs migrationsAkira Matsuda2014-08-291-0/+5
|
* Use teardown helper method.Guo Xiang Tan2014-03-141-1/+1
| | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* Skip test_migrate_revert_add_index_with_name if databasesYasuo Honda2014-02-251-10/+13
| | | | do not allow to create duplicate indexes on the same columns
* Drop the correct index after reverting a migrationHubert Dąbrowski2014-02-131-0/+28
| | | | | | Previously when reverting a migration which added a named index it would instead drop a corresponding index with matching columns but without a name.
* fix failing test caused by 3771e4d511Neeraj Singh2013-05-061-2/+2
|
* raise IrreversibleMigration if no column givenNeeraj Singh2013-05-061-0/+28
| | | | | | | | | | | | | | | fixes #10419 Following code should raise IrreversibleMigration. But the code was failing since options is an array and not a hash. def change change_table :users do |t| t.remove_index [:name, :email] end end Fix was to check if the options is a Hash before operating on it.
* Fixes for PR [#8267]Marc-Andre Lafortune2012-12-221-2/+4
| | | | | | | | * Fix Migration#reversible by not using `transaction`. * Adapt mysql adapter to updated api for remove_column * Update test after aedcd683684d08eaf30623a4b48ce31a31426372
* Make drop_table reversible [#8267]Marc-Andre Lafortune2012-12-211-3/+3
|
* Add Migration#reversible for reversible data operations [#8267]Marc-Andre Lafortune2012-12-211-0/+39
|
* Allow revert of whole migration [#8267]Marc-Andre Lafortune2012-12-211-0/+63
|
* Allow reverting of migration commands with Migration#revert [#8267]Marc-Andre Lafortune2012-12-211-0/+23
|
* migrate(:down) method with table_name_prefixkennyj2012-01-111-0/+12
|
* Ensure that .up and .down work as well.Christopher Meiklejohn2011-08-021-2/+13
|
* Support backwards compatible interface for migration down/up with rails 3.0.x.Christopher Meiklejohn2011-08-021-0/+24
|
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* fisting typeo, thanks @vinibaggioAaron Patterson2010-11-191-1/+1
|
* fisting my spelling errorsAaron Patterson2010-11-191-0/+57