aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'migration-timestamp-fix'Gannon McGibbon2019-05-101-0/+1
|\ | | | | | | Closes #28707.
| * Add class option timestamps to migration generatorMichael Duchemin2019-02-091-0/+1
| | | | | | | | Fixes GH#28706. Now rails g migration create_users and rails g model User have the same behavior for timestamps since they implement the same migration template. The expected behavior is that this create table migration will create the table with timestamps unless you pass --no-timestamps or --skip-timestamps to the generator. The expected migration should match what you get when you use the model generator. Using the migration generator, which doesn't have a class_option for timestamps would cause them to not be added to the migration file. Now the migration behavior of the migration generator, create_table only, is aligned with the migration behavior of the model generator. Also modified relevant example of ActiveRecord Migrations Guide.
* | Make aliases of `database` option in generators workyuuji.yaginuma2019-03-201-1/+1
|/ | | | | | | | | | | Thor automatically adds `-` if aliases do not start with `-`. https://github.com/erikhuda/thor/blob/0879c1773d188902d54f95174f33961ac33111f8/lib/thor/parser/options.rb#L53 But Thor follows a convention of one-dash-one-letter options. So, even if `-` is added to `db`, it does not work. https://github.com/erikhuda/thor/blob/0879c1773d188902d54f95174f33961ac33111f8/lib/thor/parser/options.rb#L4 Follow up #34021.
* Refactor migrations_path command option to databaseGannon McGibbon2018-09-281-1/+1
|
* Add migrations_paths option to migration generatorEileen Uchitelle2018-08-301-0/+1
| | | | | | | | | | | | | 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 ```
* Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-171-5/+1
|
* Handling add/remove to/from migration edge casesGuilherme Reis Campos2017-08-031-1/+1
| | | | Making sure the table name is parsed correctly when an add/remove column migration have 'from'/'to' in the table name.
* 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
|
* move `db_migrate_path` method to `Migration` moduleyuuji.yaginuma2017-01-221-8/+0
| | | | | Since `Migration` module is included in both `MigrationGenerator` and `ModelGenerator`, no need to define a common method for each class.
* Generate migrations at path set by `config.paths["db/migrate"]`Kevin Glowacz2017-01-161-1/+9
|
* No need `:doc:` for `:nodoc:` classes [ci skip]Ryuta Kamizono2016-12-251-3/+3
| | | | | | Follow up to 5b14129d8d4ad302b4e11df6bd5c7891b75f393c. http://edgeapi.rubyonrails.org/classes/ActiveRecord/Attribute.html
* Privatize unneededly protected methods in Active RecordAkira Matsuda2016-12-241-4/+5
|
* Describe what we are protectingAkira Matsuda2016-12-231-0/+2
|
* let Regexp#match? be globally availableXavier Noria2016-10-271-1/+0
| | | | | | Regexp#match? should be considered to be part of the Ruby core library. We are emulating it for < 2.4, but not having to require the extension is part of the illusion of the emulation.
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-3/+3
| | | | | | 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.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-27/+27
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-061-3/+3
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* adds missing requiresXavier Noria2016-07-241-0/+1
|
* systematic revision of =~ usage in ARXavier Noria2016-07-231-1/+1
| | | | | Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* Use thor class_option to make the primary_key_type option workRafael Mendonça França2015-10-231-0/+2
| | | | Also move the method to the right class
* [ci skip] Correct grammar, add docs to ActiveRecord migration generatorNick Cox2015-04-281-4/+5
|
* 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.
* 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
* Support creating a table migration generatorSammy Larbi2013-03-011-2/+9
| | | | | | | | | | | | | | | | 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.
* 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-181-5/+18
| | | | | | | | | | | | | 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
* 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-1/+1
| | | | particular property should be an index like this 'rails g model person name:string:index profile:string'
* Load generators from both lib/rails/generators and lib/generators. Using the ↵José Valim2010-03-231-0/+25
former since it's less obstrusive.