Applied patch to rails model generator
What does this MR do and why?
This MR introduces a patch to the Rails model generator that was not using the template provided by GitLab itself.
This was noted on this comment.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
- Create a new model using the following command
bundle exec rails g model test_model
-
The command should generate these files:
app/models/test_model.rb
spec/models/test_model_spec.rb
db/migrate/<timestamp>_create_test_model.rb
-
Check that the content of the file
db/migrate/<timestamp>_create_test_model.rb
matches the following:
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class CreateTestModels < Gitlab::Database::Migration[2.0]
# When using the methods "add_concurrent_index" or "remove_concurrent_index"
# you must disable the use of transactions
# as these methods can not run in an existing transaction.
# When using "add_concurrent_index" or "remove_concurrent_index" methods make sure
# that either of them is the _only_ method called in the migration,
# any other changes should go in a separate migration.
# This ensures that upon failure _only_ the index creation or removing fails
# and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def change
create_table :test_models do |t|
end
end
end
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Marco Zille