Page 1 of 1

[BUG] No schema at foreign key references (v4.0.30)

Posted: Mon 22 Aug 2011 16:05
If I use a different database schema for my generated storage objects the sql scripting engine (for SQL Server 2008 in my case) forgets to add that schema in front of the table names in foreign key references.

Example:

Code: Select all

-- 
-- Creating a table ibi.tblKunden 
-- 
CREATE TABLE ibi.tblKunden (
   KN_PN_GUID UNIQUEIDENTIFIER NOT NULL,
   KN_ID VARCHAR(MAX) NOT NULL,
   CONSTRAINT PK_tblKunden PRIMARY KEY (KN_PN_GUID),
   CONSTRAINT FK_tblKunden_tblPersonen_0 FOREIGN KEY (KN_PN_GUID) REFERENCES tblPersonen (PN_GUID)
While the schema 'ibi' is correctly added in front of 'tblKunden' for the CREATE statement, it is missing in front of 'tblPersonen' in the REFERENCES part at the end. So if my DB user doesn't have 'ibi' as its default schema, the script will fail because the DB can't find the table 'tblPersonen'.

The corrected script looks like that and runs fine:

Code: Select all

-- 
-- Creating a table ibi.tblKunden 
-- 
CREATE TABLE ibi.tblKunden (
   KN_PN_GUID UNIQUEIDENTIFIER NOT NULL,
   KN_ID VARCHAR(MAX) NOT NULL,
   CONSTRAINT PK_tblKunden PRIMARY KEY (KN_PN_GUID),
   CONSTRAINT FK_tblKunden_tblPersonen_0 FOREIGN KEY (KN_PN_GUID) REFERENCES ibi.tblPersonen (PN_GUID)

Posted: Wed 24 Aug 2011 16:10
by StanislavK
We have reproduced this issue, we will post here when it is fixed.

Posted: Fri 07 Oct 2011 09:39
by StanislavK
This issue is fixed, the fix is available in the latest 4.1.55 build of Entity Developer (and in the new builds of data providers as well). The new build of Entity Developer can be downloaded from
http://www.devart.com/entitydeveloper/download.html
(the trial and free versions only) or from Registered Users' Area (for users with active subscription only).

For more information about the fixes and improvements available in the new build, please refer to
http://www.devart.com/forums/viewtopic.php?t=22169