ioncache / DBIx-Class-AuditLog

Simple activity audit logging for DBIx::Class
https://metacpan.org/module/DBIx::Class::AuditLog
9 stars 10 forks source link

I'd like to be able to change the prefix for the audit_log tables. #9

Open harleypig opened 11 years ago

harleypig commented 11 years ago

This is for purely cosmetic reasons, but I'd like to be able to change the 'audit_log' prefix to something else of my choosing.

ioncache commented 11 years ago

So you'd want to change the prefix on the tables in the database? Not necessarily the prefix in the DBIx::Class schemas?

harleypig commented 11 years ago

Yeah ... I recently spent 30 minutes explaining to a client what audit meant in this context and, once they understood, their complain was 'well, why didn't you name it history or something like that?' Very frustrating. So, being able to change the db names to whatever the client thinks makes sense would be great. Like I said, purely cosmetic.

lukas-t commented 11 years ago

Free Choice table names would be a nice feature. But adding support to AuditLog would require a lot of refactoring, and I don't think it will happen soon. (But who knows).

But AFAIK you can already do this by calling build-in DBIC methods in your Schema class. I have created an example in my AuditLog fork. I did not do mutch testing, and it is not a clean solution at all. but it should work. At least the basic test I copied from the unmodified test schema passes.

In fact, I did not even do much thinking. I just had this Idea, I tried it, and it seems to work.

Take a look here: https://github.com/lukas-t/DBIx-Class-AuditLog/blob/master/t/lib/AuditTestRenamedTables/Schema.pm

The copied test can be found here: https://github.com/lukas-t/DBIx-Class-AuditLog/blob/master/t/012_renamed_tables.t