aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/migration_generator_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add migrations_paths option to migration generatorEileen Uchitelle2018-08-301-0/+9
| | | | | | | | | | | | | Adds an option to the migration generator to allow setting the migrations paths for that migration. This is useful for applications that use multiple databases and put migrations per database in their own directories. ``` bin/rails g migration CreateHouses address:string --migrations-paths=db/kingston_migrate invoke active_record create db/kingston_migrate/20180830151055_create_houses.rb ```
* Permit list usage cleanup and clearer documentationKevin Deisz2018-08-271-2/+2
|
* Convert over the rest of the blacklist referencesKevin Deisz2018-08-241-2/+2
|
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Handling add/remove to/from migration edge casesGuilherme Reis Campos2017-08-031-0/+22
| | | | Making sure the table name is parsed correctly when an add/remove column migration have 'from'/'to' in the table name.
* 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
|
* Should escape meta characters in regexpRyuta Kamizono2017-05-071-4/+4
|
* Move config reset to ensure blockAndrew White2017-01-171-1/+2
| | | | We don't want to leak the extra migration path to other railties tests.
* Generate migrations at path set by `config.paths["db/migrate"]`Kevin Glowacz2017-01-161-0/+10
|
* applies new string literal convention in railties/testXavier Noria2016-08-061-4/+4
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Pare back default `index` option for the migration generatorPrathamesh Sonpatki2016-01-241-6/+6
| | | | | | | | | | - 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
* Ensure generated migrations include a version numberMatthew Draper2015-12-151-2/+2
|
* Use thor class_option to make the primary_key_type option workRafael Mendonça França2015-10-231-6/+1
| | | | Also move the method to the right class
* Move default uuid generation to active_recordJon McCartie2015-10-231-3/+4
|
* Set active_record config for always creating uuids in generatorsJon McCartie2015-10-201-0/+13
|
* Add Secure Token Generatorrobertomiranda2015-01-111-0/+24
|
* Add test missed by a03ea684efc3505647cf0327a501aa2dbb591ad2Sean Griffin2014-12-221-2/+3
|
* Use the new `foreign_key` option on `references` in generatorsSean Griffin2014-12-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes `rails g model Post user:references` from def change create_table :posts do |t| t.references :user, index: true end add_foreign_key :posts, :users end to def change create_table :posts do |t| t.references :user, index: true, foreign_key: true end end Changes `rails g migration add_user_to_posts user:references` from def change add_reference :posts, :users, index: true add_foreign_key :posts, :users end to def change add_reference :posts, :users, index: true, foreign_key: true end
* Generators add foreign keys on referencesDerek Prior2014-11-251-1/+25
| | | | | | | | | | | If you run a generator such as: ``` rails generate model accounts supplier:references ``` The resulting migration will now add the corresponding foreign key constraint unless the reference was specified to be polymorphic.
* Add a `required` option to the model generatorSean Griffin2014-08-081-0/+12
| | | | | | | | | | | Syntax was chosen to follow the passing of multiple options to decimal/numeric types. Curly braces, and allowing any of `,`, `.`, or `-` to be used as a separator to avoid the need for shell quoting. (I'm intending to expand this to all columns, but that's another PR. The `required` option will cause 2 things to change. `required: true` will be added to the association. `null: false` will be added to the column in the migration.
* Fix Generation of proper migration whenKuldeep Aggarwal2014-03-251-0/+50
| | | | | | | | | | | | ActiveRecord::Base.pluralize_table_names = false. Previously, generation a migration like this: rails g migration add_column_name_to_user name would not generating the correct table name. Fixes #13426.
* Support creating a table migration generatorSammy Larbi2013-03-011-3/+14
| | | | | | | | | | | | | | | | Sometimes you want to create a table without an associated model and test, which is also not a join table. With this commit, you can now do that. Example: rails g migration create_posts title:string or rails g migration CreatePosts title:string This commit also moves the template the model generator uses for the migration to the migration templates folder, as it seems a more sensible place for it now that it is shared code.
* Migration generators use `change` even for destructive methods [#8267]Marc-Andre Lafortune2012-12-211-31/+12
|
* Simple replacement of variable name for consistencyMarc-Andre Lafortune2012-12-211-32/+32
|
* add mini-validator on creating migrationJan Bernacki2012-09-061-0/+7
| | | | move validation to AR
* Add fkey attributes to `join_table` migration generatorAleksey Magusev2012-07-191-1/+1
|
* Add join table migration generatorAleksey Magusev2012-07-181-0/+13
| | | | | | | | | | | | | For instance, running rails g migration CreateMediaJoinTable artists musics:uniq will create a migration with create_join_table :artists, :musics do |t| # t.index [:artist_id, :music_id] t.index [:music_id, :artist_id], unique: true end
* Add references statements to migration generatorAleksey Magusev2012-07-081-0/+29
| | | | | | | | | | | | | AddXXXToYYY/RemoveXXXFromYYY migrations are produced with references statements, for instance rails g migration AddReferencesToProducts user:references supplier:references{polymorphic} will generate the migration with: add_reference :products, :user, index: true add_reference :products, :supplier, polymorphic: true, index: true
* Usage file in generators shouldn't be fetched only based on source_rootPiotr Sarnacki2012-04-011-0/+4
| | | | | | | | In case `source_roout` is not set, `default_source_root` is used, which includes also `templates` directory. If there is no `templates` directory, `default_source_root` is not available and USAGE will not be displayed. USAGE should be also checked based on default directory excluding `templates`.
* Avoid another blank line in generated migration and remove assertion as per ↵Marcelo Silveira2012-03-211-1/+0
| | | | @spastorino request
* Merge pull request #5532 from mhfs/migration_blank_lineJosé Valim2012-03-211-0/+1
|\ | | | | Remove blank line from generated migration
| * Remove blank line from generated migrationMarcelo Silveira2012-03-201-0/+1
| |
* | Generate Migration Thats Adds Removed IndexTravis Jeffery2012-03-211-0/+18
|/ | | | | When generating a migration that removes a field with an index, the down will add both the field and its index.
* Support decimal{1,2} and decimal{1-2} and decimal{1.2} so it works fine with ↵José Valim2012-01-221-3/+3
| | | | | | | | bash, zsh, etc, closes #4602 Conflicts: railties/test/generators/migration_generator_test.rb
* Use 1.9 hash syntax instead.José Valim2011-12-241-7/+7
|
* assert_not_match -> assert_no_match.José Valim2011-12-241-2/+2
|
* Tidy up migration types.José Valim2011-12-241-1/+1
|
* added ability to specify from cli when generating a model/migration whether ↵Dmitrii Samoilov2011-12-241-0/+62
| | | | particular property should be an index like this 'rails g model person name:string:index profile:string'
* be sure to parenthesize the arguments when the first one is a RegExp literalAkira Matsuda2011-05-181-8/+8
| | | | | | this fixes: "warning: ambiguous first argument; put parentheses or even spaces" because: you need this to tell the parser that you're not calling :/ method (division) details (Japanese!): http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-dev/42445?42370-43277
* Use Rails 3.1 `change` method in 'add_' migration generatorPrem Sichanugrist2011-01-041-6/+1
|
* Facepunch failing tests.José Valim2010-11-181-6/+6
|
* Add test for migration generator with name not starting with add or remove. ↵rohit2010-06-201-0/+15
| | | | | | [#4835 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Make the migration generator handle pre-existing migrations with the same ↵Phil Smith2010-04-191-0/+13
| | | | | | | | | | timestamp. In the event a migration already exists with that number, the new migration's timestamp will be incremented by 1. [#4412 state:resolved] Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Load generators from both lib/rails/generators and lib/generators. Using the ↵José Valim2010-03-231-1/+1
| | | | former since it's less obstrusive.
* Get generators tests running on Ruby 1.9.1José Valim2010-01-191-1/+3
|
* Generators load path now will be Ruby load path. If you want to use ↵José Valim2010-01-181-1/+1
| | | | rspec:install generator, you need generators/rspec/install_generator in your load path.
* Move all generators tests to use new test case syntax.José Valim2010-01-031-21/+12
|
* Create Rails::Generators::TestCase.José Valim2010-01-031-4/+4
|
* CI breakageYehuda Katz2009-11-021-1/+1
| | | | This reverts commit a288b74f1c75c6f100de7611a5093a421f1ad6d1.