Adding a Field to a Live Repository

From EPrints Documentation
Jump to: navigation, search

To add a field to a live eprints archive you have to modify the SQL tables.

Before you start this you may wish to BackupTheDatabase.

This assumes you are adding a field to the "eprint" fields, not the "user" fields. If you are changing "user" then anywhere we have 4 actions, one for each of buffer, deletion, archive and inbox, you instead need a single action for "users".

Adding fields of type "name" is beyond the scope of these instructions.

Recipe (for Eprints 3.x)

This is much the same as for Eprints 2.x except that the names have been changed to protect the innocent.

  • Define your new fields in archives/ARCHIVEID/cfg/cfg.d/ for EPrint-level metadata, .../ for document-level metadata (this file doesn't exist by default, but is honoured), .../ for user metadata, etc etc.

EPrints 3.0

  • Add the new columns to the appropriate tables. There are no longer four separate tables for eprints as there were in EP2 (archive, buffer etc), so it's simpler.
    • For a field defined in, the tables are eprint and eprint__ordervalues_en (replacing en with your language as required).
    • For a field defined in, you want document and document__ordervalues_en.
    • And so on.
  • The column types are the same as for EP2, ie in eprint you want a type appropriate to the type of your field exactly as described in the Recipe for EP2 above, while in eprint__ordervalues_en you want text irrespective of your field type.

EPrints 3.1+

Once you have added your new field definitions to the appropriate configuration file you can run the update_database_structure epadmin method from the shell:

./bin/epadmin update_database_structure ARCHIVEID

In EPrints 3.3+ you can use update as a synonym of update_database_structure.