Merge pull request #4941 from consul/reversible_migration_cop

Fix Rails/ReversibleMigration rule offenses
This commit is contained in:
Javi Martín
2022-08-26 14:58:45 +02:00
committed by GitHub
9 changed files with 47 additions and 9 deletions

View File

@@ -1,5 +1,9 @@
class ChangeDebatesTitleLength < ActiveRecord::Migration[4.2]
def change
def up
change_column :debates, :title, :string, limit: 80
end
def down
fail ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1,5 +1,9 @@
class RemoveUserConstraints < ActiveRecord::Migration[4.2]
def change
def up
change_column(:users, :email, :string, null: true, unique: true)
end
def down
fail ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1,5 +1,9 @@
class MakeCommentsConfidenceScoreDefaultTo0 < ActiveRecord::Migration[4.2]
def change
def up
change_column :comments, :confidence_score, :integer, default: 0, null: false, index: true
end
def down
fail ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1,5 +1,9 @@
class ActivateNewsletterByDefault < ActiveRecord::Migration[4.2]
def change
def up
change_column :users, :newsletter, :boolean, default: true
end
def down
fail ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1,5 +1,9 @@
class DefaultPasswordChangedAt < ActiveRecord::Migration[4.2]
def change
def up
change_column :users, :password_changed_at, :datetime, null: false, default: Time.zone.now
end
def down
fail ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1,5 +1,9 @@
class AdjustBudgetFields < ActiveRecord::Migration[4.2]
def change
def up
change_column :budgets, :phase, :string, limit: 40, default: "accepting"
end
def down
fail ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1,5 +1,9 @@
class ChangeNewsletterSegmentRecipientToString < ActiveRecord::Migration[4.2]
def change
def up
change_column :newsletters, :segment_recipient, :string, null: false
end
def down
fail ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1,6 +1,10 @@
class AddShortDescriptionToProposalDashboardActions < ActiveRecord::Migration[4.2]
def change
def up
add_column :proposal_dashboard_actions, :short_description, :string
change_column :proposal_dashboard_actions, :description, :text
end
def down
fail ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1,7 +1,13 @@
class ChangeAttachmentSizeFieldsToBigint < ActiveRecord::Migration[5.1]
def change
def up
change_column :site_customization_images, :image_file_size, :bigint
change_column :images, :attachment_file_size, :bigint
change_column :documents, :attachment_file_size, :bigint
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