aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration
Commit message (Collapse)AuthorAgeFilesLines
* `change_column_default` should be executed after type changingRyuta Kamizono2017-12-031-7/+10
| | | | | | | | | | | | | | | | | | | | If do not execute a type changing first, filling in default value may be failed. ``` % ARCONN=postgresql be ruby -w -Itest test/cases/migration/compatibility_test.rb -n test_legacy_change_column_with_null_executes_update Using postgresql Run options: -n test_legacy_change_column_with_null_executes_update --seed 20459 E Error: ActiveRecord::Migration::CompatibilityTest#test_legacy_change_column_with_null_executes_update: StandardError: An error has occurred, this and all later migrations canceled: PG::StringDataRightTruncation: ERROR: value too long for type character varying(5) : UPDATE "testings" SET "foo"='foobar' WHERE "foo" IS NULL ```
* Extract sql fragment generators for alter table from PostgreSQL adapterDinah Shi2017-12-021-0/+9
|
* Merge pull request #30510 from yhirano55/add_nodoc_to_activerecordEileen M. Uchitelle2017-11-251-1/+1
|\ | | | | Add :nodoc: to activerecord [ci skip]
| * Add :nodoc: to activerecord [ci skip]Yoshiyuki Hirano2017-09-031-1/+1
| |
* | compatibility - use int instead of bigintpavel2017-10-181-1/+1
| |
* | Extract repeatedly appeared prepending compatible table definitionRyuta Kamizono2017-10-051-25/+24
| |
* | Move integer-like primary key normalization to `new_column_definition`Ryuta Kamizono2017-09-231-7/+1
| | | | | | | | | | | | Currently the normalization only exists in `primary_key` shorthand. It should be moved to `new_column_definition` to also affect to `add_column` with primary key.
* | Adding legacy primary key should be compatibleRyuta Kamizono2017-09-231-0/+19
| | | | | | | | | | | | | | Currently implicit legacy primary key is compatible, but adding explicit legacy primary key is not compatible. It should also be fixed. Fixes #30664.
* | Use algorithm while removing index with db:rollbackMehmet Emin İNAÇ2017-09-211-2/+2
| | | | | | | | Closes #24190
* | make create_join_table compatible.Yuki Masutomi2017-09-201-0/+15
|/
* [ci skip] Postgres --> PostgreSQLRyuta Kamizono2017-08-081-1/+1
|
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-193-0/+6
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-023-3/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-013-0/+3
|
* `respond_to_missing?` should be privateRyuta Kamizono2017-04-221-6/+6
| | | | | | | Follow up of 03d3f036. Some of `respond_to?` were replaced to `respond_to_missing?` in 03d3f036. But the visibility is still public. It should be private.
* Start Rails 5.2 developmentMatthew Draper2017-03-221-1/+4
|
* The `default` arg of `index_name_exists?` makes to optionalRyuta Kamizono2017-02-131-2/+2
| | | | | | The `default` arg of `index_name_exists?` is only used the adapter does not implemented `indexes`. But currently all adapters implemented `indexes` (See #26688). Therefore the `default` arg is never used.
* `primary_key` and `references` columns should be identical typeRyuta Kamizono2017-02-071-1/+35
| | | | | | | | 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.
* Restore the behaviour of the compatibility layer for integer-like PKsRyuta Kamizono2017-02-041-0/+6
| | | | | | | | | | | | | | | | | | | | | The PR #27384 changed migration compatibility behaviour. ```ruby class CreateMasterData < ActiveRecord::Migration[5.0] def change create_table :master_data, id: :integer do |t| t.string :name end end end ``` Previously this migration created non-autoincremental primary key expected. But after the PR, the primary key changed to autoincremental, it is unexpected. This change restores the behaviour of the compatibility layer.
* Tweak bigint PK handlingMatthew Draper2017-01-181-2/+1
| | | | | | * Don't force PKs on tables that have explicitly opted out * All integer-like PKs are autoincrement unless they have an explicit default
* Fix UUID primary key with default nil in legacy migrationRyuta Kamizono2017-01-091-1/+1
| | | | | | UUID primary key with no default value feature (#10404, #18206) was lost in legacy migration caused by #25395 got merged. Restore the feature again in legacy migration.
* 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