FerreroJeremy/ln2sql

Primary key and Foreign key undparsed in ALTER TABLE

FerreroJeremy opened this issue · 1 comments

In tables.sql.zip, the following lines are ignored during the parsing.

ALTER TABLE `city`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id` (`id`);

ALTER TABLE `emp`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cityId` (`cityId`);

ALTER TABLE `emp`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

ALTER TABLE `emp`
  ADD CONSTRAINT `emp_ibfk_1` FOREIGN KEY (`cityId`) REFERENCES `city` (`id`);

yes the PRIMARY KEY statement must occur in the CREATE TABLE statement itself for ln2sql to detect it