diff options
Diffstat (limited to 'db/post_migrate/20180424151928_fill_file_store.rb')
-rw-r--r-- | db/post_migrate/20180424151928_fill_file_store.rb | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/db/post_migrate/20180424151928_fill_file_store.rb b/db/post_migrate/20180424151928_fill_file_store.rb deleted file mode 100644 index 45fa10c9550..00000000000 --- a/db/post_migrate/20180424151928_fill_file_store.rb +++ /dev/null @@ -1,72 +0,0 @@ -class FillFileStore < ActiveRecord::Migration[4.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - class JobArtifact < ActiveRecord::Base - include EachBatch - self.table_name = 'ci_job_artifacts' - BATCH_SIZE = 10_000 - - def self.params_for_background_migration - yield self.where(file_store: nil), 'FillFileStoreJobArtifact', 5.minutes, BATCH_SIZE - end - end - - class LfsObject < ActiveRecord::Base - include EachBatch - self.table_name = 'lfs_objects' - BATCH_SIZE = 10_000 - - def self.params_for_background_migration - yield self.where(file_store: nil), 'FillFileStoreLfsObject', 5.minutes, BATCH_SIZE - end - end - - class Upload < ActiveRecord::Base - include EachBatch - self.table_name = 'uploads' - self.inheritance_column = :_type_disabled # Disable STI - BATCH_SIZE = 10_000 - - def self.params_for_background_migration - yield self.where(store: nil), 'FillStoreUpload', 5.minutes, BATCH_SIZE - end - end - - def up - # NOTE: Schedule background migrations that fill 'NULL' value by '1'(ObjectStorage::Store::LOCAL) on `file_store`, `store` columns - # - # Here are the target columns - # - ci_job_artifacts.file_store - # - lfs_objects.file_store - # - uploads.store - - FillFileStore::JobArtifact.params_for_background_migration do |relation, class_name, delay_interval, batch_size| - queue_background_migration_jobs_by_range_at_intervals(relation, - class_name, - delay_interval, - batch_size: batch_size) - end - - FillFileStore::LfsObject.params_for_background_migration do |relation, class_name, delay_interval, batch_size| - queue_background_migration_jobs_by_range_at_intervals(relation, - class_name, - delay_interval, - batch_size: batch_size) - end - - FillFileStore::Upload.params_for_background_migration do |relation, class_name, delay_interval, batch_size| - queue_background_migration_jobs_by_range_at_intervals(relation, - class_name, - delay_interval, - batch_size: batch_size) - end - end - - def down - # noop - end -end |