Bug #12358 MS SQL 2000 foreign key not generated
Submitted: 3 Aug 2005 20:42 Modified: 22 Aug 2005 19:27
Reporter: Sue-Yen Tsai Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Migration Toolkit Severity:S1 (Critical)
Version:1.0.11 beta OS:Windows (Windows XP Pro)
Assigned to: CPU Architecture:Any

[3 Aug 2005 20:42] Sue-Yen Tsai
Description:
I tried to migrate some tables from MS SQL 2000 enterprise (with sp3 running on a remote machine) to MySQL 4.1.13 (running on my own machine). Some tables have more than one foreign key. However, only one foreign key for each table is generated by the migration toolkit.

How to repeat:
I created few tables to recreate the issue. Here is the sql script I used to create table on MS SQL 2000 server.

create table employee
(	
	idCode varchar(13) not null,	
	SSN varchar(9),
	activeStatus varchar(1),
	statusDate datetime,
	firstName varchar(30),
	lastName varchar(30),
	add1 varchar(60),	
	city varchar(20),
	state varchar(2),
	zip varchar(5),	
	oPhone varchar(14),
	hPhone varchar(14),
	fax varchar(14),
	primary key (idCode)
)

create table dept
(
	dptName varchar(25) not null,
	managerID varchar(13) not null,
	primary key (dptName),
	constraint managerLnk Foreign key (managerID) references employee(idCode)
)

create table dptLnk(
	employeeId varchar(13) not null,
	dptId varchar(25) not null,
	primary key (employeeId, dptId),
	constraint empLink Foreign key (employeeId) references employee(idCode),
	constraint dptLink Foreign key (dptId) references dept(dptName)
)

After the migration. Only constraint "dptLink" was created for table dptLnk. 

Here is the log from migration toolkit

--------------------------------------------------------------------------------
-- MySQL Migration Toolkit Report                                             --
--                                                                            --
-- Title:   Summary Of The Migration Process                                  --
-- Date:    2005-08-03 15:23                                                  --
--------------------------------------------------------------------------------

1. Schema Migration
-------------------

  Number of migrated schemata: 1

  Schema Name:            webase_dbo
  - Tables:               3
  - Views:                0
  - Routines:             0
  - Structured Types:     0

  Details:

  - Tables
      `webase_dbo`.`dept`
      -------------------
      `webase_dbo`.`dptLnk`
      ---------------------
      `webase_dbo`.`employee`
      -----------------------
  - Views
  - Routines
  - Structured Types

2. Data Bulk Transfer
---------------------

      `webase_dbo`.`dept`
      -------------------
          0 row(s) transfered.

      `webase_dbo`.`dptLnk`
      ---------------------
          0 row(s) transfered.

      `webase_dbo`.`employee`
      -----------------------
          0 row(s) transfered.

End of report.
--------------------------------------------------------------------------------

Suggested fix:
N/A
[17 Aug 2005 18:58] Jorge del Conde
Thanks for your excellent test-case.  I was able to reproduce this behaviour using SQL2K Dev, WinXP SP2 and MT 1.0.12
[22 Aug 2005 19:27] Michael G. Zinner
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html