about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-04-04 13:55:42 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-04-04 13:55:42 -0500
commitbda1782cd864ed3aabb5a4d87359a1cb7595f4a6 (patch)
tree4ecb8623959b616fec9ab2a9c855048fb8c2da49 /db/migrate
parent77b650b69c8146a2acf4e7d270343f89c9838690 (diff)
parent6611100480c86c07972c1223e7231c136966e11d (diff)
Merge remote-tracking branch 'personal/merge/tootsuite/master' into gs-master
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180402031200_add_assigned_account_id_to_reports.rb5
-rw-r--r--db/migrate/20180402040909_create_report_notes.rb14
2 files changed, 19 insertions, 0 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