Skip to content

Conversation

@kurucu
Copy link

@kurucu kurucu commented Jun 6, 2025

Added a change disk command that:

  • Updates Media disks to a new disk where it matches the old
  • Updates Media conversations to a new disk where it matches the old
  • Updates Accounts media disks to the new disk where it matches the old

Performed as a chunked transaction so that json updates can be conditional.

Included a simple test for the command.

@lao9s
Copy link
Member

lao9s commented Jun 6, 2025

Hi @kurucu

Thank you for this PR.

Could you please explain the use case for this command?

@kurucu
Copy link
Author

kurucu commented Jun 6, 2025

Yep!

I recently moved my server to cloud hosting and as such, moved files from local disk to s3. I did this migration manually to achieve that.

I’m sure there’s many similar use cases. Moving from s3 to r2, different disk names etc.

Hopefully this saves people time in the future.

$bar = $this->output->createProgressBar(Media::count() + Account::count());
$bar->start();

Media::chunk(100, function (Collection $medias) use ($bar, $from, $to) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 is a magic number here. It should be provided as an argument in the command or named explicitly as a parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants