-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add migrations versions - Fixes issue 278 #279
Conversation
@@ -19,6 +19,12 @@ def copy_migrations_and_model | |||
end | |||
end | |||
|
|||
def migration_version | |||
if Rails.version.start_with? '5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -1,4 +1,4 @@ | |||
class RemoveMeritTables < ActiveRecord::Migration | |||
class RemoveMeritTables < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unterminated string meets end of file
@@ -1,4 +1,4 @@ | |||
class RemoveMeritFieldsFrom<%= table_name.camelize %> < ActiveRecord::Migration | |||
class RemoveMeritFieldsFrom<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
@@ -1,4 +1,4 @@ | |||
class CreateScoresAndPoints < ActiveRecord::Migration | |||
class CreateScoresAndPoints < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unterminated string meets end of file
@@ -1,4 +1,4 @@ | |||
class CreateSashes < ActiveRecord::Migration | |||
class CreateSashes < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unterminated string meets end of file
@@ -1,5 +1,6 @@ | |||
class AddTargetDataToMeritActions < ActiveRecord::Migration | |||
class AddMeritFieldsTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
@@ -1,4 +1,4 @@ | |||
class AddMeritFieldsTo<%= table_name.camelize %> < ActiveRecord::Migration | |||
class AddMeritFieldsTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at class body end.
@@ -21,6 +21,13 @@ def copy_migrations_and_model | |||
"db/migrate/remove_merit_fields_from_#{table_name}.rb" | |||
) | |||
end | |||
|
|||
def migration_version | |||
if Rails.version.start_with? '5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at class body end.
@@ -19,6 +19,12 @@ def copy_migrations_and_model | |||
end | |||
end | |||
|
|||
def migration_version | |||
if Rails.version.start_with? '5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -1,4 +1,4 @@ | |||
class RemoveMeritTables < ActiveRecord::Migration | |||
class RemoveMeritTables < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unterminated string meets end of file
@@ -1,4 +1,4 @@ | |||
class RemoveMeritFieldsFrom<%= table_name.camelize %> < ActiveRecord::Migration | |||
class RemoveMeritFieldsFrom<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
@@ -1,4 +1,4 @@ | |||
class CreateScoresAndPoints < ActiveRecord::Migration | |||
class CreateScoresAndPoints < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unterminated string meets end of file
@@ -1,4 +1,4 @@ | |||
class CreateSashes < ActiveRecord::Migration | |||
class CreateSashes < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unterminated string meets end of file
@@ -1,4 +1,4 @@ | |||
class AddMeritFieldsTo<%= table_name.camelize %> < ActiveRecord::Migration | |||
class AddMeritFieldsTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at class body end.
@@ -21,6 +21,13 @@ def copy_migrations_and_model | |||
"db/migrate/remove_merit_fields_from_#{table_name}.rb" | |||
) | |||
end | |||
|
|||
def migration_version | |||
if Rails.version.start_with? '5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -16,6 +16,13 @@ def copy_migrations_and_model | |||
migration_template 'add_merit_fields_to_model.rb', | |||
"db/migrate/add_merit_fields_to_#{table_name}.rb" | |||
end | |||
|
|||
def migration_version | |||
if Rails.version.start_with? '5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing about unneeded condition (and elsewhere)
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at class body end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @nimir! Left a few comments that apply to all migrations. This is looking good! ❤️
def migration_version | ||
if Rails.version.start_with? '5' | ||
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, Nimir! We can assume we are always on 5
, as master
only targets that version. Until we have Rails 6, we shouldn't need this conditional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, thought we needed backward compatibility with older rails versions! but yeah, if master is only for Rails > 5 then we can skip the check!
@@ -16,6 +16,13 @@ def copy_migrations_and_model | |||
migration_template 'add_merit_fields_to_model.rb', | |||
"db/migrate/add_merit_fields_to_#{table_name}.rb" | |||
end | |||
|
|||
def migration_version | |||
if Rails.version.start_with? '5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing about unneeded condition (and elsewhere)
Ping @nimir! Thank you for your work. ❤️ |
Closing in favor of #284. Thanks for your work! |
Fixes issue #278 by adding migrations versions e.g
class CreateMeritActions < ActiveRecord::Migration[5.1]
instead of currentclass CreateMeritActions < ActiveRecord::Migration