aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration
Commit message (Collapse)AuthorAgeFilesLines
* Raises when `ActiveRecord::Migration` is inherited directly.Rafael Mendonça França2016-12-291-41/+21
|
* Remove unnecessary `connection_name` variableRyuta Kamizono2016-12-061-2/+1
|
* Make pg adapter use bigserial for pk by defaultPavel Pravosud2016-12-051-1/+11
|
* For `PostgreSQL >= 9.4` use `gen_random_uuid()`Yaw Boakye2016-11-221-0/+8
| | | | | | | | | | Since 9.4, PostgreSQL recommends using `pgcrypto`'s `gen_random_uuid()` to generate version 4 UUIDs instead of the functions in the `uuid-ossp` extension. These changes uses the appropriate UUID function depending on the underlying PostgreSQL server's version, while maintaining `uuid_generate_v4()` in older migrations.
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-1/+1
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Fix broken heredoc indentation caused by rubocop auto-correctRyuta Kamizono2016-09-031-4/+4
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But heredocs was still kept absolute position. This commit aligns heredocs indentation for consistency.
* Override `respond_to_missing?` instead of `respond_to?` when possibleSean Griffin2016-08-311-1/+1
| | | | | | | | | | This was almost every case where we are overriding `respond_to?` in a way that mirrors a parallel implementation of `method_missing`. There is one remaining case in Active Model that should probably do the same thing, but had a sufficiently strange implementation that I want to investigate it separately. Fixes #26333.
* Avoid to allow unused splat args for `t.timestamps` in `create_table`Ryuta Kamizono2016-08-141-2/+2
| | | | | | Unfortunately `t.timestamps` in `create_table` allows unused splat args. But the same one in `change_table` does not allow them. This commit fixes the inconsistent behavior.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-063-106/+106
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Add migration compatibility class for Rails 5.1Rafael Mendonça França2016-05-101-1/+4
|
* Migrations: move version-finding responsibilityyui-knk2016-04-291-0/+10
| | | | | | | `ActiveRecord::Migration` needn't know about migration version compatibility lookup. Delegate it to the Compatibility module. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Update compatibility.rbBogdan2016-03-261-1/+1
|
* Correctly show deprecation warning for incompatible migrationsPrathamesh Sonpatki2016-02-121-1/+1
|
* Intervene on change_table as well as create_tableMatthew Draper2016-01-301-0/+13
|
* Pare back default `index` option for the migration generatorPrathamesh Sonpatki2016-01-241-0/+12
| | | | | | | | | | - 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-2/+3
|
* Support removing custom-names indexes when only specifying column namesGrey Baker2015-12-151-0/+25
|
* Ignore index name in `index_exists?` when not passed a name to check forGrey Baker2015-12-151-0/+11
|
* In 4.2 migrations, `timestamps` defaulted to `null: true`Matthew Draper2015-12-151-0/+24
| | | | | .. it also showed a deprecation warning, but we obviously needn't retain that.
* Add migration versioning via Migration subclassesMatthew Draper2015-12-151-0/+30
|
* adding basic change_column and remove_columns in CommandRecorder ↵Gaurav Sharma2015-09-291-0/+2
| | | | documentations [ci skip]
* Merge pull request #21412 from yui-knk/feature/irreversible_migration_error_msgYves Senn2015-09-041-1/+6
|\ | | | | | | Add detailed error message to `IrreversibleMigration`
| * Add detailed error message to `IrreversibleMigration`yui-knk2015-08-301-1/+6
| |
| * Add detailed error message to `IrreversibleMigration`yui-knk2015-08-281-1/+1
| |
| * Add detailed error message to `IrreversibleMigration`yui-knk2015-08-281-1/+1
| |
* | Merge pull request #21432 from yui-knk/fix/what_change_method_can_reverseSean Griffin2015-08-301-1/+13
|\ \ | | | | | | [ci skip] Update what methods `Migration#change` can reverse
| * | [ci skip] Update what methods `Migration#change` can reverseyui-knk2015-08-311-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Documentations and comments about what methods `Migration#change` can reverse is out of date. For example `change_column_default` is now reversible by this [commit](https://github.com/rails/rails/pull/20018). * Comments about `CommandRecorder` dose not match with Rails Guide. For example `add_foreign_key` is listed only on Rails Guide.
* | | Merge pull request #21429 from yui-knk/fix/revert_disable_extensionSean Griffin2015-08-301-1/+1
|\ \ \ | |/ / |/| | Make revert of `disable_extension` to work
| * | Make revert of `disable_extension` to workyui-knk2015-08-301-1/+1
| |/ | | | | | | | | | | 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.
* | Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-08-301-1/+1
|\ \ | |/ |/|
| * [ci skip] Capitalize commentsyui-knk2015-08-291-1/+1
| |
* | Make `change_column_default` to workyui-knk2015-08-251-8/+8
|/ | | | | | | | | | | | 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
* Add reversible syntax for change_column_defaultPrem Sichanugrist2015-06-261-1/+11
| | | | | | | | | | | | | 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-7/+9
| | | | | | | | | 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-0/+10
|
* Merge pull request #16305 from tomkadwill/documented_change_tableRafael Mendonça França2014-07-281-1/+1
|\ | | | | Added documentation for change_table
| * Added nodoc to change_tableTom Kadwill2014-07-281-1/+1
| |
* | create_join_table uses same logic as HABTM reflectionsStefan Kanev2014-07-181-1/+1
| | | | | | | | | | | | | | | | Before this change, create_join_table would not remove the common prefix in the join table name, unlike ActiveRecord::Reflections. A HABTM between Music::Artist and Music::Record would use a table music_artists_records, while create_join table would create music_artists_music_records.
* | fk: review corrections: indent, visibility, syntax, wording.Yves Senn2014-06-261-3/+3
| |
* | fk: infere column name from table names.Yves Senn2014-06-261-1/+3
| | | | | | | | This allows to create and remove foreign keys without specifying a column.
* | fk: make `add_foreign_key` reversible.Yves Senn2014-06-261-1/+16
|/
* Drop the correct index after reverting a migrationHubert Dąbrowski2014-02-131-1/+6
| | | | | | Previously when reverting a migration which added a named index it would instead drop a corresponding index with matching columns but without a name.
* make `change_column_null` reversible. Closes #13576.Yves Senn2014-01-081-1/+6
| | | | Closes #13623.
* Make change_table use object of current database adapterNishant Modak2014-01-071-4/+6
| | | | | | | | | - Earlier, change_table was creating database-agnostic object. - After this change, it will create correct object based on current database adapter. - This will ensure that create_table and change_table will get same objects. - This makes update_table_definition method public and nodoc. - Fixes #13577 and #13503
* Make 'enable_extension' revertibleEric Tipton2013-08-101-1/+2
| | | | | If 'enable_extension' is used in a migration's 'change' method, use 'disable_extension' on down migration (and vice-versa).
* raise IrreversibleMigration if no column givenNeeraj Singh2013-05-061-1/+4
| | | | | | | | | | | | | | | 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-1/+2
| | | | | | | | * Fix Migration#reversible by not using `transaction`. * Adapt mysql adapter to updated api for remove_column * Update test after aedcd683684d08eaf30623a4b48ce31a31426372
* Remove duplicated methods in command recorder and duplicated test nameCarlos Antonio da Silva2012-12-211-3/+3
|
* Make execute, change_column and remove_columns methods actually irreversibleMarc-Andre Lafortune2012-12-211-1/+2
| | | | [#8267]