diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-12-03 20:04:19 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-12-03 20:04:19 +0100 |
commit | b14b5e3b448eafa1489d6fe4b702621e25dff1ae (patch) | |
tree | a4c7885fcede76232dbc476b3ebcf0c84859a87a /db/migrate | |
parent | 5abf64d647b6f36a51f014b63f7b469b43378d3f (diff) |
Improve notification model
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20161203164520_add_from_account_id_to_notifications.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/db/migrate/20161203164520_add_from_account_id_to_notifications.rb b/db/migrate/20161203164520_add_from_account_id_to_notifications.rb index 295f95599..282676760 100644 --- a/db/migrate/20161203164520_add_from_account_id_to_notifications.rb +++ b/db/migrate/20161203164520_add_from_account_id_to_notifications.rb @@ -1,6 +1,6 @@ class AddFromAccountIdToNotifications < ActiveRecord::Migration[5.0] def up - add_column :notifications, :from_account_id, :integer, null: false, default: 1 + add_column :notifications, :from_account_id, :integer Notification.where(activity_type: 'Status').update_all('from_account_id = (SELECT statuses.account_id FROM notifications AS notifications1 INNER JOIN statuses ON notifications1.activity_id = statuses.id WHERE notifications1.activity_type = \'Status\' AND notifications1.id = notifications.id)') Notification.where(activity_type: 'Mention').update_all('from_account_id = (SELECT statuses.account_id FROM notifications AS notifications1 INNER JOIN mentions ON notifications1.activity_id = mentions.id INNER JOIN statuses ON mentions.status_id = statuses.id WHERE notifications1.activity_type = \'Mention\' AND notifications1.id = notifications.id)') |