# HG changeset patch # User Julien Cristau # Date 1421344425 -3600 # Node ID f8ccae1e271d459ad1c35ac8bee2de7d87dce693 # Parent 1443fe643a38f1969bf3237198718009a107a4ac Add reference from etype table's eid column to the entities table Related to #4846892. diff -r 1443fe643a38 -r f8ccae1e271d server/schema2sql.py --- a/server/schema2sql.py Fri Jan 16 14:30:55 2015 +0100 +++ b/server/schema2sql.py Thu Jan 15 18:53:45 2015 +0100 @@ -156,7 +156,7 @@ # this is expected for NOW / TODAY if creating: if rdef.uid: - sqltype += ' PRIMARY KEY' + sqltype += ' PRIMARY KEY REFERENCES entities (eid)' elif rdef.cardinality[0] == '1': # don't set NOT NULL if backend isn't able to change it later if dbhelper.alter_column_support: diff -r 1443fe643a38 -r f8ccae1e271d server/test/unittest_schema2sql.py --- a/server/test/unittest_schema2sql.py Fri Jan 16 14:30:55 2015 +0100 +++ b/server/test/unittest_schema2sql.py Thu Jan 15 18:53:45 2015 +0100 @@ -130,7 +130,7 @@ ); CREATE TABLE State( - eid integer PRIMARY KEY, + eid integer PRIMARY KEY REFERENCES entities (eid), name varchar(256) NOT NULL, description text );