LP1786524: Table creation fix for new DB
authorblake <blake@mobiusconsortium.org>
Fri, 11 Mar 2022 20:47:19 +0000 (14:47 -0600)
committerblake <blake@mobiusconsortium.org>
Fri, 11 Mar 2022 20:47:19 +0000 (14:47 -0600)
Signed-off-by: blake <blake@mobiusconsortium.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/005.schema.actors.sql

index e49bd82..a12ba71 100644 (file)
@@ -1375,19 +1375,17 @@ SELECT SETVAL('config.carousel_type_id_seq'::TEXT, 100);
 
 CREATE TABLE config.patron_loader_header_map (
     id SERIAL,
-    org_unit INTEGER NOT NULL,
+    org_unit INTEGER NOT NULL, -- REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
     import_header TEXT NOT NULL,
     default_header TEXT NOT NULL
 );
-ALTER TABLE config.patron_loader_header_map ADD CONSTRAINT config_patron_loader_header_map_org_fkey FOREIGN KEY (org_unit) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
 
 CREATE TABLE config.patron_loader_value_map (
     id SERIAL,
-    org_unit INTEGER NOT NULL,
+    org_unit INTEGER NOT NULL,  -- REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
     mapping_type TEXT NOT NULL,
     import_value TEXT NOT NULL,
     native_value TEXT NOT NULL
 );
-ALTER TABLE config.patron_loader_value_map ADD CONSTRAINT config_patron_loader_value_map_org_fkey FOREIGN KEY (org_unit) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
 
 COMMIT;
index c86ee47..eff0919 100644 (file)
@@ -1286,5 +1286,7 @@ CREATE TABLE actor.patron_loader_log (
     logtime TIMESTAMP DEFAULT NOW()
 );
 ALTER TABLE actor.patron_loader_log ADD CONSTRAINT actor_patron_loader_log_org_fkey FOREIGN KEY (org_unit) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE config.patron_loader_header_map ADD CONSTRAINT config_patron_loader_header_map_org_fkey FOREIGN KEY (org_unit) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE config.patron_loader_value_map ADD CONSTRAINT config_patron_loader_value_map_org_fkey FOREIGN KEY (org_unit) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
 
 COMMIT;