Fix Rails/ReversibleMigration rule offenses
We forgot to do so in commitfc757428e, when we upgraded rubocop-rails. In this upgrade, this rule was changed to include the `change_column` method. Just like we did in commitdf959b74f, I'm raising an `ActiveRecord::IrreversibleMigration` exception in migrations done before version 1.0.0, since making all of them reversible would be too much work for little benefit.
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
class ChangeDebatesTitleLength < ActiveRecord::Migration[4.2]
|
class ChangeDebatesTitleLength < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
change_column :debates, :title, :string, limit: 80
|
change_column :debates, :title, :string, limit: 80
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
fail ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
class RemoveUserConstraints < ActiveRecord::Migration[4.2]
|
class RemoveUserConstraints < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
change_column(:users, :email, :string, null: true, unique: true)
|
change_column(:users, :email, :string, null: true, unique: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
fail ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
class MakeCommentsConfidenceScoreDefaultTo0 < ActiveRecord::Migration[4.2]
|
class MakeCommentsConfidenceScoreDefaultTo0 < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
change_column :comments, :confidence_score, :integer, default: 0, null: false, index: true
|
change_column :comments, :confidence_score, :integer, default: 0, null: false, index: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
fail ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
class ActivateNewsletterByDefault < ActiveRecord::Migration[4.2]
|
class ActivateNewsletterByDefault < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
change_column :users, :newsletter, :boolean, default: true
|
change_column :users, :newsletter, :boolean, default: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
fail ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
class DefaultPasswordChangedAt < ActiveRecord::Migration[4.2]
|
class DefaultPasswordChangedAt < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
change_column :users, :password_changed_at, :datetime, null: false, default: Time.zone.now
|
change_column :users, :password_changed_at, :datetime, null: false, default: Time.zone.now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
fail ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
class AdjustBudgetFields < ActiveRecord::Migration[4.2]
|
class AdjustBudgetFields < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
change_column :budgets, :phase, :string, limit: 40, default: "accepting"
|
change_column :budgets, :phase, :string, limit: 40, default: "accepting"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
fail ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
class ChangeNewsletterSegmentRecipientToString < ActiveRecord::Migration[4.2]
|
class ChangeNewsletterSegmentRecipientToString < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
change_column :newsletters, :segment_recipient, :string, null: false
|
change_column :newsletters, :segment_recipient, :string, null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
fail ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
class AddShortDescriptionToProposalDashboardActions < ActiveRecord::Migration[4.2]
|
class AddShortDescriptionToProposalDashboardActions < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
add_column :proposal_dashboard_actions, :short_description, :string
|
add_column :proposal_dashboard_actions, :short_description, :string
|
||||||
change_column :proposal_dashboard_actions, :description, :text
|
change_column :proposal_dashboard_actions, :description, :text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
fail ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
class ChangeAttachmentSizeFieldsToBigint < ActiveRecord::Migration[5.1]
|
class ChangeAttachmentSizeFieldsToBigint < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def up
|
||||||
change_column :site_customization_images, :image_file_size, :bigint
|
change_column :site_customization_images, :image_file_size, :bigint
|
||||||
change_column :images, :attachment_file_size, :bigint
|
change_column :images, :attachment_file_size, :bigint
|
||||||
change_column :documents, :attachment_file_size, :bigint
|
change_column :documents, :attachment_file_size, :bigint
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
change_column :site_customization_images, :image_file_size, :integer
|
||||||
|
change_column :images, :attachment_file_size, :integer
|
||||||
|
change_column :documents, :attachment_file_size, :integer
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user