'to be called unless tables are defined manually
usages::
# defines all needed tables and table files
# UUID + "_auth_user.table", ...
auth.define_tables()
# defines all needed tables and table files
# "myprefix_auth_user.table", ...
auth.define_tables(migrate="myprefix_")
# defines all needed tables without migration/table files
auth.define_tables(migrate=False)'

def define_tables(self, migrate=True, fake_migrate=False):

    db = current.db
    settings = self.settings
    messages = self.messages
    deployment_settings = current.deployment_settings
    define_table = db.define_table
    utable = settings.table_user
    uname = settings.table_user_name
    if (not utable):
        utable_fields = [Field('first_name', length=128, notnull=True, default='', requires=IS_NOT_EMPTY(error_message=messages.is_empty)), Field('last_name', length=128, default=''), Field('email', length=255, unique=True, default=''), Field('username', length=255, default='', readable=False, writable=False), Field('language', length=16, default=deployment_settings.get_L10n_default_language()), Field('utc_offset', length=16, readable=False, writable=False), Field('organisation_id', 'integer', readable=False, writable=False), Field('org_group_id', 'integer', readable=False, writable=False), Field('site_id', 'integer', readable=False, writable=False), Field('link_user_to', 'list:string', readable=False, writable=False), Field('registration_key', length=512, default='', readable=False, writable=False), Field('reset_password_key', length=512, default='', readable=False, writable=False), Field('deleted', 'boolean', default=False, readable=False, writable=False), Field('timestmp', 'datetime', default='', readable=False, writable=False), s3_comments(readable=False, writable=False)]
        utable_fields += list(s3_uid())
        utable_fields += list(s3_timestamp())
        userfield = settings.login_userfield
        if (userfield != 'email'):
            utable_fields.insert(2, Field(userfield, length=128, default='', unique=True))
        passfield = settings.password_field
        utable_fields.insert(3, Field(passfield, 'password', length=512, requires=CRYPT(key=settings.hmac_key, min_length=deployment_settings.get_auth_password_min_length(), digest_alg='sha512'), readable=False, label=messages.label_password))
        define_table(uname, migrate=migrate, fake_migrate=fake_migrate, *utable_fields)
        utable = settings.table_user = db[uname]
    define_table('auth_user_temp', Field('user_id', utable), Field('home'), Field('mobile'), Field('image', 'upload', length=current.MAX_FILENAME_LENGTH), *(s3_uid() + s3_timestamp()))
    gtable = settings.table_group
    gname = settings.table_group_name
    if (not gtable):
        define_table(gname, Field('uuid', length=64, notnull=True, unique=True, readable=False, writable=False), Field('hidden', 'boolean', readable=False, writable=False, default=False), Field('system', 'boolean', readable=False, writable=False, default=False), Field('protected', 'boolean', readable=False, writable=False, default=False), Field('role', length=255, unique=True, default='', requires=IS_NOT_IN_DB(db, ('%s.role' % gname)), label=messages.label_role), Field('description', 'text', label=messages.label_description), migrate=migrate, fake_migrate=fake_migrate, *(s3_timestamp() + s3_deletion_status()))
        gtable = settings.table_group = db[gname]
    if (not settings.table_membership):
        define_table(settings.table_membership_name, Field('user_id', utable, requires=IS_IN_DB(db, ('%s.id' % uname), '%(id)s:    %(first_name)s    %(last_name)s'), label=messages.label_user_id), Field('group_id', gtable, requires=IS_IN_DB(db, ('%s.id' % gname), '%(id)s:    %(role)s'), represent=S3Represent(lookup=gname, fields=['role']), label=messages.label_group_id), Field('pe_id', 'integer'), migrate=migrate, fake_migrate=fake_migrate, *((s3_uid() + s3_timestamp()) + s3_deletion_status()))
        settings.table_membership = db[settings.table_membership_name]
    self.permission.define_table(migrate=migrate, fake_migrate=fake_migrate)
    if (not settings.table_event):
        request = current.request
        define_table(settings.table_event_name, Field('time_stamp', 'datetime', default=request.utcnow), Field('client_ip', default=request.client), Field('user_id', utable, default=None, requires=IS_IN_DB(db, ('%s.id' % uname), '%(id)s:    %(first_name)s    %(last_name)s')), Field('origin', default='auth', length=512, requires=IS_NOT_EMPTY()), Field('description', 'text', default='', requires=IS_NOT_EMPTY()), migrate=migrate, fake_migrate=fake_migrate, *((s3_uid() + s3_timestamp()) + s3_deletion_status()))
        settings.table_event = db[settings.table_event_name]
