Databases
In Workrunner you can store all kinds of relational or document based data including files. Depending on your needs you are free to choose which database to use. For example a process may store all customer information on relational database, store all quote documents in a file database and store order information on document database for further analysis.
Each database type has own advantages or disadvantages depending on your needs.
Relational Database¶
Provides storage for large number of small entities. Database operations generally performed on small number of entities without affecting other entities. However, not that because of nature of relational database you need to specify schema of database.
Advantages
- Stores large number of entities without any performance lost.
- Efficient at processing small changes to data that can be logged and rolled-back (undone) if required.
Disadvantages
- You have to specify database schema.
- Database schema must be identical for all entities.
- Technical and engineering knowledge is required to manage.
In Workrunner databases are called as "schema" and contains relational structured tables. Each schema contains the name and __prefix_ properties. When you open a process design page and click on Databases, you will see a list of all relational database schemas tied to that process. If there is no schema yet you can simply click Import and add one of the existing schemas or click Add New Schema button to create a schema and its tables. All of the schema import, update and add operations are not executed until the process changes are committed.
Add New Schema¶
In order to add a new schema you have to enter a name and a prefix.
Clicking on Edit button unfolds a menu including:
Name
Name of schema, you can enter any name in to name field.
Prefix
Enter short name in to prefix field.
Click Details button to display all the tables of the schema and again click Details button of one of the tables listed:
Fields¶
Name
Enter name of field.
Type
Limited text, unlimited text, integer number, floating number, money, yes/no, date/time, unique identifier, xml and binary are listed. Select to type of field.
Size
Specifies the length of field in numbers of character. Only applicable to limited text type.
Languages
Under this section multiple language names can be added. For each language added, a separate column is added to table with the name "columnName_languageName". In this way corresponding translation of the column data is being stored in a distinct column and it is fetched depending on the user's culture choice.
General¶
Primary Key
Id, code and name are listed. Select to primary key.
Authorize By
All the fields of unique identifier type from the table shows up in this section. Selecting one of them will restrict users to see only the row with selected field whose data is identical to their userId upon a select query.
Relations¶
Click on Add New Relation button:
Name
Enter a name for relation. It will be used later to call that relation. e.g. Word UserLogons is the relation name in usage Users.UserLogons
Type
Select relation type. Options are
- One to many
- One to one
- One to one or zero
- Many to one
Update Rule
Select update rule for related rows. With cascade rule, which is the only rule provided, when one of the records is updated or deleted, corresponding data on the other related table also gets updated or deleted.
Target Schema
Select a schema to create a relation to its table.
Target Table
Select a table from target schema to create a relation to.
Constraints
- Source field : Select a field name from first table to relate from.
- Target field : Select a field name for second table to relate to.
Initial Data
For some purposes, for example testing, you can populate tables with initial data enterd in XML format.
Import¶
Displays all existing schemas. Select the ones you want to include in your process and click Ok.
Xml Database¶
Provides storage for small or large number of large size entities in a hierarchy. Database operations generally performed with reading or writing full on tree of entities.
Advantages
- Ideal for highly variable data structures, and even unstructured data.
- Optimized for extremely fast storage and retrieval of whole documents or objects.
Disadvantages
- Slow performance when need to join other data out of entity tree.
File Database¶
Provides a database to manage binary files. Each stored file is identified with globally unique identifier (Guid) at domain level.
Advantages
- Efficient for binary files.
- Full text indexing
Disadvantages
- Only accessible from file id
Files can be uploaded to database with File control from user interface or can be created with scripting environment $Files object.
Accessing to a File¶
Unique file id can be use to build a URL address in "http(s)://mydomain.workrunner.io/file/<fileId>"
format. This file url can be accessed with from anonymous environment.
Security
Generated guid values already secured there is no additional security performed. But IP restriction can be also applied at domain level if required.
Accessing to file by default shows the preview application if supported. If you want to just download please use the "http(s)://mydomain.workrunner.io/attachment/<fileId>"
format to force.
Revisioning¶
In Workrunner every file has own unique identifier and any update on file stored with new identifier and marked as "revision". When revision is completed new file content replaced with old file to keep id number same.
Updates from user interface is automatically handled but in scripting environment you may need to use Files.Replace method to update revision.