aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration/compatibility.rb
Commit message (Collapse)AuthorAgeFilesLines
* Start Rails 6.1 developmentRafael Mendonça França2019-04-241-1/+4
|
* make change_column_comment and change_table_comment invertibleYoshiyuki Kinjo2019-04-151-0/+10
| | | | | | | | | 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`.
* Avoid implicit delegation in the migration compatibilityRyuta Kamizono2019-02-121-12/+14
| | | | | | | The implicit delegation in the migration class is to be logged. It is not intended in the migration compatibility, so it should be avoided. Fixes #35224.
* Make `t.timestamps` with precision by defaultRyuta Kamizono2019-01-261-48/+47
|
* Fix type casting column default in `change_column`Ryuta Kamizono2019-01-201-3/+1
| | | | | | | | | | | | | | Since #31230, `change_column` is executed as a bulk statement. That caused incorrect type casting column default by looking up the before changed type, not the after changed type. In a bulk statement, we can't use `change_column_default_for_alter` if the statement changes the column type. This fixes the type casting to use the constructed target sql_type. Fixes #34938.
* Fix `transaction` reverting for migrationsfatkodima2018-09-261-0/+15
| | | | [fatkodima & David Verhasselt]
* Fix `Unknown migration version "6.0"`Yuji Yaginuma2018-01-311-1/+4
|
* Remove default ENGINE=InnoDB for Mysql2 adapterAlberto Almagro2017-12-111-0/+8
| | | | | | | | | | | | | Before this commit ENGINE=InnoDB was added by default to Mysql2 adapter +create_table+ if no +options+ option was provided. This default ENGINE was lost as soon as something was passed in at +options+ option, making its goal and propagation inconsistent, as the programmer needed to remember including ENGINE=InnoDB when something was passed in. This commit removes default ENGINE as its use isn't needed anymore for current MySQL and MariaDB versions. It adds compatibility support and tests to ensure that default ENGINE is still present for migrations with version 5.1 and before. It also ensures we still dump the ENGINE option to +schema.rb+ in order to avoid inconsistencies.
* `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
|
* 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.
* 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-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
|
* 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.
* 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-061-12/+12
|
* 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