Closed xfra35 closed 5 years ago
i welcome this pr, although i can imagine of config-tables with only one row in it, so that this breaks compatibility.
I'm actually for this change, as I also had a similar adventure once before. If there are edge-cases for 1-row tables, we'll find a solution for it. I could imagine to put this behaviour into a mass-update method, so that you can batch-update all or some records at once.
I just had a bad experience today with the
DB\SQL\Mapper->save()
executing anUPDATE
on the whole table instead of a single row. I realized that the table had a unique key but no primary key... and the framework did nothing to prevent the massive undesiredUPDATE
.Hence this proposal to throw an error on
update/erase()
if no PK can be found.