1
ˆ
ƒí9_•I|¥‰ÓMdœv ©ƒ&íK<óo¬À¿ ‚
Index of /FSS-BCZ/root/usr/lib64/traceevent/plugins
Index of /FSS-BCZ/root/usr/lib64/traceevent/plugins
# ˆl–Ðz¾”Ëm
q@=q¦nõ1hßÃ
ƒi×ÙÂÁÀ ¹ from peewee import *
from playhouse.sqlite_ext import JSONField
class BaseChangeLog(Model):
timestamp = DateTimeField(constraints=[SQL('DEFAULT CURRENT_TIMESTAMP')])
action = TextField()
table = TextField()
primary_key = IntegerField()
changes = JSONField()
class ChangeLog(object):
# Model class that will serve as the base for the changelog. This model
# will be subclassed and mapped to your application database.
base_model = BaseChangeLog
# Template for the triggers that handle updating the changelog table.
# table: table name
# action: insert / update / delete
# new_old: NEW or OLD (OLD is for DELETE)
# primary_key: table primary key column name
# column_array: output of build_column_array()
# change_table: changelog table name
template = """CREATE TRIGGER IF NOT EXISTS %(table)s_changes_%(action)s
AFTER %(action)s ON %(table)s
BEGIN
INSERT INTO %(change_table)s
("action", "table", "primary_key", "changes")
SELECT