When I follow what I thought to be standard practice (following this
documentation<http://www.web2py.com/books/default/chapter/29/09#Renaming-Auth-tables>)
for using alternative names for the auth tables, I'm seeing an incorrect
foreign key reference on any subsequent table defined that uses
auth.signature.
Here's the basic test code in a db.py:
auth = Auth(db)
auth.settings.table_user_name = 'cst_user'
auth.settings.table_group_name = 'cst_group'
auth.settings.table_membership_name = 'cst_membership'
auth.settings.table_permission_name = 'cst_permission'
auth.settings.table_event_name = 'cst_event'
auth.settings.table_cas_name = 'cst_cas'
auth.define_tables(username=True,signature=False)
db.define_table('tmp_mytable',
Field('something'),
auth.signature)
This works so far as the auth tables are concerned; web2py creates them
with the alternate names specified, properly referencing each other.
However, the query generated to create the subsequent table that uses
auth.signature (*tmp_mytable* above) refers in its foreign key declaration
to the standard auth table names instead. The query below was generated
(using SQLITE to test, though I first encountered this with Oracle).
CREATE TABLE mytable(
id INTEGER PRIMARY KEY AUTOINCREMENT,
something CHAR(512),
is_active CHAR(1),
created_on TIMESTAMP,
created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
modified_on TIMESTAMP,
modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE
);
Note that it has reverted to the default name "auth_user" for the
referenced foreign keys. What am I doing wrong here?
(Version 2.4.5-stable+timestamp.2013.04.06.10.09.56)
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.