Skip to content
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

Closed

Conversation

nimir
Copy link
Contributor

@nimir nimir commented Aug 27, 2017

Fixes issue #278 by adding migrations versions e.g class CreateMeritActions < ActiveRecord::Migration[5.1] instead of current class CreateMeritActions < ActiveRecord::Migration

@@ -19,6 +19,12 @@ def copy_migrations_and_model
end
end

def migration_version
if Rails.version.start_with? '5'

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 %>

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 %>

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 %>

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 %>

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 %>

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 %>

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

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'

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

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'

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 %>

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 %>

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 %>

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 %>

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 %>

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

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'

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'

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.

Copy link
Member

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

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.

@merit-gem merit-gem deleted a comment from houndci-bot Aug 28, 2017
@merit-gem merit-gem deleted a comment from houndci-bot Aug 28, 2017
@merit-gem merit-gem deleted a comment from houndci-bot Aug 28, 2017
Copy link
Member

@tute tute left a 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
Copy link
Member

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.

Copy link
Contributor Author

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'
Copy link
Member

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)

@tute
Copy link
Member

tute commented Oct 17, 2017

Ping @nimir! Thank you for your work. ❤️

@tute
Copy link
Member

tute commented Jan 25, 2018

Closing in favor of #284. Thanks for your work!

@tute tute closed this Jan 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants