1 DROP SCHEMA container CASCADE;
4 CREATE SCHEMA container;
6 CREATE TABLE container.copy_bucket (
9 REFERENCES actor.usr (id)
15 btype TEXT NOT NULL DEFAULT 'misc',
16 pub BOOL NOT NULL DEFAULT FALSE,
17 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
18 CONSTRAINT cb_name_once_per_owner UNIQUE (owner,name,btype)
21 CREATE TABLE container.copy_bucket_item (
22 id SERIAL PRIMARY KEY,
24 REFERENCES container.copy_bucket (id)
29 target_copy INT NOT NULL
30 REFERENCES asset."copy" (id)
35 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
41 CREATE TABLE container.call_number_bucket (
42 id SERIAL PRIMARY KEY,
44 REFERENCES actor.usr (id)
50 btype TEXT NOT NULL DEFAULT 'misc',
51 pub BOOL NOT NULL DEFAULT FALSE,
52 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
53 CONSTRAINT cnb_name_once_per_owner UNIQUE (owner,name,btype)
56 CREATE TABLE container.call_number_bucket_item (
57 id SERIAL PRIMARY KEY,
59 REFERENCES container.call_number_bucket (id)
64 target_call_number INT NOT NULL
65 REFERENCES asset.call_number (id)
70 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
76 CREATE TABLE container.biblio_record_entry_bucket (
77 id SERIAL PRIMARY KEY,
79 REFERENCES actor.usr (id)
85 btype TEXT NOT NULL DEFAULT 'misc',
86 pub BOOL NOT NULL DEFAULT FALSE,
87 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
88 CONSTRAINT breb_name_once_per_owner UNIQUE (owner,name,btype)
91 CREATE TABLE container.biblio_record_entry_bucket_item (
92 id SERIAL PRIMARY KEY,
94 REFERENCES container.biblio_record_entry_bucket (id)
99 target_biblio_record_entry INT NOT NULL
100 REFERENCES biblio.record_entry (id)
105 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
111 CREATE TABLE container.user_bucket (
112 id SERIAL PRIMARY KEY,
114 REFERENCES actor.usr (id)
120 btype TEXT NOT NULL DEFAULT 'misc',
121 pub BOOL NOT NULL DEFAULT FALSE,
122 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
123 CONSTRAINT ub_name_once_per_owner UNIQUE (owner,name,btype)
126 CREATE TABLE container.user_bucket_item (
127 id SERIAL PRIMARY KEY,
129 REFERENCES container.user_bucket (id)
134 target_user INT NOT NULL
135 REFERENCES actor.usr (id)
140 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()