bedezign/yii2-audit

fail to clean up audit_entry

michaelnguyen2021 opened this issue · 1 comments

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'

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