Skip to content

ptorba/mysql-history

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

mysql-history

Helps creating audit tables and triggers to track data changes in MySQL.

On execution, mysql-history connects to a MySQL database and creates:

  • audit tables as copies of source tables (1 for every source table) with the following columns added:
    • hst_id INT PRIMARY KEY
    • hst_modified_date DATETIME
    • hst_type VARCHAR(2)
  • triggers on INSERT, UPDATE and DELETE on source tables
    • every trigger inserts modified data to audit table specifying hst_type as 'I', 'U' or 'D'

When source tables change just re-run the script and it will add new columns to audit tables and modify datatypes of existing ones if possible.

Requirements

It requires MySQLdb and Python 2.7.x to function properly.

About

Create tables and triggers to track changes in MySQL tables

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages