newdevs:code:add-fields
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
newdevs:code:add-fields [2021/07/29 18:05] – created tmccanna | newdevs:code:add-fields [2024/03/28 22:15] (current) – [3. Edit seed data and create an upgrade script] sandbergja | ||
---|---|---|---|
Line 4: | Line 4: | ||
This example came from a need that PINES had for annual reports purposes. It adds two new fields to the Organizational Unit table in order to store federal library codes for each location and make those codes available to the reports engine. | This example came from a need that PINES had for annual reports purposes. It adds two new fields to the Organizational Unit table in order to store federal library codes for each location and make those codes available to the reports engine. | ||
- | [[https:// | + | [[https:// |
+ | |||
+ | ===== 1. Update the fieldmapper ===== | ||
+ | |||
+ | File location: Open-ILS\examples\fm_IDL.xml | ||
+ | |||
+ | Add the fields in the "class id=" | ||
+ | |||
+ | ''< | ||
+ | **''< | ||
+ | **''< | ||
+ | ''</ | ||
+ | |||
+ | The field name must match the column name that you add to the database table. The ' | ||
+ | |||
+ | ===== 2. Update the schema ===== | ||
+ | |||
+ | New installations of Evergreen will use the code in the Pg folder when the database tables are created. If you are creating a new table for a brand new feature, you'll most likely need to create a new schema file, but in this case we are updating an existing table in the actor schema. | ||
+ | |||
+ | File location: Open-ILS\src\sql\Pg\005.schema.actors.sql | ||
+ | |||
+ | Add the fields to the field list in the " | ||
+ | |||
+ | '' | ||
+ | '' | ||
+ | **'' | ||
+ | '' | ||
+ | '' | ||
+ | |||
+ | |||
+ | ===== 3. Edit seed data and create an upgrade script ===== | ||
+ | |||
+ | Updates to the seed data files as well as upgrade scripts are required for any changes to the schema or seed data. (The seed data files are used for fresh installs and the upgrade scripts are used by existing installations that are upgrading.) | ||
+ | |||
+ | File location: Open-ILS\src\sql\Pg\upgrade\XXXX.federal_codes.sql | ||
+ | |||
+ | '' | ||
+ | '' | ||
+ | '' | ||
+ | |||
+ | If you are developing an upgrade script to submit to the Evergreen community, the new upgrade script you create will likely be more complicated. See other examples in the upgrade folder. The " | ||
+ | |||
+ | For more information on upgrade scripts, see [[newdevs: | ||
newdevs/code/add-fields.1627596303.txt.gz · Last modified: 2022/02/10 13:34 (external edit)