about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-05-12 19:09:21 +0200
committerGitHub <noreply@github.com>2017-05-12 19:09:21 +0200
commit5abdc77c8060a62ecf2259a1e9d63e862b9f7be7 (patch)
tree95b0a69d8943d6171ad19257af1655cd733fc245 /db/migrate
parentb5a9c6b3d292abc7e47d8a6f830f6b5589c04862 (diff)
Add conversation model, <ostatus:conversation /> (#3016)
* Add <ostatus:conversation /> tag to Atom input/output

Only uses ref attribute (not href) because href would be
the alternate link that's always included also.

Creates new conversation for every non-reply status. Carries
over conversation for every reply. Keeps remote URIs verbatim,
generates local URIs on the fly like the rest of them.

* Fix conversation migration

* More spec coverage for status before_create

* Prevent n+1 query when generating Atom with the new conversations

* Improve code style

* Remove redundant local variable
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170506235850_create_conversations.rb10
-rw-r--r--db/migrate/20170507000211_add_conversation_id_to_statuses.rb6
2 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20170506235850_create_conversations.rb b/db/migrate/20170506235850_create_conversations.rb
new file mode 100644
index 000000000..eaf66ded7
--- /dev/null
+++ b/db/migrate/20170506235850_create_conversations.rb
@@ -0,0 +1,10 @@
+class CreateConversations < ActiveRecord::Migration[5.0]
+  def change
+    create_table :conversations, id: :bigserial do |t|
+      t.string :uri, null: true, default: nil
+      t.timestamps
+    end
+
+    add_index :conversations, :uri, unique: true
+  end
+end
diff --git a/db/migrate/20170507000211_add_conversation_id_to_statuses.rb b/db/migrate/20170507000211_add_conversation_id_to_statuses.rb
new file mode 100644
index 000000000..d1ef7c290
--- /dev/null
+++ b/db/migrate/20170507000211_add_conversation_id_to_statuses.rb
@@ -0,0 +1,6 @@
+class AddConversationIdToStatuses < ActiveRecord::Migration[5.0]
+  def change
+    add_column :statuses, :conversation_id, :bigint, null: true, default: nil
+    add_index :statuses, :conversation_id
+  end
+end