Patch from J. Atzberger to change SAN datatype to TEXT
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 30 Oct 2009 13:24:18 +0000 (13:24 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 30 Oct 2009 13:24:18 +0000 (13:24 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14699 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/0062.schema.provider_SAN_as_text.sql [new file with mode: 0644]

index 891bc84..43ef7e4 100644 (file)
@@ -3941,7 +3941,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Code" name="code" reporter:datatype="text" />
                        <field reporter:label="Holdings Tag" name="holding_tag" reporter:datatype="text" />
                        <field reporter:label="Addresses" name="addresses" oils_persist:virtual="true" reporter:datatype="link" />
-                       <field reporter:label="SAN" name="san" reporter:datatype="int" />
+                       <field reporter:label="SAN" name="san" reporter:datatype="text" />
                </fields>
                <links>
                        <link field="currency_type" reltype="has_a" key="code" map="" class="acqct"/>
index 5915a08..94bbd35 100644 (file)
@@ -36,7 +36,7 @@ CREATE TABLE acq.provider (
     currency_type       TEXT    NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED,
     code                TEXT    NOT NULL,
     holding_tag         TEXT,
-    san                 INT,
+    san                 TEXT,
     CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner),
        CONSTRAINT code_once_per_owner UNIQUE (code, owner)
 );
diff --git a/Open-ILS/src/sql/Pg/upgrade/0062.schema.provider_SAN_as_text.sql b/Open-ILS/src/sql/Pg/upgrade/0062.schema.provider_SAN_as_text.sql
new file mode 100644 (file)
index 0000000..8fa4d55
--- /dev/null
@@ -0,0 +1,8 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0062');
+
+ALTER TABLE acq.provider ALTER COLUMN san TYPE TEXT USING lpad(text(san), 7, '0');
+
+COMMIT;
+