Add reference from etype table's eid column to the entities table
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 15 Jan 2015 18:53:45 +0100
changeset 10204 f8ccae1e271d
parent 10203 1443fe643a38
child 10205 737271ffe407
Add reference from etype table's eid column to the entities table Related to #4846892.
server/schema2sql.py
server/test/unittest_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:
--- 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
 );