about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-11-20 15:36:09 +0100
committerThibaut Girka <thib@sitedethib.com>2019-11-20 15:36:09 +0100
commitff67385cfbfd6f5403b2f8b58407dc730dc7e694 (patch)
treea8a0df2129a863a739dda6399352d64af811110e /db/migrate
parent707c4918b21d19dd53b64120dbc7263f45fc5ecd (diff)
parent8dfc45f757ed8995be0d16e88a1f1d6514dae677 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- README.md
  discarded upstream changes
- app/controllers/api/v1/bookmarks_controller.rb
  finally merged upstream, some code style fixes
  and slightly changed pagination code
- app/controllers/application_controller.rb
  changed upstream to always return HTML error pages
  slight conflict caused by theming code
- app/models/bookmark.rb
  finally merged upstream, no real conflict
- spec/controllers/api/v1/bookmarks_controller_spec.rb
  finally merged upstream, slightly changed pagination code
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180831171112_create_bookmarks.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20180831171112_create_bookmarks.rb b/db/migrate/20180831171112_create_bookmarks.rb
new file mode 100644
index 000000000..27c7339c9
--- /dev/null
+++ b/db/migrate/20180831171112_create_bookmarks.rb
@@ -0,0 +1,17 @@
+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
+
+    safety_assured do
+      add_foreign_key :bookmarks, :accounts, column: :account_id, on_delete: :cascade
+      add_foreign_key :bookmarks, :statuses, column: :status_id, on_delete: :cascade
+    end
+
+    add_index :bookmarks, [:account_id, :status_id], unique: true
+  end
+end