diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20200726094737_add_semiprivate_to_statuses.rb | 7 | ||||
-rw-r--r-- | db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20200726094737_add_semiprivate_to_statuses.rb b/db/migrate/20200726094737_add_semiprivate_to_statuses.rb new file mode 100644 index 000000000..facde265c --- /dev/null +++ b/db/migrate/20200726094737_add_semiprivate_to_statuses.rb @@ -0,0 +1,7 @@ +class AddSemiprivateToStatuses < ActiveRecord::Migration[5.2] + def change + safety_assured do + add_column :statuses, :semiprivate, :boolean, default: false, null: false + end + end +end diff --git a/db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb b/db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb new file mode 100644 index 000000000..69878ab94 --- /dev/null +++ b/db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb @@ -0,0 +1,14 @@ +class BackfillSemiprivateOnStatuses < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + Rails.logger.info('Backfilling semiprivate statuses...') + safety_assured do + Status.where(id: StatusDomainPermission.select(:status_id).distinct(:status_id)).in_batches.update_all(semiprivate: true) + end + end + + def down + true + end +end |