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(),
36 CONSTRAINT cb_cb_item_once_per_bucket UNIQUE (bucket,target_copy)
42 CREATE TABLE container.call_number_bucket (
43 id SERIAL PRIMARY KEY,
45 REFERENCES actor.usr (id)
51 btype TEXT NOT NULL DEFAULT 'misc',
52 pub BOOL NOT NULL DEFAULT FALSE,
53 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
54 CONSTRAINT cnb_name_once_per_owner UNIQUE (owner,name,btype)
57 CREATE TABLE container.call_number_bucket_item (
58 id SERIAL PRIMARY KEY,
60 REFERENCES container.call_number_bucket (id)
65 target_call_number INT NOT NULL
66 REFERENCES asset.call_number (id)
71 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
72 CONSTRAINT cnb_item_once_per_bucket UNIQUE (bucket,target_call_number)
78 CREATE TABLE container.biblio_record_entry_bucket (
79 id SERIAL PRIMARY KEY,
81 REFERENCES actor.usr (id)
87 btype TEXT NOT NULL DEFAULT 'misc',
88 pub BOOL NOT NULL DEFAULT FALSE,
89 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
90 CONSTRAINT breb_name_once_per_owner UNIQUE (owner,name,btype)
93 CREATE TABLE container.biblio_record_entry_bucket_item (
94 id SERIAL PRIMARY KEY,
96 REFERENCES container.biblio_record_entry_bucket (id)
101 target_biblio_record_entry INT NOT NULL
102 REFERENCES biblio.record_entry (id)
107 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
108 CONSTRAINT breb_item_once_per_bucket UNIQUE (bucket,target_biblio_record_entry)
114 CREATE TABLE container.user_bucket (
115 id SERIAL PRIMARY KEY,
117 REFERENCES actor.usr (id)
123 btype TEXT NOT NULL DEFAULT 'misc',
124 pub BOOL NOT NULL DEFAULT FALSE,
125 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
126 CONSTRAINT ub_name_once_per_owner UNIQUE (owner,name,btype)
129 CREATE TABLE container.user_bucket_item (
130 id SERIAL PRIMARY KEY,
132 REFERENCES container.user_bucket (id)
137 target_user INT NOT NULL
138 REFERENCES actor.usr (id)
143 create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
144 CONSTRAINT ub_item_once_per_bucket UNIQUE (bucket,target_user)