about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-10-19 01:47:29 +0200
committerGitHub <noreply@github.com>2018-10-19 01:47:29 +0200
commita38a452481d0f5207bb27ba7a2707c0028d2ac18 (patch)
tree5dfe4cab0fd6ebe15c924bd83e3abb6efca210db /db
parentbebe8ec887ba67c51353e09d7758819b117bf62d (diff)
Add unread indicator to conversations (#9009)
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20181018205649_add_unread_to_account_conversations.rb23
-rw-r--r--db/schema.rb3
2 files changed, 25 insertions, 1 deletions
diff --git a/db/migrate/20181018205649_add_unread_to_account_conversations.rb b/db/migrate/20181018205649_add_unread_to_account_conversations.rb
new file mode 100644
index 000000000..3c28b9a64
--- /dev/null
+++ b/db/migrate/20181018205649_add_unread_to_account_conversations.rb
@@ -0,0 +1,23 @@
+require Rails.root.join('lib', 'mastodon', 'migration_helpers')
+
+class AddUnreadToAccountConversations < ActiveRecord::Migration[5.2]
+  include Mastodon::MigrationHelpers
+
+  disable_ddl_transaction!
+
+  def up
+    safety_assured do
+      add_column_with_default(
+        :account_conversations,
+        :unread,
+        :boolean,
+        allow_null: false,
+        default: false
+      )
+    end
+  end
+
+  def down
+    remove_column :account_conversations, :unread, :boolean
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f79f26f16..046975ac9 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: 2018_10_10_141500) do
+ActiveRecord::Schema.define(version: 2018_10_18_205649) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -22,6 +22,7 @@ ActiveRecord::Schema.define(version: 2018_10_10_141500) do
     t.bigint "status_ids", default: [], null: false, array: true
     t.bigint "last_status_id"
     t.integer "lock_version", default: 0, null: false
+    t.boolean "unread", default: false, null: false
     t.index ["account_id", "conversation_id", "participant_account_ids"], name: "index_unique_conversations", unique: true
     t.index ["account_id"], name: "index_account_conversations_on_account_id"
     t.index ["conversation_id"], name: "index_account_conversations_on_conversation_id"