dbpatterns icon indicating copy to clipboard operation
dbpatterns copied to clipboard

Exported SQLite Script FKs does not work

Open guneysus opened this issue 8 years ago • 0 comments

OS: Microsoft Windows [Version 10.0.14372] SQLite Version: 3.10.1 2016-01-13 21:41:56 254419c36766225ca542ae873ed38255e3fb8588

I had to manually edit FK sections of exported Sqlite script since it throws syntax error.

  • I splitted Column and FK definitions
  • Moved FK definitions to last lines of table definitions.

Uploaded buggy and fixed scripts as a Gist , Download as Zip with

  • Import scripts (bat and shell scripts)
  • Original and fixed sql scripts
  • With a simple diff file

Example:

I fixed manually changing this section:

CREATE TABLE "Led" (
    "id" int PRIMARY KEY,
    "oda_id" int FOREIGN KEY("oda_id") REFERENCES "Oda" ("id"),
    "status_id" int FOREIGN KEY("status_id") REFERENCES "Status" ("id")
);

To:

CREATE TABLE "Led" (
    "id" int PRIMARY KEY,
    "oda_id" int, 
    "status_id" int,
    FOREIGN KEY("oda_id") REFERENCES "Oda" ("id"),
    FOREIGN KEY("status_id") REFERENCES "Status" ("id")
);

guneysus avatar Jul 07 '16 12:07 guneysus