Drop the never-used column item_count from acq.lineitem.
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Sep 2010 15:22:29 +0000 (15:22 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Sep 2010 15:22:29 +0000 (15:22 +0000)
Drop it also from the associated history table, and rebuild
the function that maintains it.  Finally, rebuild the
associated lifecycle view.

Apply to trunk only; this column never existed in 2.0.
The column has already been removed from the base installation
script.

M    Open-ILS/src/sql/Pg/002.schema.config.sql
A    Open-ILS/src/sql/Pg/upgrade/0417.schema.acq.drop-lineitem-item-count.sql

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

Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0417.schema.acq.drop-lineitem-item-count.sql [new file with mode: 0644]

index 6f4c362..65bcaba 100644 (file)
@@ -70,7 +70,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0416'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0417'); -- Scott McKellar
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0417.schema.acq.drop-lineitem-item-count.sql b/Open-ILS/src/sql/Pg/upgrade/0417.schema.acq.drop-lineitem-item-count.sql
new file mode 100644 (file)
index 0000000..aadf5fa
--- /dev/null
@@ -0,0 +1,23 @@
+-- Drop the never-used column item_count from acq.lineitem.
+-- Drop it also from the associated history table, and rebuild
+-- the function that maintains it.  Finally, rebuild the
+-- associated lifecycle view.  
+
+-- Apply to trunk only; this column never existed in 2.0.
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0417'); -- Scott McKellar
+
+-- Have to drop the view first, because it's a dependent
+DROP VIEW IF EXISTS acq.acq_lineitem_lifecycle;
+
+ALTER TABLE acq.lineitem DROP COLUMN item_count;
+
+ALTER TABLE acq.acq_lineitem_history DROP COLUMN item_count;
+
+SELECT acq.create_acq_func( 'acq', 'lineitem' );
+
+SELECT acq.create_acq_lifecycle( 'acq', 'lineitem' );
+
+COMMIT;