Difference between revisions of "Adding a Field to a Live Repository"

From EPrints Documentation
Jump to: navigation, search
Line 1: Line 1:
 
[[Category:Manual]]
 
[[Category:Manual]]
[[Category:Howto]]
+
[[Category:Metadata Fields]]
  
 
To add a field to a live eprints archive you have to modify the SQL tables.
 
To add a field to a live eprints archive you have to modify the SQL tables.

Revision as of 12:47, 20 March 2010


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/eprint_fields.pl for EPrint-level metadata, .../document_fields.pl for document-level metadata (this file doesn't exist by default, but is honoured), .../user_fields.pl 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 eprint_fields.pl, the tables are eprint and eprint__ordervalues_en (replacing en with your language as required).
    • For a field defined in document_fields.pl, 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