| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
| |
|
|
|
|
| |
Also move the method to the right class
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
move validation to AR
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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`.
|
|
|
|
| |
@spastorino request
|
|\
| |
| | |
Remove blank line from generated migration
|
| | |
|
|/
|
|
|
| |
When generating a migration that removes a field with an index, the down
will add both the field and its index.
|
|
|
|
|
|
|
|
| |
bash, zsh, etc, closes #4602
Conflicts:
railties/test/generators/migration_generator_test.rb
|
| |
|
| |
|
| |
|
|
|
|
| |
particular property should be an index like this 'rails g model person name:string:index profile:string'
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
|
|
| |
[#4835 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
former since it's less obstrusive.
|
| |
|
|
|
|
| |
rspec:install generator, you need generators/rspec/install_generator in your load path.
|
| |
|
| |
|
|
|
|
| |
This reverts commit a288b74f1c75c6f100de7611a5093a421f1ad6d1.
|
|
|
|
| |
Signed-off-by: Yehuda Katz <wycats@gmail.com>
|
| |
|
| |
|
| |
|
| |
|
|
|