From 6331ed16e5953e3a006896c6df07b0f82cfd2350 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 9 Feb 2017 20:25:39 +0100 Subject: Fix #614 - extra reply-boolean on statuses to account for cases when replied-to status is not in the system at time of distribution; fix #607 - reset privacy settings to defaults when cancelling replies --- db/migrate/20170209184350_add_reply_to_statuses.rb | 10 ++++++++++ db/schema.rb | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20170209184350_add_reply_to_statuses.rb (limited to 'db') diff --git a/db/migrate/20170209184350_add_reply_to_statuses.rb b/db/migrate/20170209184350_add_reply_to_statuses.rb new file mode 100644 index 000000000..c5074728b --- /dev/null +++ b/db/migrate/20170209184350_add_reply_to_statuses.rb @@ -0,0 +1,10 @@ +class AddReplyToStatuses < ActiveRecord::Migration[5.0] + def up + add_column :statuses, :reply, :boolean, nil: false, default: false + Status.update_all('reply = (in_reply_to_id IS NOT NULL)') + end + + def down + remove_column :statuses, :reply + end +end diff --git a/db/schema.rb b/db/schema.rb index 28a578aa2..86a05ebe6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170205175257) do +ActiveRecord::Schema.define(version: 20170209184350) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -197,6 +197,7 @@ ActiveRecord::Schema.define(version: 20170205175257) do t.integer "in_reply_to_account_id" t.integer "application_id" t.text "spoiler_text", default: "", null: false + t.boolean "reply", default: false t.index ["account_id"], name: "index_statuses_on_account_id", using: :btree t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id", using: :btree t.index ["reblog_of_id"], name: "index_statuses_on_reblog_of_id", using: :btree -- cgit