Add CREATE statement for asset.copy_location_order
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 28 Oct 2009 16:57:09 +0000 (16:57 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 28 Oct 2009 16:57:09 +0000 (16:57 +0000)
M    Pg/040.schema.asset.sql

git-svn-id: svn://svn.open-ils.org/ILS/trunk@14651 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/040.schema.asset.sql

index 1f25cfe..a5d168d 100644 (file)
@@ -32,6 +32,21 @@ CREATE TABLE asset.copy_location (
        CONSTRAINT acl_name_once_per_lib UNIQUE (name, owning_lib)
 );
 
+CREATE TABLE asset.copy_location_order
+(
+        id              SERIAL           PRIMARY KEY,
+        location        INT              NOT NULL
+                                             REFERENCES asset.copy_location
+                                             ON DELETE CASCADE
+                                             DEFERRABLE INITIALLY DEFERRED,
+        org             INT              NOT NULL
+                                             REFERENCES actor.org_unit
+                                             ON DELETE CASCADE
+                                             DEFERRABLE INITIALLY DEFERRED,
+        position        INT              NOT NULL DEFAULT 0,
+        CONSTRAINT acplo_once_per_org UNIQUE ( location, org )
+);
+
 CREATE TABLE asset.copy (
        id              BIGSERIAL                       PRIMARY KEY,
        circ_lib        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,