class MoveBlobFilesTablespaces < ActiveRecord::Migration[7.2]
  disable_ddl_transaction!

  def up
    64.times { |i| execute <<-SQL }
      ALTER TABLE blob_files_#{i.to_s.rjust(2, "0")} SET TABLESPACE pg_default;
      ALTER INDEX index_blob_files_#{i.to_s.rjust(2, "0")}_on_sha256 SET TABLESPACE pg_default;
    SQL
  end

  def down
    raise ActiveRecord::IrreversibleMigration
  end
end
