database changes for tattler
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Tue, 23 Jun 2020 20:39:33 +0000 (16:39 -0400)
committerLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Tue, 23 Jun 2020 20:39:33 +0000 (16:39 -0400)
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/tattler.pm [new file with mode: 0644]
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
Open-ILS/src/sql/Pg/tattle-tale-reports.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/1174.schema.tattler.sql [new file with mode: 0644]

index 9b256d0..bf2d24c 100644 (file)
@@ -12792,6 +12792,18 @@ SELECT  usr,
                                <delete permission="ADMIN_WORKSTATION_SETTING_TYPE" global_required="true"/>
                        </actions>
                </permacrud>
+       </class> 
+    <class id="igl" controller="open-ils.cstore" oils_obj:fieldmapper="tattler::ignore_list" oils_persist:tablename="tattler.ignore_list" reporter:label="Tattler Ignore List">
+               <fields oils_persist:primary="id" oils_persist:sequence="tattler.ignore_list_id_seq">
+                       <field reporter:label="ID" name="id" reporter:datatype="id" />
+                       <field reporter:label="Report Name" name="report_name" oils_persist:primitive="string"  reporter:datatype="text"/>
+                       <field reporter:label="System" name="org_unit" reporter:datatype="link"/>
+                       <field reporter:label="Asset" name="target_copy" reporter:datatype="link"/>
+               </fields>
+               <links>
+                       <link field="target_copy" reltype="has_a" key="id" map="" class="acp"/>
+                       <link field="org_unit" reltype="has_a" key="id" map="" class="aou"/>
+               </links>
        </class>
 
        <!-- no pcrud access is granted for now, because it's assumed these
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/tattler.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/tattler.pm
new file mode 100644 (file)
index 0000000..bab9e63
--- /dev/null
@@ -0,0 +1,16 @@
+package OpenILS::Application::Storage::CDBI::tattler;
+our $VERSION = 1;
+
+#-------------------------------------------------------------------------------
+package tattler;
+use base qw/OpenILS::Application::Storage::CDBI/;
+#-------------------------------------------------------------------------------
+
+package tattler::ignore_list;
+use base qw/tattler/;
+__PACKAGE__->table('tattler_ignore_list');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/report_name target_copy org_unit/);
+#-------------------------------------------------------------------------------
+
+1;
\ No newline at end of file
index f680b1c..443e2a6 100644 (file)
 
     #-------------------------------------------------------------------------------
 
+    package tattler::ignore_list;
+    tattler::ignore_list->sequence( 'tattler.ignore_list_id_seq' );
+    tattler::ignore_list->table('tattler.ignore_list');
+
+    #-------------------------------------------------------------------------------
 
 }
 
diff --git a/Open-ILS/src/sql/Pg/tattle-tale-reports.sql b/Open-ILS/src/sql/Pg/tattle-tale-reports.sql
new file mode 100644 (file)
index 0000000..9f1ace6
--- /dev/null
@@ -0,0 +1,12 @@
+DROP SCHEMA IF EXISTS tattler CASCADE;
+
+BEGIN;
+CREATE SCHEMA tattler;
+CREATE TABLE tattler.ignore_list (
+    id SERIAL PRIMARY KEY,
+    report_name TEXT,
+    org_unit BIGINT NOT NULL REFERENCES actor.org_unit(id) ON DELETE CASCADE DEFERRABLE,
+    target_copy BIGINT NOT NULL REFERENCES asset.copy(id) ON DELETE CASCADE DEFERRABLE
+);
+
+COMMIT;
\ No newline at end of file
diff --git a/Open-ILS/src/sql/Pg/upgrade/1174.schema.tattler.sql b/Open-ILS/src/sql/Pg/upgrade/1174.schema.tattler.sql
new file mode 100644 (file)
index 0000000..40e23c2
--- /dev/null
@@ -0,0 +1,14 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('1174'); 
+
+CREATE TABLE tattler.ignore_list (
+    id SERIAL PRIMARY KEY,
+    report_name TEXT,
+    org_unit BIGINT NOT NULL REFERENCES actor.org_unit(id) ON DELETE CASCADE DEFERRABLE,
+    target_copy BIGINT NOT NULL REFERENCES asset.copy(id) ON DELETE CASCADE DEFERRABLE
+);
+END;
+$func$ LANGUAGE PLPGSQL;
+
+COMMIT;
\ No newline at end of file