Closed mburkeSencon closed 1 year ago
Duplicate of #3017
It's a duplicate because I started it in the Q&A section and reasoned that it's possibly a bug and would be better off raising it as an issue. Especially as it's been 6 days of not being able to upload anything to my software.
Anyway, I've looked in to it myself today in order to help progress something and I've identified what I believe to be the issue.
In the src/MediaCollections/Models/Media.php, Line 48, we have:
protected $table = 'media';
I've been playing with this specifically today and notice that if I changed this to protected $table = 'DatabaseName.dbo.media'
my error resolves itself. To be specific, it will only work if I provide the name of the database as well as the table names. Using dbo.media
still results in the error. So to me the package isn't accessing the Database being used, nor is it able to handle the dbo
part of the naming convention of MSSQL. AFAIK anyway.
I could add dbo.media
to this line myself and be done with it, but like I said originally this all worked before the upgrades so I'm surprised to see this package being less flexible regarding database use. But it surprises me more that the package doesn't seem to know what database it's connected to?
Hi @mburkeSencon,
I dug around a bit and this looks a lot like a bunch of reports I found of people having issues with Laravel MSSQL driver.
Some reports I came across:
The first person had the exact same issue with a relation. The second mentions Laravel requiring additional config from MSSQL, not sure if that helps?
My odbc.ini file had some entries that were missing the Database = dbname line, so Laravel could see no default schema.
Either way, unfortunately this sounds like a deep database adapter issue (that might have been introduced by upgrading Laravel), and not something related to this package.
I disagree with it being an issue of the database adapter. If it was an issue I would expect other packages that require use of the database to be falling down with this issue. I've not had that happen, the issue has been specific to this package and how it handles multiple databases.
I had to move on from it in the end anyway, as my boss wasn't particularly impressed with the lack of progress of the issue and having a broken site after an upgrade.
I would urge someone though to just maybe look at how the Activity Log package you guys do interacts with the database, as we're running that after the upgrades and we've not encountered the issue. It really has been specific to the media library package.
@mburkeSencon Due to the numerous sources that indicate that this is likely related to a deeper database adapter problem, I am closing this issue. Feel free to open a new issue (with example unit tests failing) if you feel that this is not the case.
Discussed in https://github.com/spatie/laravel-medialibrary/discussions/3017