Subject: | SQLite producer do not output PRIMARY keys unless using intermduate YAML representation |
Hello,
Using an oracle database.
If I directly try to produce the SQLite schema, like:
sqlt -f DBI --dsn dsn --db-user user--db-password pwd--quote-field-names
-t SQLite > foo.sqlite
Then foo.sqlite does not have any primary key:
CREATE TABLE "GECKO_BIOMARKER" (
"BIOMARKER_ID" NUMBER(126) NOT NULL,
"PARENT_BIOMARKER_ID" NUMBER(126),
"BIOMARKER_TYPE_ID" NUMBER(126) NOT NULL,
"BIOMARKER_NAME" VARCHAR2(45) NOT NULL,
FOREIGN KEY ("BIOMARKER_TYPE_ID") REFERENCES
"GECKO_BIOMARKER_TYPE"("BIOMARKER_TYPE_ID"),
FOREIGN KEY ("PARENT_BIOMARKER_ID") REFERENCES
"GECKO_BIOMARKER"("BIOMARKER_ID")
);
BUT if I do it in two steps:
sqlt -f DBI --dsn dsn --db-user user--db-password pwd--quote-field-names
-t YAML> foo.yaml
sqlt -f YAML foo.yaml -t SQLite > foo.sqlite --quote-field-names
then the output is (at least seems) correct:
CREATE TABLE "GECKO_BIOMARKER" (
"BIOMARKER_ID" INTEGER PRIMARY KEY NOT NULL,
"PARENT_BIOMARKER_ID" NUMBER(126),
"BIOMARKER_TYPE_ID" NUMBER(126) NOT NULL,
"BIOMARKER_NAME" VARCHAR2(45) NOT NULL,
FOREIGN KEY ("BIOMARKER_TYPE_ID") REFERENCES
"GECKO_BIOMARKER_TYPE"("BIOMARKER_TYPE_ID"),
FOREIGN KEY ("PARENT_BIOMARKER_ID") REFERENCES
"GECKO_BIOMARKER"("BIOMARKER_ID")
);
SQL::Translator v0.11012
This is perl 5, version 14, subversion 2 (v5.14.2) built for
x86_64-linux-thread-multi
Linux chge1x0039 2.6.16.60-0.85.1-smp #1 SMP Thu Mar 17 11:45:06 UTC
2011 x86_64 x86_64 x86_64 GNU/Linux