new "container" stuff ... where the buckets live
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 30 Nov 2005 15:42:38 +0000 (15:42 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 30 Nov 2005 15:42:38 +0000 (15:42 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2129 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/container.pm [new file with mode: 0644]
Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/container.pm [new file with mode: 0644]
Open-ILS/src/sql/Pg/070.schema.container.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/build-db.sh

index 5c2dec8..da41af8 100644 (file)
@@ -12,6 +12,7 @@ use OpenILS::Application::Storage::CDBI::config;
 use OpenILS::Application::Storage::CDBI::metabib;
 use OpenILS::Application::Storage::CDBI::money;
 use OpenILS::Application::Storage::CDBI::permission;
 use OpenILS::Application::Storage::CDBI::metabib;
 use OpenILS::Application::Storage::CDBI::money;
 use OpenILS::Application::Storage::CDBI::permission;
+use OpenILS::Application::Storage::CDBI::container;
 
 use JSON;
 use OpenSRF::Utils::Logger;
 
 use JSON;
 use OpenSRF::Utils::Logger;
diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/container.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/container.pm
new file mode 100644 (file)
index 0000000..0611698
--- /dev/null
@@ -0,0 +1,65 @@
+package OpenILS::Application::Storage::CDBI::container;
+our $VERSION = 1;
+
+#-------------------------------------------------------------------------------
+package container;
+use base qw/OpenILS::Application::Storage::CDBI/;
+#-------------------------------------------------------------------------------
+package container::user_bucket;
+use base qw/container/;
+
+container::user_bucket->table( 'container_user_bucket' );
+container::user_bucket->columns( All => qw/id owner name/ );
+
+#-------------------------------------------------------------------------------
+package container::user_bucket_item;
+use base qw/container/;
+
+container::user_bucket->table( 'container_user_bucket_item' );
+container::user_bucket->columns( All => qw/id bucket target_user/ );
+
+#-------------------------------------------------------------------------------
+package container::copy_bucket;
+use base qw/container/;
+
+container::copy_bucket->table( 'container_copy_bucket' );
+container::copy_bucket->columns( All => qw/id owner name/ );
+
+#-------------------------------------------------------------------------------
+package container::copy_bucket_item;
+use base qw/container/;
+
+container::copy_bucket->table( 'container_copy_bucket_item' );
+container::copy_bucket->columns( All => qw/id bucket target_copy/ );
+
+#-------------------------------------------------------------------------------
+package container::biblio_record_entry_bucket;
+use base qw/container/;
+
+container::biblio_record_entry_bucket->table( 'container_biblio_record_entry_bucket' );
+container::biblio_record_entry_bucket->columns( All => qw/id owner name/ );
+
+#-------------------------------------------------------------------------------
+package container::biblio_record_entry_bucket_item;
+use base qw/container/;
+
+container::biblio_record_entry_bucket->table( 'container_biblio_record_entry_bucket_item' );
+container::biblio_record_entry_bucket->columns( All => qw/id bucket target_biblio_record_entry/ );
+
+#-------------------------------------------------------------------------------
+package container::call_number_bucket;
+use base qw/container/;
+
+container::call_number_bucket->table( 'container_call_number_bucket' );
+container::call_number_bucket->columns( All => qw/id owner name/ );
+
+#-------------------------------------------------------------------------------
+package container::call_number_bucket_item;
+use base qw/container/;
+
+container::call_number_bucket->table( 'container_call_number_bucket_item' );
+container::call_number_bucket->columns( All => qw/id bucket target_call_number/ );
+
+
+1;
+
index 65ab7de..6ab2325 100644 (file)
@@ -1,4 +1,53 @@
 {
 {
+
+       #-------------------------------------------------------------------------------
+       package container::user_bucket;
+
+       container::user_bucket->table( 'container.user_bucket' );
+       container::user_bucket->sequence( 'container.user_bucket_id_seq' );
+
+       #-------------------------------------------------------------------------------
+       package container::user_bucket_item;
+
+       container::user_bucket->table( 'container.user_bucket_item' );
+       container::user_bucket->sequence( 'container.user_bucket_item_id_seq' );
+
+       #-------------------------------------------------------------------------------
+       package container::copy_bucket;
+
+       container::copy_bucket->table( 'container.copy_bucket' );
+       container::copy_bucket->sequence( 'container.copy_bucket_id_seq' );
+
+       #-------------------------------------------------------------------------------
+       package container::copy_bucket_item;
+
+       container::copy_bucket->table( 'container.copy_bucket_item' );
+       container::copy_bucket->sequence( 'container.copy_bucket_item_id_seq' );
+
+       #-------------------------------------------------------------------------------
+       package container::call_number_bucket;
+
+       container::call_number_bucket->table( 'container.call_number_bucket' );
+       container::call_number_bucket->sequence( 'container.call_number_bucket_id_seq' );
+
+       #-------------------------------------------------------------------------------
+       package container::call_number_bucket_item;
+
+       container::call_number_bucket->table( 'container.call_number_bucket_item' );
+       container::call_number_bucket->sequence( 'container.call_number_bucket_item_id_seq' );
+
+       #-------------------------------------------------------------------------------
+       package container::biblio_record_entry_bucket;
+
+       container::biblio_record_entry_bucket->table( 'container.biblio_record_entry_bucket' );
+       container::biblio_record_entry_bucket->sequence( 'container.biblio_record_entry_bucket_id_seq' );
+
+       #-------------------------------------------------------------------------------
+       package container::biblio_record_entry_bucket_item;
+
+       container::biblio_record_entry_bucket->table( 'container.biblio_record_entry_bucket_item' );
+       container::biblio_record_entry_bucket->sequence( 'container.biblio_record_entry_bucket_item_id_seq' );
+
        #---------------------------------------------------------------------
        package money::grocery;
        
        #---------------------------------------------------------------------
        package money::grocery;
        
index e5a05f5..88f3379 100644 (file)
@@ -348,6 +348,7 @@ use OpenILS::Application::Storage::Publisher::metabib;
 use OpenILS::Application::Storage::Publisher::authority;
 use OpenILS::Application::Storage::Publisher::money;
 use OpenILS::Application::Storage::Publisher::permission;
 use OpenILS::Application::Storage::Publisher::authority;
 use OpenILS::Application::Storage::Publisher::money;
 use OpenILS::Application::Storage::Publisher::permission;
+use OpenILS::Application::Storage::Publisher::container;
 ';
 
 if ($@) {
 ';
 
 if ($@) {
diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/container.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/container.pm
new file mode 100644 (file)
index 0000000..fe60ee6
--- /dev/null
@@ -0,0 +1,6 @@
+package OpenILS::Application::Storage::Publisher::container;
+use base qw/OpenILS::Application::Storage/;
+#use OpenILS::Application::Storage::CDBI::config;
+
+
+1;
diff --git a/Open-ILS/src/sql/Pg/070.schema.container.sql b/Open-ILS/src/sql/Pg/070.schema.container.sql
new file mode 100644 (file)
index 0000000..7dc026a
--- /dev/null
@@ -0,0 +1,131 @@
+DROP SCHEMA container CASCADE;
+
+BEGIN;
+CREATE SCHEMA container;
+
+CREATE TABLE container.copy_bucket (
+       id      SERIAL  PRIMARY KEY,
+       owner   INT     NOT NULL
+                       REFERENCES actor.usr (id)
+                               ON DELETE CASCADE
+                               ON UPDATE CASCADE
+                               DEFERRABLE
+                               INITIALLY DEFERRED,
+       name    TEXT    NOT NULL,
+       CONSTRAINT cb_name_once_per_owner UNIQUE (owner,name)
+);
+
+CREATE TABLE container.copy_bucket_item (
+       id              SERIAL  PRIMARY KEY,
+       bucket          INT     NOT NULL
+                               REFERENCES container.copy_bucket (id)
+                                       ON DELETE CASCADE
+                                       ON UPDATE CASCADE
+                                       DEFERRABLE
+                                       INITIALLY DEFERRED,
+       target_copy     INT     NOT NULL
+                               REFERENCES asset."copy" (id)
+                                       ON DELETE CASCADE
+                                       ON UPDATE CASCADE
+                                       DEFERRABLE
+                                       INITIALLY DEFERRED,
+       CONSTRAINT cb_cb_item_once_per_bucket UNIQUE (bucket,target_copy)
+);
+
+
+
+
+CREATE TABLE container.call_number_bucket (
+       id      SERIAL  PRIMARY KEY,
+       owner   INT     NOT NULL
+                       REFERENCES actor.usr (id)
+                               ON DELETE CASCADE
+                               ON UPDATE CASCADE
+                               DEFERRABLE
+                               INITIALLY DEFERRED,
+       name    TEXT    NOT NULL,
+       CONSTRAINT cnb_name_once_per_owner UNIQUE (owner,name)
+);
+
+CREATE TABLE container.call_number_bucket_item (
+       id              SERIAL  PRIMARY KEY,
+       bucket          INT     NOT NULL
+                               REFERENCES container.call_number_bucket (id)
+                                       ON DELETE CASCADE
+                                       ON UPDATE CASCADE
+                                       DEFERRABLE
+                                       INITIALLY DEFERRED,
+       target_call_number      INT     NOT NULL
+                               REFERENCES asset.call_number (id)
+                                       ON DELETE CASCADE
+                                       ON UPDATE CASCADE
+                                       DEFERRABLE
+                                       INITIALLY DEFERRED,
+       CONSTRAINT cnb_item_once_per_bucket UNIQUE (bucket,target_call_number)
+);
+
+
+
+
+CREATE TABLE container.biblio_record_entry_bucket (
+       id      SERIAL  PRIMARY KEY,
+       owner   INT     NOT NULL
+                       REFERENCES actor.usr (id)
+                               ON DELETE CASCADE
+                               ON UPDATE CASCADE
+                               DEFERRABLE
+                               INITIALLY DEFERRED,
+       name    TEXT    NOT NULL,
+       CONSTRAINT breb_name_once_per_owner UNIQUE (owner,name)
+);
+
+CREATE TABLE container.biblio_record_entry_bucket_item (
+       id                              SERIAL  PRIMARY KEY,
+       bucket                          INT     NOT NULL
+                                               REFERENCES container.biblio_record_entry_bucket (id)
+                                                       ON DELETE CASCADE
+                                                       ON UPDATE CASCADE
+                                                       DEFERRABLE
+                                                       INITIALLY DEFERRED,
+       target_biblio_record_entry      INT     NOT NULL
+                                               REFERENCES biblio.record_entry (id)
+                                                       ON DELETE CASCADE
+                                                       ON UPDATE CASCADE
+                                                       DEFERRABLE
+                                                       INITIALLY DEFERRED,
+       CONSTRAINT breb_item_once_per_bucket UNIQUE (bucket,target_biblio_record_entry)
+);
+
+
+
+
+CREATE TABLE container.user_bucket (
+       id      SERIAL  PRIMARY KEY,
+       owner   INT     NOT NULL
+                       REFERENCES actor.usr (id)
+                               ON DELETE CASCADE
+                               ON UPDATE CASCADE
+                               DEFERRABLE
+                               INITIALLY DEFERRED,
+       name    TEXT    NOT NULL,
+       CONSTRAINT ub_name_once_per_owner UNIQUE (owner,name)
+);
+
+CREATE TABLE container.user_bucket_item (
+       id              SERIAL  PRIMARY KEY,
+       bucket          INT     NOT NULL
+                               REFERENCES container.user_bucket (id)
+                                       ON DELETE CASCADE
+                                       ON UPDATE CASCADE
+                                       DEFERRABLE
+                                       INITIALLY DEFERRED,
+       target_user     INT     NOT NULL
+                               REFERENCES actor.usr (id)
+                                       ON DELETE CASCADE
+                                       ON UPDATE CASCADE
+                                       DEFERRABLE
+                                       INITIALLY DEFERRED,
+       CONSTRAINT ub_item_once_per_bucket UNIQUE (bucket,target_user)
+);
+
+COMMIT;
index 724f294..27c3f14 100755 (executable)
@@ -11,6 +11,7 @@ PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 011.schema.authority.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 020.schema.functions.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 030.schema.metabib.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 040.schema.asset.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 020.schema.functions.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 030.schema.metabib.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 040.schema.asset.sql
+PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 070.schema.container.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 080.schema.money.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 090.schema.action.sql
 
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 080.schema.money.sql
 PGUSER=$3 PGHOST=$1 PGDATABASE=$2 psql -f 090.schema.action.sql