about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-12-12 05:38:08 -0600
committermultiple creatures <dev@multiple-creature.party>2019-12-12 05:38:08 -0600
commitdc8e5eae2c7a478090016b3bf54338ea89ea690b (patch)
tree947dd22e3681cfe764c0eace54a8a7560cbf8491 /db
parent7d0e47f8379d924c486bf451038d52913c2c5503 (diff)
better key constraints on imported statuses, sharekeys, & normalized statuses tables
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20191211235208_create_normalized_statuses.rb2
-rw-r--r--db/migrate/20191212022020_create_sharekeys.rb2
-rw-r--r--db/migrate/20191212022653_create_imported_statuses.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/db/migrate/20191211235208_create_normalized_statuses.rb b/db/migrate/20191211235208_create_normalized_statuses.rb
index d47c4feb4..19c7cd6c3 100644
--- a/db/migrate/20191211235208_create_normalized_statuses.rb
+++ b/db/migrate/20191211235208_create_normalized_statuses.rb
@@ -1,7 +1,7 @@
 class CreateNormalizedStatuses < ActiveRecord::Migration[5.2]
   def up
     create_table :normalized_statuses do |t|
-      t.references :status, foreign_key: true, index: {unique: true}
+      t.references :status, null: false, foreign_key: {on_delete: :cascade}, index: {unique: true}
       t.text :text
     end
 
diff --git a/db/migrate/20191212022020_create_sharekeys.rb b/db/migrate/20191212022020_create_sharekeys.rb
index c0027babe..b66b7eeda 100644
--- a/db/migrate/20191212022020_create_sharekeys.rb
+++ b/db/migrate/20191212022020_create_sharekeys.rb
@@ -1,7 +1,7 @@
 class CreateSharekeys < ActiveRecord::Migration[5.2]
   def up
     create_table :sharekeys do |t|
-      t.references :status, foreign_key: true, index: {unique: true}
+      t.references :status, null: false, foreign_key: {on_delete: :cascade}, index: {unique: true}
       t.string :key
     end
 
diff --git a/db/migrate/20191212022653_create_imported_statuses.rb b/db/migrate/20191212022653_create_imported_statuses.rb
index 3d7a9c99d..a2bf0a68d 100644
--- a/db/migrate/20191212022653_create_imported_statuses.rb
+++ b/db/migrate/20191212022653_create_imported_statuses.rb
@@ -1,7 +1,7 @@
 class CreateImportedStatuses < ActiveRecord::Migration[5.2]
   def up
     create_table :imported_statuses do |t|
-      t.references :status, foreign_key: true, index: {unique: true}
+      t.references :status, null: false, foreign_key: {on_delete: :cascade}, index: {unique: true}
       t.string :origin, index: {unique: true}
     end