Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

Endret databasen til å ha engelske navn.

This commit is contained in:
Øystein Ingmar Skartsæterhagen 2011-10-08 10:11:02 +00:00
parent 8630ab2732
commit 0ea875ff76
2 changed files with 53 additions and 54 deletions

View File

@ -1,68 +1,67 @@
CREATE TABLE kategori CREATE TABLE category
(id text PRIMARY KEY, (id text PRIMARY KEY,
navn text NOT NULL); name text NOT NULL);
CREATE TABLE plassering CREATE TABLE placement
(id SERIAL PRIMARY KEY, (id SERIAL PRIMARY KEY,
kategori text NOT NULL REFERENCES kategori (id), category text NOT NULL REFERENCES category (id),
hylle text NOT NULL); shelf text NOT NULL);
CREATE TABLE bokserie CREATE TABLE bookseries
(id text PRIMARY KEY, (id text PRIMARY KEY,
tittel text NOT NULL); title text NOT NULL);
CREATE TABLE bok CREATE TABLE book
(isbn text PRIMARY KEY, (isbn text PRIMARY KEY,
id text NOT NULL, id text,
tittel text NOT NULL, title text NOT NULL,
undertittel text, subtitle text,
kategori text NOT NULL REFERENCES kategori (id), category text NOT NULL REFERENCES category (id),
forlag text, publisher text,
utgivelsesaar integer, published_year integer,
utgave text, edition text,
sidetall integer, pages integer,
serie text REFERENCES bokserie (id), series text REFERENCES bookseries (id),
beskrivelse text); -- TODO: bilde? description text); -- TODO: bilde?
CREATE TABLE alternativ_tittel CREATE TABLE alternative_title
(id SERIAL PRIMARY KEY, (id SERIAL PRIMARY KEY,
bok text NOT NULL REFERENCES bok (isbn), book text NOT NULL REFERENCES book (isbn),
alt_tittel text NOT NULL); alt_title text NOT NULL);
CREATE TABLE eksemplar CREATE TABLE copy
(bok text REFERENCES bok (isbn), (book text REFERENCES book (isbn),
nummer integer, number integer,
eier text, owner text,
PRIMARY KEY(bok, nummer)); PRIMARY KEY(book, number));
CREATE TABLE person CREATE TABLE person
(id text PRIMARY KEY, (id text PRIMARY KEY,
etternavn text NOT NULL, lastname text NOT NULL,
fornavn text NOT NULL); firstname text NOT NULL);
CREATE TABLE rolle CREATE TABLE bookrole
(id text PRIMARY KEY, (id text PRIMARY KEY,
navn text NOT NULL); name text NOT NULL);
CREATE TABLE bokperson CREATE TABLE bookperson
(id SERIAL PRIMARY KEY, (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), 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, (id text PRIMARY KEY,
navn text NOT NULL); name text NOT NULL);
CREATE TABLE bokreferanse CREATE TABLE bookreference
(id SERIAL PRIMARY KEY, (id SERIAL PRIMARY KEY,
bok text NOT NULL REFERENCES bok (isbn), book text NOT NULL REFERENCES book (isbn),
reftype text NOT NULL REFERENCES referansetype (id), reftype text NOT NULL REFERENCES referencetype (id),
tekst text NOT NULL); value text NOT NULL);
CREATE TABLE personreferanse CREATE TABLE personreference
(id SERIAL PRIMARY KEY, (id SERIAL PRIMARY KEY,
person text NOT NULL REFERENCES person (id), person text NOT NULL REFERENCES person (id),
reftype text NOT NULL REFERENCES referansetype (id), reftype text NOT NULL REFERENCES referencetype (id),
tekst text NOT NULL); value text NOT NULL);

View File

@ -1,12 +1,12 @@
DROP TABLE personreferanse; DROP TABLE personreference;
DROP TABLE bokreferanse; DROP TABLE bookreference;
DROP TABLE referansetype; DROP TABLE referencetype;
DROP TABLE bokperson; DROP TABLE bookperson;
DROP TABLE rolle; DROP TABLE bookrole;
DROP TABLE person; DROP TABLE person;
DROP TABLE eksemplar; DROP TABLE copy;
DROP TABLE alternativ_tittel; DROP TABLE alternative_title;
DROP TABLE bok; DROP TABLE book;
DROP TABLE bokserie; DROP TABLE bookseries;
DROP TABLE plassering; DROP TABLE placement;
DROP TABLE kategori; DROP TABLE category;