Skip to content

Instantly share code, notes, and snippets.

@severak
Created January 31, 2018 10:55
Show Gist options
  • Save severak/b8b8c4d66c3f839d63f2cd83e9f37101 to your computer and use it in GitHub Desktop.
Save severak/b8b8c4d66c3f839d63f2cd83e9f37101 to your computer and use it in GitHub Desktop.
tak nějak
CREATE TABLE IF NOT EXISTS "meta" (
"k" text NOT NULL,
"v" text NOT NULL,
PRIMARY KEY ("k")
);
CREATE TABLE IF NOT EXISTS "license" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text NOT NULL,
FOREIGN KEY ("id") REFERENCES "book" ("id")
);
CREATE TABLE IF NOT EXISTS "author" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text NOT NULL,
"firstname" text NOT NULL,
"lastname" text NOT NULL,
"info" text NOT NULL,
"olid" text NOT NULL,
"wikipedia_url" text NOT NULL
);
CREATE TABLE IF NOT EXISTS "book" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text NOT NULL,
"author_name" text NOT NULL,
"author_id" integer NOT NULL,
"category_id" integer NOT NULL,
"license_id" integer NOT NULL,
"short_info" text NOT NULL,
"long_info" text NOT NULL DEFAULT '',
"isbn" text NOT NULL,
"olid" text NOT NULL,
"wikipedia_url" text NOT NULL,
"download_url" text NOT NULL,
"mirror_url" text NOT NULL,
"source_url" text NOT NULL,
FOREIGN KEY ("license_id") REFERENCES "license" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY ("author_id") REFERENCES "author" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment