awcodes / filament-curator

A media picker plugin for Filament Panels.
MIT License
324 stars 86 forks source link

OriginalFilename missing from table create script after fresh new install #476

Closed mercury64 closed 3 months ago

mercury64 commented 5 months ago

Filament Version

v3.2.71

Plugin Version

v3.5.6

PHP Version

PHP v8.3.4

Problem description

originalFilename missing from database schema during install.

SQL error on first media upload after fresh install.

Expected behavior

All database columns should be created during install.

This needs to be added $table->string('originalFilename');

Steps to reproduce

Install new and add one image.

Reproduction repository

No response

Relevant log output

[2024-04-26 19:18:17] local.ERROR: SQLSTATE[HY000]: General error: 1 table media has no column named originalFilename (Connection: sqlite, SQL: insert into "media" ("alt", "title", "caption", "description", "originalFilename", "disk", "directory", "visibility", "name", "path", "exif", "width", "height", "size", "type", "ext", "updated_at", "created_at") values ....
awcodes commented 5 months ago

Are you overriding the observer? Curator doesn't actually try to store originalFilename and it's only used when replacing a file where the observer removes it from the form data before saving the record.

mercury64 commented 5 months ago

No I am not overriding anything, zero custom code, fresh install of Laravel, Filament and Curator.

I've done some debugging. When uploading an image, the following happens: Awcodes\Curator\Components\Forms\Uploader.php, function saveUploadedFiles(), at the following line: $this->storeFileName($storedFile['path'], $file->getClientOriginalName());

Then in storeFileName function from Filament\Forms\Components\BaseFileUpload $statePath = $this->fileNamesStatePath; where fileNamesStatePath is orignalFilename.

I can only deep dive into the code so far before I start getting lost.

It maybe some conflict with an update with Filament.

I've reinstalled three times, same issue.

mercury64 commented 5 months ago

This occurs from the Media-> New Media -> Create.

This does not happen from the CurratorPicker as a block on my page, Add Media -> Add Files.

awcodes commented 5 months ago

Ok. I will look into it as soon as I can. Thank you.

awcodes commented 4 months ago

I can't seem to replicate this. New media is working correctly for me.

Can you give me a reproduction repo to look at.

beelalamin commented 1 month ago

If you are switching from spatie-media-library, make sure to drop the media table.