From: Chris Sharp Date: Tue, 9 Mar 2021 21:36:14 +0000 (-0500) Subject: LP#1902939: Student Card SQL/IDL changes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f2bfc5e8da4b78557c80bfe26fbdfe35a634f07e;p=evergreen%2Fpines.git LP#1902939: Student Card SQL/IDL changes --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 04cbb0ebb4..a7678e6781 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -15649,26 +15649,57 @@ SELECT usr, - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -15715,6 +15746,28 @@ SELECT usr, + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/600.schema.student_card.sql b/Open-ILS/src/sql/Pg/600.schema.student_card.sql index 73f93bedd8..07d81033b8 100644 --- a/Open-ILS/src/sql/Pg/600.schema.student_card.sql +++ b/Open-ILS/src/sql/Pg/600.schema.student_card.sql @@ -1,26 +1,30 @@ BEGIN; +DROP SCHEMA student_card CASCADE; + CREATE SCHEMA student_card; CREATE TABLE student_card.district ( id SERIAL PRIMARY KEY, code TEXT NOT NULL UNIQUE, name TEXT NOT NULL UNIQUE, + active BOOLEAN NOT NULL DEFAULT TRUE, state_id INTEGER NOT NULL UNIQUE, contact_name TEXT, contact_email TEXT, - remote_host TEXT NOT NULL, - remote_user TEXT, - remote_pass VARCHAR(255), --TODO: encrypt this data with PGP? - remote_remote_dir TEXT, - exceptions_dir TEXT + ftp_host TEXT NOT NULL, + ftp_port INTEGER, + ftp_user TEXT, + ftp_pass VARCHAR(255), --TODO: encrypt this data with PGP + ftp_remote_dir TEXT, + ftp_exceptions_dir TEXT ); CREATE TABLE student_card.school ( id SERIAL PRIMARY KEY, district_id INTEGER NOT NULL REFERENCES student_card.district (id), name TEXT NOT NULL UNIQUE, - state_id INTEGER NOT NULL, + state_id INTEGER NOT NULL, -- school ID per the State of Georgia grades TEXT, addr_street_1 TEXT, addr_street_2 TEXT, diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index ddfabe46ae..5b8da9911c 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1974,7 +1974,9 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES ( 640, 'ACCESS_ANGULAR_CIRC', oils_i18n_gettext(640, 'Allow a user to access the experimental Angular circulation interfaces', 'ppl', 'description')), ( 641, 'ADMIN_FUND_ROLLOVER', oils_i18n_gettext(641, - 'Allow the user to perform fund propagation and rollover', 'ppl', 'description')) + 'Allow the user to perform fund propagation and rollover', 'ppl', 'description')), + ( 1101, 'ADMIN_STUDENT_CARDS', oils_i18n_gettext(636, + 'Modify student card settings', 'ppl', 'description')) ; SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.student_cards.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.student_cards.sql new file mode 100644 index 0000000000..d59d07223a --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.student_cards.sql @@ -0,0 +1,52 @@ +BEGIN; + +-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +CREATE SCHEMA student_card; + +CREATE TABLE student_card.district ( + id SERIAL PRIMARY KEY, + code TEXT NOT NULL UNIQUE, + name TEXT NOT NULL UNIQUE, + active BOOLEAN NOT NULL DEFAULT TRUE, + state_id INTEGER NOT NULL UNIQUE, + contact_name TEXT, + contact_email TEXT, + ftp_host TEXT NOT NULL, + ftp_port INTEGER, + ftp_user TEXT, + ftp_pass VARCHAR(255), --TODO: encrypt this data with PGP + ftp_remote_dir TEXT, + ftp_exceptions_dir TEXT +); + +CREATE TABLE student_card.school ( + id SERIAL PRIMARY KEY, + district_id INTEGER NOT NULL REFERENCES student_card.district (id), + name TEXT NOT NULL UNIQUE, + state_id INTEGER NOT NULL, -- school ID per the State of Georgia + grades TEXT, + addr_street_1 TEXT, + addr_street_2 TEXT, + addr_city TEXT, + addr_county TEXT, + addr_state TEXT, + addr_post_code TEXT, + eg_perm_group INTEGER NOT NULL REFERENCES permission.grp_tree (id), + home_ou INTEGER NOT NULL REFERENCES actor.org_unit (id) +); +CREATE UNIQUE INDEX student_card_school_state_id_idx ON student_card.school (district_id, state_id); + +CREATE TABLE student_card.import ( + id SERIAL PRIMARY KEY, + import_time TIMESTAMPTZ NOT NULL DEFAULT NOW(), + district_id INTEGER NOT NULL REFERENCES student_card.district (id), + filename TEXT, + error_message TEXT +); + +INSERT INTO permission.perm_list ( id, code, description ) VALUES + ( 628, 'ADMIN_STUDENT_CARDS', oils_i18n_gettext(628, + 'Modify student card settings', 'ppl', 'description')); + +COMMIT;