aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration/change_table_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Index option added for change_table migrationsMehmet Emin INAC2018-09-221-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | In case if we want to add a column into the existing table with index on it, we have to add column and index in two seperate lines. With this feature we don't need to write an extra line to add index for column. We can just use `index` option. Old behaviour in action: ``` change_table(:languages) do |t| t.string :country_code t.index: :country_code end ``` New behaviour in action: ``` change_table(:languages) do |t| t.string :country_code, index: true end ``` Exactly same behaviour is already exist for `create_table` migrations.
* 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
|
* Virtual/generated column support for MySQL 5.7.5+ and MariaDB 5.2.0+Ryuta Kamizono2017-02-011-6/+1
| | | | | | | | | | | | | | | | | | | MySQL generated columns: https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html MariaDB virtual columns: https://mariadb.com/kb/en/mariadb/virtual-computed-columns/ Declare virtual columns with `t.virtual name, type: …, as: "expression"`. Pass `stored: true` to persist the generated value (false by default). Example: create_table :generated_columns do |t| t.string :name t.virtual :upper_name, type: :string, as: "UPPER(name)" t.virtual :name_length, type: :integer, as: "LENGTH(name)", stored: true t.index :name_length # May be indexed, too! end Closes #22589
* Change MySQL and Postgresql to use Bigint primary keysJon McCartie2016-12-051-1/+6
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-5/+5
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-1/+1
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-10/+10
|
* no more require minitest mockGaurav Sharma2015-08-271-1/+0
|
* The short-hand methods should be able to define multiple columnsRyuta Kamizono2015-02-231-1/+19
|
* Extract the short-hand methods into `ColumnMethods`Ryuta Kamizono2015-02-231-0/+8
|
* Extract `primary_key` method into `ColumnMethods`Ryuta Kamizono2015-02-221-0/+7
|
* Failure to rollback t.timestamps when within a change_table migrationnoam2014-12-031-2/+2
| | | | | | | | | | | | | When running the following migration: change_table(:table_name) { |t| t/timestamps } The following error was produced: wrong number of arguments (2 for 1) .... /connection_adapters/abstract/schema_statements.rb:851:in `remove_timestamps' This is due to `arguments` containing an empty hash as its second argument.
* add a Table#name accessor like TableDefinition#nameCody Cutrer2014-11-101-0/+6
|
* Change the default `null` value for timestampsSean Griffin2014-08-121-2/+2
| | | | | | | As per discussion, this changes the model generators to specify `null: false` for timestamp columns. A warning is now emitted if `timestamps` is called without a `null` option specified, so we can safely change the behavior when no option is specified in Rails 5.
* Allow to specify a type for foreign key column in migrationsAndrey Novikov2014-07-221-0/+14
| | | | [Andrey Novikov & Łukasz Sarnacki]
* 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.
* Change all `MiniTest` to `Minitest` since, `MiniTest` namespace has been ↵Vipul A M2013-12-181-1/+1
| | | | | | renamed to `Minitest` Ref: https://github.com/seattlerb/minitest/blob/master/History.txt
* Add active_support/testing/autorunRafael Mendonça França2012-12-311-0/+1
| | | | | minitest/autorun load minitest/spec polluting the global namespace with the DSL that we don't want on Rails
* Differentiate between remove_column and remove_columns. Make remove_column ↵Marc-Andre Lafortune2012-12-211-2/+2
| | | | | | reversible. [#8267]
* Simplify change_table and avoid duplicated logicMarc-Andre Lafortune2012-12-211-26/+5
|
* Add rename_index to change_table.Jarek Radosz2012-11-191-0/+7
|
* Refactor references schema definitionsAleksey Magusev2012-07-031-16/+12
|
* port some mocha to minitest/mockAaron Patterson2012-05-181-0/+221