Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media without versions #78

Open
gael-connan-cybex opened this issue Aug 23, 2024 · 0 comments
Open

media without versions #78

gael-connan-cybex opened this issue Aug 23, 2024 · 0 comments

Comments

@gael-connan-cybex
Copy link
Contributor

gael-connan-cybex commented Aug 23, 2024

testing revealed that there media without versions can exist.

this should not be possible. when the first version of a media cannot be created, the media must be deleted. this should happen in the upload process to make sure this is never the case.

Media::get()->mapWithKeys(fn($media) => [$media->id => $media->Versions->count()])->filter(fn($count) => $count < 1)

Media::get()->filter(fn($media) => $media->Versions->count() < 1)->each->delete()

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

No branches or pull requests

1 participant