bedezign / yii2-audit

Yii2 Audit records and displays web/cli requests, database changes, php/js errors and associated data.
https://bedezign.github.io/yii2-audit/
Other
193 stars 112 forks source link

fail to clean up audit_entry #245

Closed michaelnguyen2021 closed 5 years ago

michaelnguyen2021 commented 6 years ago

version 1.0.11

php yii audit/cleanup --entry --age=60

Exception 'yii\db\IntegrityException' with message 'SQLSTATE[23000]: In tegrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constra int fails (mydb.audit_javascript, CONSTRAINT fk_audit_javascript_entry_id FOREIGN KEY (entry_id) REFERENCES audit_entry (id)) The SQL being executed was: DELETE FROM audit_entry WHERE created <= '2018-04-08 23:59:59'

naduvko commented 5 years ago

change fk_audit_javascript_entry_id in audit_javascript from ON DELETE RESTRICT to ON DELETE CASCADE