Skip to content

Navigation Menu

Sign in
Sign up

Adding FOREIGN KEY error #84

Open
Open

Description

Hi,

I have a simple database which I attached here as a zip file:
Classes.db.zip

I want to add a FOREIGN KEY as follows in the code bellow, by following advice from here:
(https://github.com/lazierthanthou/sqlite-manager/wiki/Foreign-Key-support)
`ALTER TABLE "main"."students" RENAME TO "oXHFcGcd04oXHFcGcd04_students"
CREATE TABLE "main"."students" ("student_id" TEXT NOT NULL ,"first_name" TEXT NOT NULL ,"last_name" TEXT NOT NULL ,"class_name" TEXT, FOREIGN KEY(class_name) REFERENCES classes(class_name), DEFAULT (null) )

INSERT INTO "main"."students" SELECT "student_id","first_name","last_name","class_name" FROM "main"."oXHFcGcd04oXHFcGcd04_students"
DROP TABLE "main"."oXHFcGcd04oXHFcGcd04_students"`
but get always the following error:

SQLiteManager: CREATE TABLE "main"."students" ("student_id" TEXT NOT NULL ,"first_name" TEXT NOT NULL ,"last_name" TEXT NOT NULL ,"class_name" TEXT, FOREIGN KEY(class_name) REFERENCES classes(class_name), DEFAULT (null) ) [ near "DEFAULT": syntax error ]
Exception Name: NS_ERROR_FAILURE
Exception Message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [mozIStorageConnection.createStatement]

What am I missing here?

Best, Pali

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /