Endret databasen til å ha engelske navn.
This commit is contained in:
parent
8630ab2732
commit
0ea875ff76
85
db/db.sql
85
db/db.sql
@ -1,68 +1,67 @@
|
||||
CREATE TABLE kategori
|
||||
CREATE TABLE category
|
||||
(id text PRIMARY KEY,
|
||||
navn text NOT NULL);
|
||||
name text NOT NULL);
|
||||
|
||||
CREATE TABLE plassering
|
||||
CREATE TABLE placement
|
||||
(id SERIAL PRIMARY KEY,
|
||||
kategori text NOT NULL REFERENCES kategori (id),
|
||||
hylle text NOT NULL);
|
||||
category text NOT NULL REFERENCES category (id),
|
||||
shelf text NOT NULL);
|
||||
|
||||
CREATE TABLE bokserie
|
||||
CREATE TABLE bookseries
|
||||
(id text PRIMARY KEY,
|
||||
tittel text NOT NULL);
|
||||
title text NOT NULL);
|
||||
|
||||
CREATE TABLE bok
|
||||
CREATE TABLE book
|
||||
(isbn text PRIMARY KEY,
|
||||
id text NOT NULL,
|
||||
tittel text NOT NULL,
|
||||
undertittel text,
|
||||
kategori text NOT NULL REFERENCES kategori (id),
|
||||
forlag text,
|
||||
utgivelsesaar integer,
|
||||
utgave text,
|
||||
sidetall integer,
|
||||
serie text REFERENCES bokserie (id),
|
||||
beskrivelse text); -- TODO: bilde?
|
||||
id text,
|
||||
title text NOT NULL,
|
||||
subtitle text,
|
||||
category text NOT NULL REFERENCES category (id),
|
||||
publisher text,
|
||||
published_year integer,
|
||||
edition text,
|
||||
pages integer,
|
||||
series text REFERENCES bookseries (id),
|
||||
description text); -- TODO: bilde?
|
||||
|
||||
CREATE TABLE alternativ_tittel
|
||||
CREATE TABLE alternative_title
|
||||
(id SERIAL PRIMARY KEY,
|
||||
bok text NOT NULL REFERENCES bok (isbn),
|
||||
alt_tittel text NOT NULL);
|
||||
book text NOT NULL REFERENCES book (isbn),
|
||||
alt_title text NOT NULL);
|
||||
|
||||
CREATE TABLE eksemplar
|
||||
(bok text REFERENCES bok (isbn),
|
||||
nummer integer,
|
||||
eier text,
|
||||
PRIMARY KEY(bok, nummer));
|
||||
CREATE TABLE copy
|
||||
(book text REFERENCES book (isbn),
|
||||
number integer,
|
||||
owner text,
|
||||
PRIMARY KEY(book, number));
|
||||
|
||||
CREATE TABLE person
|
||||
(id text PRIMARY KEY,
|
||||
etternavn text NOT NULL,
|
||||
fornavn text NOT NULL);
|
||||
lastname text NOT NULL,
|
||||
firstname text NOT NULL);
|
||||
|
||||
CREATE TABLE rolle
|
||||
CREATE TABLE bookrole
|
||||
(id text PRIMARY KEY,
|
||||
navn text NOT NULL);
|
||||
name text NOT NULL);
|
||||
|
||||
CREATE TABLE bokperson
|
||||
CREATE TABLE bookperson
|
||||
(id SERIAL PRIMARY KEY,
|
||||
bok text NOT NULL REFERENCES bok (isbn),
|
||||
book text NOT NULL REFERENCES book (isbn),
|
||||
person text NOT NULL REFERENCES person (id),
|
||||
relasjon text NOT NULL REFERENCES rolle (id));
|
||||
relation text NOT NULL REFERENCES bookrole (id));
|
||||
|
||||
CREATE TABLE referansetype
|
||||
CREATE TABLE referencetype
|
||||
(id text PRIMARY KEY,
|
||||
navn text NOT NULL);
|
||||
name text NOT NULL);
|
||||
|
||||
CREATE TABLE bokreferanse
|
||||
CREATE TABLE bookreference
|
||||
(id SERIAL PRIMARY KEY,
|
||||
bok text NOT NULL REFERENCES bok (isbn),
|
||||
reftype text NOT NULL REFERENCES referansetype (id),
|
||||
tekst text NOT NULL);
|
||||
book text NOT NULL REFERENCES book (isbn),
|
||||
reftype text NOT NULL REFERENCES referencetype (id),
|
||||
value text NOT NULL);
|
||||
|
||||
CREATE TABLE personreferanse
|
||||
CREATE TABLE personreference
|
||||
(id SERIAL PRIMARY KEY,
|
||||
person text NOT NULL REFERENCES person (id),
|
||||
reftype text NOT NULL REFERENCES referansetype (id),
|
||||
tekst text NOT NULL);
|
||||
|
||||
reftype text NOT NULL REFERENCES referencetype (id),
|
||||
value text NOT NULL);
|
||||
|
@ -1,12 +1,12 @@
|
||||
DROP TABLE personreferanse;
|
||||
DROP TABLE bokreferanse;
|
||||
DROP TABLE referansetype;
|
||||
DROP TABLE bokperson;
|
||||
DROP TABLE rolle;
|
||||
DROP TABLE personreference;
|
||||
DROP TABLE bookreference;
|
||||
DROP TABLE referencetype;
|
||||
DROP TABLE bookperson;
|
||||
DROP TABLE bookrole;
|
||||
DROP TABLE person;
|
||||
DROP TABLE eksemplar;
|
||||
DROP TABLE alternativ_tittel;
|
||||
DROP TABLE bok;
|
||||
DROP TABLE bokserie;
|
||||
DROP TABLE plassering;
|
||||
DROP TABLE kategori;
|
||||
DROP TABLE copy;
|
||||
DROP TABLE alternative_title;
|
||||
DROP TABLE book;
|
||||
DROP TABLE bookseries;
|
||||
DROP TABLE placement;
|
||||
DROP TABLE category;
|
||||
|
Reference in New Issue
Block a user