dan-da / cdc_audit Goto Github PK
View Code? Open in Web Editor NEWchange data capture via audit tables and triggers for mysql.
License: GNU General Public License v2.0
change data capture via audit tables and triggers for mysql.
License: GNU General Public License v2.0
I'm having an issue with the FOR EACH ROW BEGIN
loop wrapping the insert statement. If I remove the BEGIN
and END
, creating the trigger works just fine.
Using mysql 5.5.
``
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
``
Working example,
DELIMITER @@ CREATE TRIGGER
rate_types_after_insertAFTER INSERT ON
rate_typesFOR EACH ROW insert into
rate_types_audit (
id,
type,
audit_event,
audit_timestamp) values(NEW.
id, NEW.
type, 'insert', CURRENT_TIMESTAMP); @@
Have you thought about differentiating between the before update and after update column changes? I'm thinking the audit would be more valuable if you knew what the column values were changed from...
Overall though, amazing project! Love the ease of generating audit tables on the fly.
Hi @dan-da
I've got an update that adds support for a separate audit schema by extending the namespace capabilities. Additionally, the update adds a "snapshot" query to the end of every file generated, this query can be used to take a snapshot of the current state of the source table. This is useful for starting off a new audit table, or catching up a table thats falling out of sync.
It looks like I can't send in my pull request with the current security settings on the repo, if you would like the update please let me know that you've added me.
Thank you so much for putting this together, this tool helped me a lot.
Warning this is my first PHP code, hopefully the update will meet your quality standards, but if not let me know how to improve.
Unfortunately, PHP7 now uses PDO.
Did you update your scripts for that version of PHP ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.