making PKEY optional, not creating indexes on base table of partition set (no need)
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Sep 2005 14:50:49 +0000 (14:50 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Sep 2005 14:50:49 +0000 (14:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1842 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/reporter/report_base.example.xml
Open-ILS/src/reporter/reporter.schema-gen.pl

index 619d23b..dbf9b27 100644 (file)
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <reporter xmlns:xi="http://www.w3.org/2001/XInclude">
        <classes>
+
                <class
-                 name="silly-base"
+                 name="silly-all"
                  fact-table="silly.fact">
                        <description>Silly Report base</description>
                        <dims>
                                <dim include="silly_sayer_dim"/>
                        </dims>
                </class>
+
+               <class
+                 name="silly-words"
+                 fact-table="silly.fact">
+                       <description>Silly Word Report base</description>
+                       <dims>
+                               <dim include="silly_word_dim"/>
+                       </dims>
+               </class>
        </classes>
 
        <tables>
                                <link
                                  field="silly_word_dim"
                                  table="silly.word_dim"
+                                 key="id"
                                  type="has_a"/>
                                <link
                                  field="silly_sayer_dim"
                                  table="silly.sayer_dim"
+                                 key="id"
                                  type="has_a"/>
                        </links>
                </table>
index bb49773..d9f4bc9 100755 (executable)
@@ -44,14 +44,15 @@ for my $table ($doc->findnodes('/reporter/tables/table')) {
        warn "\n";
        print   "DROP TABLE $tname CASCADE;\n";
        print   "CREATE TABLE $tname (\n\t".
-               join(",\n\t",
-                       map { join("\t", @$_) } (@primary, @other)
-               ). ",\n\tCONSTRAINT $pkey_name PRIMARY KEY (".join(", ", map { $$_[0] } @primary).
-               ")\n);\n";
+               join(",\n\t", map { join("\t", @$_) } (@primary, @other))."\n".
+               do {
+                       @primary ?
+                               ",\tCONSTRAINT $pkey_name PRIMARY KEY (".
+                                       join(", ", map { $$_[0] } @primary). ")\n" :
+                               ''
+               }.
+               ");\n";
 
-       for my $i (@indexed) {
-               print   "CREATE INDEX \"${tname}_$$i[0]_idx\" ON $tname USING $$i[1] ($$i[0]);\n";
-       }
        print "\n";
 
        if ($table->getAttribute('partition')) {
@@ -80,6 +81,10 @@ for my $table ($doc->findnodes('/reporter/tables/table')) {
                        }
                        print "\n";
                }
+       } else {
+               for my $i (@indexed) {
+                       print   "CREATE INDEX \"${tname}_$$i[0]_idx\" ON $tname USING $$i[1] ($$i[0]);\n";
+               }
        }
        print "\n";