aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators/active_record/migration
Commit message (Collapse)AuthorAgeFilesLines
* [ci skip] Correct grammar, add docs to ActiveRecord migration generatorNick Cox2015-04-281-4/+5
|
* Add Secure Token Generatorrobertomiranda2015-01-112-0/+8
|
* Change the default `null` value for `timestamps` to `false`Rafael Mendonça França2015-01-041-1/+1
|
* Use the new `foreign_key` option on `references` in generatorsSean Griffin2014-12-222-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-252-0/+9
| | | | | | | | | | | 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.
* Merge pull request #16062 from sgrif/sg-required-generatorsRafael Mendonça França2014-08-171-1/+1
|\ | | | | Add a `required` option to the model generator
| * Add a `required` option to the model generatorSean Griffin2014-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Change the default `null` value for timestampsSean Griffin2014-08-121-1/+1
|/ | | | | | | 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.
* Fix Generation of proper migration whenKuldeep Aggarwal2014-03-251-3/+7
| | | | | | | | | | | | 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.
* Added documentation for ↵aditya-kapoor2013-05-101-0/+4
| | | | ActiveRecord::Generators::MigrationGenerator.next_migration_number
* Add support for generate scaffold password:digestSam Ruby2013-03-131-0/+4
| | | | | | | | | | * adds password_digest attribute to the migration * adds has_secure_password to the model * adds password and password_confirmation password_fields to _form.html * omits password entirely from index.html and show.html * adds password and password_confirmation to the controller * adds unencrypted password and password_confirmation to the controller test * adds encrypted password_digest to the fixture
* Support creating a table migration generatorSammy Larbi2013-03-012-2/+24
| | | | | | | | | | | | | | | | 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-16/+4
|
* nodoc AR::Generators [ci skip]Francesco Rodriguez2012-10-201-3/+3
|
* add mini-validator on creating migrationJan Bernacki2012-09-061-0/+9
| | | | move validation to AR
* Add fkey attributes to `join_table` migration generatorAleksey Magusev2012-07-191-2/+10
|
* Add join table migration generatorAleksey Magusev2012-07-182-6/+27
| | | | | | | | | | | | | 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-4/+16
| | | | | | | | | | | | | 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
* Refactor migration generatorOscar Del Ben2012-05-181-6/+3
|
* Fix indenting in migration generatorColin Bartlett2012-03-271-2/+2
| | | | | | | | | | | | | | | | $ rails generate migration remove_foo_from_bars foo:string This currently generates: def up remove_column :bars, :foo end Fix it: def up remove_column :bars, :foo end
* Avoid another blank line in generated migration and remove assertion as per ↵Marcelo Silveira2012-03-211-1/+1
| | | | @spastorino request
* Merge pull request #5532 from mhfs/migration_blank_lineJosé Valim2012-03-211-1/+1
|\ | | | | Remove blank line from generated migration
| * Remove blank line from generated migrationMarcelo Silveira2012-03-201-1/+1
| |
* | Generate Migration Thats Adds Removed IndexTravis Jeffery2012-03-211-0/+3
|/ | | | | When generating a migration that removes a field with an index, the down will add both the field and its index.
* Tidy up migration types.José Valim2011-12-242-3/+3
|
* added ability to specify from cli when generating a model/migration whether ↵Dmitrii Samoilov2011-12-242-4/+10
| | | | particular property should be an index like this 'rails g model person name:string:index profile:string'
* Use Rails 3.1 `change` method in 'add_' migration generatorPrem Sichanugrist2011-01-041-0/+8
|
* updating generatorsAaron Patterson2010-11-171-2/+2
|
* Avoid a blank line before the add/remove columnsSantiago Pastorino2010-06-251-2/+2
|
* Line break in migration template and nicer code indentationŁukasz Strzałkowski2010-06-251-6/+8
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix problem with migrations template that can cause bogus code to be createdSteve Abatangle2010-06-201-4/+8
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Load generators from both lib/rails/generators and lib/generators. Using the ↵José Valim2010-03-232-0/+36
former since it's less obstrusive.