database - Is there a way to log read/write access to a specific column in MySQL? -
is there way in mysql log query accesses column in table?
purpose: need refactoring purposes - have change structure of database because not smart enough @ time use unique searchable column names difficult me locate places in php code deal column. if start logging queries access column on time have complete overview of queries use column , therefore able modify php code (assuming possible queries had been run time in period).
while wrote misgivings below, question relates "auditing" , "logging".
basic statement logging can achieved using general query log , more advanced auditing can performed enterprise audit plugin. triggers not appropriate logging queries have been known implement update/insert change log trails.
i think trying find usage programmatically misguided. refactoring not "ongoing" process - it's done once (per refactor goal) , life moves on. tests (e.g. unit/integration) , code-coverage can tell results of refactoring, work best formalized dal/api.
instead, time sit down code-base , analyze database access calls. terrible column name id
relatively easy grep through files if merely trying find occurrences. chances it'll require hour or 2 "feel comfortable" manual changes. now, if such changes tested ..
it prudent refactor access out named methods well-defined contracts, later pushed proper dal, if left @ call-sites. separation of concerns basis underpinning testability , future refactoring.
Comments
Post a Comment