LinqConnect Professional Version 4.4.393 (12-Dec-2013) - Incorrect update script for MySQL

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
AKRRKA
Posts: 198
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

LinqConnect Professional Version 4.4.393 (12-Dec-2013) - Incorrect update script for MySQL

Post by AKRRKA » Tue 24 Dec 2013 14:16

Hello,

When update database from model, for MS SQL generated script include update code only for changed/added/droped table.
But for MySQL generate for all table. For unchanged table generate code, like this:

Code: Select all

-- 
-- Altering a table meterlimits 
-- 
ALTER TABLE meterlimits
   DROP FOREIGN KEY FK_MeterLimits_Meter,
   DROP FOREIGN KEY FK_MeterLimits_RefWriteState,
   DROP FOREIGN KEY FK_MeterLimits_Limit;

-- 
-- Altering a table meterlimits 
-- 
ALTER TABLE meterlimits
   DROP PRIMARY KEY,
   CHANGE COLUMN MeterId MeterId INT(9) NOT NULL,
   CHANGE COLUMN LimitId LimitId INT(9) NOT NULL,
   CHANGE COLUMN WriteStateId WriteStateId INT(9) NOT NULL,
   ADD CONSTRAINT FK_MeterLimits_Meter FOREIGN KEY (MeterId) REFERENCES Meters (MeterId) ON DELETE CASCADE,
   ADD CONSTRAINT FK_MeterLimits_RefWriteState FOREIGN KEY (WriteStateId) REFERENCES RefWriteStates (WriteStateId) ON DELETE CASCADE,
   ADD CONSTRAINT FK_MeterLimits_Limit FOREIGN KEY (LimitId) REFERENCES Limits (LimitId) ON DELETE CASCADE,
   ADD PRIMARY KEY (MeterId, LimitId);


Delete all foreign key and alter table. But this table don`t change.
Please fix it.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.4.393 (12-Dec-2013) - Incorrect update script for MySQL

Post by MariiaI » Wed 25 Dec 2013 12:15

We couldn't reproduce this issue with your model (you have sent us earlier regarding another forum thread). We have created a sample project and sent it to you. The SQL script for creating all necessary database tables (Meters, Refwritestates, Limits, Meterlimits and others) is included too.
We are performing the following steps:
- create LinqConnect model with these tables which were created based on the script we have sent you;
- perform "Update Database from Model" wizard (the "Regenerate storage" check box is not selected) and we don't get such result.

Please try this sample and tell us about the results. Also, please send us a small test project and describe the exact steps to reproduce this issue.

AKRRKA
Posts: 198
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

Re: LinqConnect Professional Version 4.4.393 (12-Dec-2013) - Incorrect update script for MySQL

Post by AKRRKA » Wed 25 Dec 2013 14:21

I demonstrated the problem in the video.
Please review them.

Видео_2013-12-25_181116.wmv 39.0 MB - http://www.solidfiles.com/d/6caac48146/

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.4.393 (12-Dec-2013) - Incorrect update script for MySQL

Post by MariiaI » Thu 26 Dec 2013 09:07

Thank you for the additional information. We have reproduced this issue. We will investigate it and inform you about the results as soon as any are available.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.4.393 (12-Dec-2013) - Incorrect update script for MySQL

Post by MariiaI » Tue 14 Jan 2014 06:34

The issue related to the incorrect change detection when updating database from model (the precision and comments) is fixed. We will inform you when the corresponding build of LinqConnect is available for download.

The issue with foreign keys is related to the MySQL engine being used - InnoDB or MyISAM. The creation of the foreign keys is allowed only by InnoDB - it is set by default on servers since version 5.5. However, on older versions the MyISAM engine is set to default, and when the database create script is performed, foreign keys are not created.
Thus, to be able to work with foreign keys:
- configure your server by setting the Default MySQL Storage Engine to InnoDB (applies to the entire server)
or
- before executing the script perform "SET storage_engine = INNODB;" (applies to the session).


MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.4.393 (12-Dec-2013) - Incorrect update script for MySQL

Post by MariiaI » Fri 17 Jan 2014 06:06

New build of LinqConnect 4.4.418 is available for download now!
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only)
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=28731.

Please try it and tell us about the results.

Post Reply