dfRddlTddlmZGddeZGddeZdS))*) JSONFieldceZdZeedgZeZeZe Z e Z dS) BaseChangeLogzDEFAULT CURRENT_TIMESTAMP) constraintsN) __name__ __module__ __qualname__ DateTimeFieldSQL timestamp TextFieldactiontable IntegerField primary_keyrchangesz/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/playhouse/sqlite_changelog.pyrrsZ 33/J+K+K*LMMMI Y[[F IKKE,..KikkGGGrrc^eZdZeZdZdZdZd dZddZ ddZ d Z e d Z dd ZdS) ChangeLogaCREATE 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 '%(action)s', '%(table)s', %(new_old)s."%(primary_key)s", "changes" FROM ( SELECT json_group_object( col, json_array( case when json_valid("oldval") then json("oldval") else "oldval" end, case when json_valid("newval") then json("newval") else "newval" end) ) AS "changes" FROM ( SELECT json_extract(value, '$[0]') as "col", json_extract(value, '$[1]') as "oldval", json_extract(value, '$[2]') as "newval" FROM json_each(json_array(%(column_array)s)) WHERE "oldval" IS NOT "newval" ) ); END;z3DROP TRIGGER IF EXISTS %(table)s_changes_%(action)s)INSERTUPDATEDELETE changelogc"||_||_dSN)db table_name)selfrr s r__init__zChangeLog.__init__7s$rNc ,g}|jjD]q}|jr | |j|vr|j}|sdnd|z}|sdnd|z} t |t r|rd| z} |rd|z}|d|d| d|drd|S) NNULLzNEW."%s"zOLD."%s"zjson(%s)z json_array('z', z, )) _meta sorted_fieldsrname column_name isinstancerappendjoin) r!modeluse_olduse_new skip_fields col_arrayfieldcolumnnewolds r_build_column_arrayzChangeLog._build_column_array;s [. N NE  &5:+D+D&F '@&&Z&-@C '@&&Z&-@C%++ 32*s"2C2*s"2C    666333L M M M Myy###rc||jvsJ|dk}|dk}|||||}|j|jj||dkrdnd|jjj||jdzS)NrrNEWOLD)rrnew_oldr column_array change_table)_actionsr6templater&r rr))r!r-rr0r.r/colss r trigger_sqlzChangeLog.trigger_sqlTs&&&&H$H$''wMM}[+ &( 2 2uu ;2>  O  - -- -rcF||jvsJ|j|jj|dzS)N)rr)r= drop_templater&r )r!r-rs rdrop_trigger_sqlzChangeLog.drop_trigger_sqlas:&&&&![+%% rcjtdsGfddj}|_jS)N_changelog_modelc.eZdZGfddZdS)"ChangeLog.model..ChangeLogc,eZdZjZjZdS)'ChangeLog.model..ChangeLog.MetaN)rr r rdatabaser r!srMetarIks#wH!%JJJrrLN)rr r rLrKsrrrGjsG111111111111rr)hasattr base_modelrE)r!rs` rr-zChangeLog.modelgs_t/00 . 1 1 1 1 1 1 1DO 1 1 1%.D !$$rTcp|j}|r|tt|||f|j} |r6| D]3\} } |j||| 4| D]8\} } | r1||| |} |j| 9dSr) r- create_tablelistzipr=r execute_sqlrCr@)r!r-r0dropinsertupdatedeleterPractions_renabledsqls rinstallzChangeLog.installrsJ  %  " " $ $ $sFFF3T]CCDD  J$ J J 6##D$9$9%$H$HIIII& ) )OGV )&&ufkBB##C((( ) )r)rr)NTTTTT)rr r rrNr>rBr=r"r6r@rCpropertyr-r\rrrrr sJ H4JM-H%%%%$$$$2 - - - - %%X%BF7;))))))rrN)peeweeplayhouse.sqlite_extrModelrobjectrrrrrbs******Es)s)s)s)s)s)s)s)s)s)r