2 * Copyright (C) 2004-2008 Georgia Public Library Service
3 * Copyright (C) 2007-2008 Equinox Software, Inc.
4 * Mike Rylander <miker@esilibrary.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 DROP SCHEMA container CASCADE;
21 CREATE SCHEMA container;
23 CREATE TABLE container.copy_bucket (
24 id SERIAL PRIMARY KEY,
26 REFERENCES actor.usr (id)
32 btype TEXT NOT NULL DEFAULT 'misc',
33 pub BOOL NOT NULL DEFAULT FALSE,
34 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
35 CONSTRAINT cb_name_once_per_owner UNIQUE (owner,name,btype)
38 CREATE TABLE container.copy_bucket_item (
39 id SERIAL PRIMARY KEY,
41 REFERENCES container.copy_bucket (id)
46 target_copy INT NOT NULL
47 REFERENCES asset."copy" (id)
52 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
58 CREATE TABLE container.call_number_bucket (
59 id SERIAL PRIMARY KEY,
61 REFERENCES actor.usr (id)
67 btype TEXT NOT NULL DEFAULT 'misc',
68 pub BOOL NOT NULL DEFAULT FALSE,
69 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
70 CONSTRAINT cnb_name_once_per_owner UNIQUE (owner,name,btype)
73 CREATE TABLE container.call_number_bucket_item (
74 id SERIAL PRIMARY KEY,
76 REFERENCES container.call_number_bucket (id)
81 target_call_number INT NOT NULL
82 REFERENCES asset.call_number (id)
87 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
93 CREATE TABLE container.biblio_record_entry_bucket (
94 id SERIAL PRIMARY KEY,
96 REFERENCES actor.usr (id)
102 btype TEXT NOT NULL DEFAULT 'misc',
103 pub BOOL NOT NULL DEFAULT FALSE,
104 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
105 CONSTRAINT breb_name_once_per_owner UNIQUE (owner,name,btype)
108 CREATE TABLE container.biblio_record_entry_bucket_item (
109 id SERIAL PRIMARY KEY,
111 REFERENCES container.biblio_record_entry_bucket (id)
116 target_biblio_record_entry INT NOT NULL
117 REFERENCES biblio.record_entry (id)
122 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
128 CREATE TABLE container.user_bucket (
129 id SERIAL PRIMARY KEY,
131 REFERENCES actor.usr (id)
137 btype TEXT NOT NULL DEFAULT 'misc',
138 pub BOOL NOT NULL DEFAULT FALSE,
139 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
140 CONSTRAINT ub_name_once_per_owner UNIQUE (owner,name,btype)
143 CREATE TABLE container.user_bucket_item (
144 id SERIAL PRIMARY KEY,
146 REFERENCES container.user_bucket (id)
151 target_user INT NOT NULL
152 REFERENCES actor.usr (id)
157 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()