spatie / laravel-medialibrary

Associate files with Eloquent models
https://spatie.be/docs/laravel-medialibrary
MIT License
5.78k stars 1.08k forks source link

Add `down` DB Migration to drop media table #3599

Closed ollyollyollyltd closed 6 months ago

ollyollyollyltd commented 6 months ago

This package publishes a migration to create the media table, but it only has an up method.

This means that if the migration is rolled back, and then migrated again, the migration will fail as the media table already exists.

This pull request adds a simple down method to the migration to drop the media table.

Nielsvanpach commented 6 months ago

We don't use down migrations in any package / project.

99.9% of the time you are not gonna use a down migration and you’re probably never testing them. Just write an up migration if you want to drop a column again. 👍

ollyollyollyltd commented 6 months ago

Okay, fair enough.

Kind regards,

Olly Cross OllyOllyOlly Ltd

On Tue, Apr 30, 2024 at 12:27 PM Niels Vanpachtenbeke < @.***> wrote:

We don't use down migrations in any package / project.

99.9% of the time you are not gonna use a down migration and you’re probably never testing them. Just write an up migration if you want to drop a column again. 👍

— Reply to this email directly, view it on GitHub https://github.com/spatie/laravel-medialibrary/pull/3599#issuecomment-2085041939, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGSAV3HO4DVRLVJKSBJCDTY7552PAVCNFSM6AAAAABG76D5AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBVGA2DCOJTHE . You are receiving this because you authored the thread.Message ID: @.***>