mysql2sqlite icon indicating copy to clipboard operation
mysql2sqlite copied to clipboard

Fix double quotes for KEY

Open nathanweeks opened this issue 7 years ago • 0 comments

Given the following DDL:

CREATE TABLE "foo1" (
  "col1" varchar(255),
  KEY "key1" ("x"),
  CONSTRAINT "constraint1" FOREIGN KEY ("fk1") REFERENCES "foo2" ("col2")
);

mysql2sqlite emits (1) a malformed CREATE INDEX statement, and (2) a line containing only a comma before the CONSTRAINT:

PRAGMA synchronous = OFF;
PRAGMA journal_mode = MEMORY;
BEGIN TRANSACTION;
CREATE TABLE "foo1" (
  "col1" varchar(255)
,
,  CONSTRAINT "constraint1" FOREIGN KEY ("fk1") REFERENCES "foo2" ("col2")
);
CREATE INDEX "idx__" ON "" ("x");
END TRANSACTION;

This patch addresses both of these issues.

nathanweeks avatar Oct 15 '18 20:10 nathanweeks