diff options
Diffstat (limited to 'db/migrate/20160328115649_migrate_new_notification_setting.rb')
-rw-r--r-- | db/migrate/20160328115649_migrate_new_notification_setting.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/db/migrate/20160328115649_migrate_new_notification_setting.rb b/db/migrate/20160328115649_migrate_new_notification_setting.rb new file mode 100644 index 00000000000..331c35535f2 --- /dev/null +++ b/db/migrate/20160328115649_migrate_new_notification_setting.rb @@ -0,0 +1,13 @@ +# This migration will create one row of NotificationSetting for each Member row +# It can take long time on big instances. Its unclear yet if this migration can be done online. +# This comment should be updated by @dzaporozhets before 8.7 release. If not - please ask him to do so. +class MigrateNewNotificationSetting < ActiveRecord::Migration + def up + timestamp = Time.now + execute "INSERT INTO notification_settings ( user_id, source_id, source_type, level, created_at, updated_at ) SELECT user_id, source_id, source_type, notification_level, '#{timestamp}', '#{timestamp}' FROM members" + end + + def down + NotificationSetting.delete_all + end +end |