diff options
Diffstat (limited to 'db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb')
-rw-r--r-- | db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb b/db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb new file mode 100644 index 000000000..6e29b9d44 --- /dev/null +++ b/db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb @@ -0,0 +1,17 @@ +class MigrateFilterUndescribedFromAccounts < ActiveRecord::Migration[5.2] + def up + Account.local.find_each do |account| + account.user.update!(filter_undescribed: account.filter_undescribed) + end + safety_assured { + remove_column :accounts, :filter_undescribed + } + end + + def down + return true + safety_assured { + add_column :accounts, :filter_undescribed, :boolean, null: true, default: false + } + end +end |