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

migration for changing status of comments #3006

Merged
merged 2 commits into from
Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions db/migrate/20180707065151_change_status_of_comments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class ChangeStatusOfComments < ActiveRecord::Migration[5.2]
def up
Comment.all.each do |comment|
comment.status = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this related to? Can't understand the context.

Copy link
Member Author

@grvsachdeva grvsachdeva Jul 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some time before we made a migration for setting default column value as 1 for comment, in that PR statement for changing previous comment status are also included but that doesn't work. So, right now in production DB, there is a mix of comments with status =1 and 0. For the implementation of Spam moderation system, it's required that all comments should carry status 1, otherwise many comments would become invisible. @siaw23 do you think this migration would work?

comment.save
end
end

def down
end
end
2 changes: 1 addition & 1 deletion db/schema.rb.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2018_07_05_203310) do
ActiveRecord::Schema.define(version: 2018_07_07_065151) do

create_table "answer_selections", force: true do |t|
t.integer "user_id"
Expand Down