Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorJonne Haß <me@jhass.eu>2020-11-30 17:41:04 +0300
committerJonne Haß <me@jhass.eu>2020-11-30 17:42:48 +0300
commit07ec46e15187175d6fbdf5dfac22fac8ea960f0c (patch)
treefea2c275856c5090be8309d0dcd4dd8d4debfdb7 /db
parentd2acad1aed68f72c6502989b4777b9626e14b4f8 (diff)
Enforce GUID being present for notifications
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20201130142541_change_notifications_guid_not_null.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20201130142541_change_notifications_guid_not_null.rb b/db/migrate/20201130142541_change_notifications_guid_not_null.rb
new file mode 100644
index 000000000..32603c195
--- /dev/null
+++ b/db/migrate/20201130142541_change_notifications_guid_not_null.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ChangeNotificationsGuidNotNull < ActiveRecord::Migration[5.2]
+ def up
+ Notification.where(guid: nil).find_in_batches do |batch|
+ batch.each do |notification|
+ notification.save!(validate: false, touch: false)
+ end
+ end
+
+ change_column :notifications, :guid, :string, null: false
+ end
+
+ def down
+ change_column :notifications, :guid, :string, null: true
+ end
+end