about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20161105130633_create_statuses_tags_join_table.rb8
-rw-r--r--db/schema.rb9
2 files changed, 16 insertions, 1 deletions
diff --git a/db/migrate/20161105130633_create_statuses_tags_join_table.rb b/db/migrate/20161105130633_create_statuses_tags_join_table.rb
new file mode 100644
index 000000000..8a436c6ea
--- /dev/null
+++ b/db/migrate/20161105130633_create_statuses_tags_join_table.rb
@@ -0,0 +1,8 @@
+class CreateStatusesTagsJoinTable < ActiveRecord::Migration[5.0]
+  def change
+    create_join_table :statuses, :tags do |t|
+      t.index :tag_id
+      t.index [:tag_id, :status_id], unique: true
+    end
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 3d0182ba9..a2d05b1bd 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: 20161104173623) do
+ActiveRecord::Schema.define(version: 20161105130633) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -160,6 +160,13 @@ ActiveRecord::Schema.define(version: 20161104173623) do
     t.index ["uri"], name: "index_statuses_on_uri", unique: true, using: :btree
   end
 
+  create_table "statuses_tags", id: false, force: :cascade do |t|
+    t.integer "status_id", null: false
+    t.integer "tag_id",    null: false
+    t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true, using: :btree
+    t.index ["tag_id"], name: "index_statuses_tags_on_tag_id", using: :btree
+  end
+
   create_table "stream_entries", force: :cascade do |t|
     t.integer  "account_id"
     t.integer  "activity_id"