about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-04-14 03:50:31 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-04-14 03:50:31 -0500
commitd66192f21c22dd79735a6c3ea6e2ed115b42e0d0 (patch)
treefec9f7eab346901c571c57023aa6231b0f855421 /db/migrate
parent78aca92689cd896f4be34daeb1852f75abc57472 (diff)
parent95a892accdb6a081447117f49c66431dc7e032fb (diff)
Merge remote-tracking branch 'glitchsoc/master' into gs-master
  Conflicts:
 	db/schema.rb
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180410220657_create_bookmarks.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/migrate/20180410220657_create_bookmarks.rb b/db/migrate/20180410220657_create_bookmarks.rb
new file mode 100644
index 000000000..208da452b
--- /dev/null
+++ b/db/migrate/20180410220657_create_bookmarks.rb
@@ -0,0 +1,14 @@
+class CreateBookmarks < ActiveRecord::Migration[5.1]
+  def change
+    create_table :bookmarks do |t|
+      t.references :account, null: false
+      t.references :status, null: false
+
+      t.timestamps
+    end
+
+    add_foreign_key :bookmarks, :accounts, column: :account_id, on_delete: :cascade
+    add_foreign_key :bookmarks, :statuses, column: :status_id, on_delete: :cascade
+    add_index :bookmarks, [:account_id, :status_id], unique: true
+  end
+end