mysql2sqlite
mysql2sqlite copied to clipboard
Fix double quotes for KEY
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.