'Constructor
@param tablename: the name of the audit table
@param migrate: migration setting
@note: this defines the audit table'

def __init__(self, tablename='s3_audit', migrate=True, fake_migrate=False):

    settings = current.deployment_settings
    audit_read = settings.get_security_audit_read()
    audit_write = settings.get_security_audit_write()
    if ((not audit_read) and (not audit_write)):
        self.table = None
        return
    db = current.db
    if (tablename not in db):
        db.define_table(tablename, Field('timestmp', 'datetime', represent=S3DateTime.datetime_represent), Field('user_id', db.auth_user), Field('method'), Field('tablename'), Field('record_id', 'integer'), Field('representation'), Field('old_value', 'text'), Field('new_value', 'text'), Field('repository_id', 'integer'), migrate=migrate, fake_migrate=fake_migrate)
    self.table = db[tablename]
    user = current.auth.user
    if user:
        self.user_id = user.id
    else:
        self.user_id = None
