Start making create script idempotent

main
Jeffrey Elkner 2 years ago
parent 22bf231fa6
commit efe3323075

@ -1,10 +1,14 @@
BEGIN TRANSACTION; BEGIN TRANSACTION;
CREATE TABLE Author( DROP TABLE IF EXISTS "author";
DROP TABLE IF EXISTS "quote";
DROP TABLE IF EXISTS "category";
DROP TABLE IF EXISTS "quotecategory";
CREATE TABLE author(
aid SERIAL PRIMARY KEY, aid SERIAL PRIMARY KEY,
fname TEXT, fname TEXT,
lname TEXT lname TEXT
); );
CREATE TABLE Quote( CREATE TABLE quote(
qid SERIAL PRIMARY KEY, qid SERIAL PRIMARY KEY,
qtext TEXT, qtext TEXT,
aid INTEGER, aid INTEGER,
@ -12,11 +16,11 @@ CREATE TABLE Quote(
qdate DATE, qdate DATE,
FOREIGN KEY (aid) REFERENCES Author(aid) FOREIGN KEY (aid) REFERENCES Author(aid)
); );
CREATE TABLE Category( CREATE TABLE category(
cid SERIAL PRIMARY KEY, cid SERIAL PRIMARY KEY,
description TEXT description TEXT
); );
CREATE TABLE QuoteCategory( CREATE TABLE quotecategory(
qid INTEGER, qid INTEGER,
cid INTEGER, cid INTEGER,
FOREIGN KEY(qid) REFERENCES Quote(qid), FOREIGN KEY(qid) REFERENCES Quote(qid),

Loading…
Cancel
Save