Struct Plugin: Schema Editing
Schemas are used to manage the structured data that can be assigned to pages. You can think of them as a table definition. A schema defines which fields will be available and what type they have.
Schemas are agnostic of how the data is going to be used. In previous versions of the plugin you had to decide up-front if your schema would be assigned to pages (page schema) or contain free-floating data to be used anywhere (lookup schema). This is no longer the case.
To create a new schema, log in as a Manager and access the “Admin” page. Select the “Struct Schema Editor” from the “Additional Plugins” section. Use the form to create a new schema.
Schema names must start with a lowercase letter, then can contain lowercase letters, numerals, and the underscore character1). In other words, must match the regular expression
^[a-z][a-z0-9_]*$. Names that don't match this will have offending characters removed when you save the schema.
Existing schemas can be selected in the table of contents and can be edited there.
Important: Fields can not be deleted, only be disabled!
Schema Usage for Data Mangement
Schemas can be deployed to manage data in the three following ways:
- Page data can be thought of as additional metadata for a page. This is what you may know from the old data plugin. And in the same way as with the data plugin, a page can only have one set (row) of page data from each of the associated schemas. To be able to enter page data via a form in edit mode, the schema has to be assigned to the page via Assignments. Consequently, page data is directly associated with exactly the one page it was entered for. Like no other struct data, page data is revisioned with the page, it is associated to.
- Global data (previously called lookup schemas) is not assigned to pages. It is a collection of datasets (rows) held globally. This is useful for data that you want to use as a Lookup source or for data that doesn't justify a page per entry. To enter and edit global data, add a Global Data Editor to any page. You can reference their values in any aggregation, except for struct value output. Global data has no revisions or history.
- Serial data doesn't need to be assigned via assignment manager. It is automatically bound to the Wiki page, from where it was entered. You can have many serial datasets (rows) per page (and schema), similar to global data. However, serial data has no revisions or history. To enter serial data, add a Serial Data Editor to a page.
Notes: In older versions of the plugin, the future use of the schema had to be defined when creating it. This is no longer the case. A schema can be used for all three of the above use cases simultaneously, though this will probably rarely be the case in the real world. For more details on the structure of struct data, see struct database internals and csv import.