about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2018-04-03 19:17:20 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2018-04-03 19:17:20 +0000
commit6611100480c86c07972c1223e7231c136966e11d (patch)
treed6ce7cf9568d13ba0dfc8ee32fd1335e0d053f43 /db
parent1f5bdd8445f6ba192618288504b74c1df7c09ea6 (diff)
parentd8d42179590db772cc5b1873385cba7e5afe20df (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20180402031200_add_assigned_account_id_to_reports.rb5
-rw-r--r--db/migrate/20180402040909_create_report_notes.rb14
-rw-r--r--db/schema.rb16
3 files changed, 34 insertions, 1 deletions
diff --git a/db/migrate/20180402031200_add_assigned_account_id_to_reports.rb b/db/migrate/20180402031200_add_assigned_account_id_to_reports.rb
new file mode 100644
index 000000000..0456839c4
--- /dev/null
+++ b/db/migrate/20180402031200_add_assigned_account_id_to_reports.rb
@@ -0,0 +1,5 @@
+class AddAssignedAccountIdToReports < ActiveRecord::Migration[5.1]
+  def change
+    add_reference :reports, :assigned_account, null: true, default: nil, foreign_key: { on_delete: :nullify, to_table: :accounts }, index: false
+  end
+end
diff --git a/db/migrate/20180402040909_create_report_notes.rb b/db/migrate/20180402040909_create_report_notes.rb
new file mode 100644
index 000000000..732ddf825
--- /dev/null
+++ b/db/migrate/20180402040909_create_report_notes.rb
@@ -0,0 +1,14 @@
+class CreateReportNotes < ActiveRecord::Migration[5.1]
+  def change
+    create_table :report_notes do |t|
+      t.text :content, null: false
+      t.references :report, null: false
+      t.references :account, null: false
+
+      t.timestamps
+    end
+
+    add_foreign_key :report_notes, :reports, column: :report_id, on_delete: :cascade
+    add_foreign_key :report_notes, :accounts, column: :account_id, on_delete: :cascade
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7737c1123..e7eadbf41 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: 20180310000000) do
+ActiveRecord::Schema.define(version: 20180402040909) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -364,6 +364,16 @@ ActiveRecord::Schema.define(version: 20180310000000) do
     t.index ["status_id", "preview_card_id"], name: "index_preview_cards_statuses_on_status_id_and_preview_card_id"
   end
 
+  create_table "report_notes", force: :cascade do |t|
+    t.text "content", null: false
+    t.bigint "report_id", null: false
+    t.bigint "account_id", null: false
+    t.datetime "created_at", null: false
+    t.datetime "updated_at", null: false
+    t.index ["account_id"], name: "index_report_notes_on_account_id"
+    t.index ["report_id"], name: "index_report_notes_on_report_id"
+  end
+
   create_table "reports", force: :cascade do |t|
     t.bigint "status_ids", default: [], null: false, array: true
     t.text "comment", default: "", null: false
@@ -373,6 +383,7 @@ ActiveRecord::Schema.define(version: 20180310000000) do
     t.bigint "account_id", null: false
     t.bigint "action_taken_by_account_id"
     t.bigint "target_account_id", null: false
+    t.bigint "assigned_account_id"
     t.index ["account_id"], name: "index_reports_on_account_id"
     t.index ["target_account_id"], name: "index_reports_on_target_account_id"
   end
@@ -580,7 +591,10 @@ ActiveRecord::Schema.define(version: 20180310000000) do
   add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id", name: "fk_f5fc4c1ee3", on_delete: :cascade
   add_foreign_key "oauth_access_tokens", "users", column: "resource_owner_id", name: "fk_e84df68546", on_delete: :cascade
   add_foreign_key "oauth_applications", "users", column: "owner_id", name: "fk_b0988c7c0a", on_delete: :cascade
+  add_foreign_key "report_notes", "accounts", on_delete: :cascade
+  add_foreign_key "report_notes", "reports", on_delete: :cascade
   add_foreign_key "reports", "accounts", column: "action_taken_by_account_id", name: "fk_bca45b75fd", on_delete: :nullify
+  add_foreign_key "reports", "accounts", column: "assigned_account_id", on_delete: :nullify
   add_foreign_key "reports", "accounts", column: "target_account_id", name: "fk_eb37af34f0", on_delete: :cascade
   add_foreign_key "reports", "accounts", name: "fk_4b81f7522c", on_delete: :cascade
   add_foreign_key "session_activations", "oauth_access_tokens", column: "access_token_id", name: "fk_957e5bda89", on_delete: :cascade