Form Storage -- Entry/Last Entry: Difference between revisions

From IHRIS Wiki
(Created page with 'This is the default storage mechanism that a form uses ==Features== This entry storage mechanism tracks changes made to the data by user and time. ==Database Structure== This is...')
 
Line 7: Line 7:
===Entry and Last Entry===
===Entry and Last Entry===
All data is stored in two structurally identical tables, '''entry''' and '''last_entry'''.  The ''entry'' table contains all data saved into the system, while ''last_entry'' only saves the current version of the data.  Each row of this table corresponds to one field of one instance of a form.  These references are made by the columns ''record'' and ''form_field'' which are the id's of the tables ''record'' and ''form_field''
All data is stored in two structurally identical tables, '''entry''' and '''last_entry'''.  The ''entry'' table contains all data saved into the system, while ''last_entry'' only saves the current version of the data.  Each row of this table corresponds to one field of one instance of a form.  These references are made by the columns ''record'' and ''form_field'' which are the id's of the tables ''record'' and ''form_field''
===Record==
===Record===
The record table has one row for each form instance.  A form instance is the name of a form and an id.
The record table has one row for each form instance.  A form instance is the name of a form and an id.



Revision as of 08:24, 4 June 2009

This is the default storage mechanism that a form uses

Features

This entry storage mechanism tracks changes made to the data by user and time.

Database Structure

This is a vertical database structure.

Entry and Last Entry

All data is stored in two structurally identical tables, entry and last_entry. The entry table contains all data saved into the system, while last_entry only saves the current version of the data. Each row of this table corresponds to one field of one instance of a form. These references are made by the columns record and form_field which are the id's of the tables record and form_field

Record

The record table has one row for each form instance. A form instance is the name of a form and an id.

The record table contains the columns id, form, parent_form and parent_id. The form column matches the id column in the form table and which tells us which form this record, or instance, is. The parent_form column is a string and tells us the name, if any, of a parent form for this form instance. Similarly, the parent_id tells us the id, if any, of the parent form. The parent form may or may not be saved into the entry table.

The id is referenced by the entry and last_entry tables

There is also a modification time which tracks the last time any field of this form instance was modified.

Form

The form table describe the forms which have been saved into the entry table. There are columns id and name. It's id is referenced by the form field table.

Field

The field table describe all of the fields and their database types. It contains the columns: id, name and type. There is one row for each pair (name of a field, field database type) which is assigned an id. The database type, tells us which column that the field data is saved in the last_entry and entry tables. It's id column is referenced by the form_field table.

Form Field

The form field table has on row for each pair of (form, field id). It's id column is referenced by the entry and last entry tables.

Sample SQL Queries=