nhkey / yii2-activerecord-history

The extension adds storage history of changes to the AR model
BSD 3-Clause "New" or "Revised" License
46 stars 37 forks source link

Reserved words #12

Open beatep opened 8 years ago

beatep commented 8 years ago

Thanks for your extension, it is running fine, except one thing: you are using a few reserved words in your log-database, f.e. date, table and type, see here:

http://dev.mysql.com/doc/refman/5.7/en/keywords.html

As I was upgrading my table from ActiveRecordLog with yii1, I wanted to change the content of some fields via phpMyAdmin, there were some errors. After renaming them, it worked again.

nhkey commented 7 years ago

Thanks for your comment!

I agree with you, this reserved words is not good name for table's cols. But if I change that now, I broke backward compatibility. In future major version I'll change it necessarily.

You can use quotes in your query, e.g. UPDATE ActiveRecordLogTable SET `table`='blah-blah-blah' WHERE `date`>'2016-12-01';

assafwint commented 7 years ago

Thanks for this great extension, very simple and works great. The only issue is that it does not support multiple PK's and so does not support M2M tables. I have added two fields for secondary pk field name and value and the change is pretty simple to implement.

Simply edit class BaseManager function run($type, $object). I am in the process of modifying it and when there's time I will post the complete function. Any thoughts?