Skip to content

Commit 6bb8ff7

Browse files
committed
docu
1 parent 6211aca commit 6bb8ff7

File tree

1 file changed

+43
-26
lines changed

1 file changed

+43
-26
lines changed

src/site/markdown/deployment/database_schema.md

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,58 @@
11
# Database Schema
22

33
The Imixs-Workflow engine persists all information about the model and the running workflow instances (_workitems_) using the Java Persistence API (JPA). Therefore the Imixs-Workflow engine is database vendor independent and can be run on any SQL database (e.g. MySQL, PostgreSQL, Oracle, MS SQL, ...). See the [Deployment Guide](./deployment_guide.html) for further details how to deploy the Imixs-Workflow engine into a application sever.
4-
4+
55
## The JPA Classes and Tables
6-
The database schema used by the Imixs-Workflow engine is quite simple and constis of only one table named '_DOCUMENT_'. During the deployment, JPA maps the jpa class _org.imixs.workflow.engine.jpa.Document_ automatically to the database and creates the corresponding data table.
76

7+
The database schema used by the Imixs-Workflow engine is quite simple and consists of only two tablee named `DOCUMENT` and `EVENTLOG`. During the deployment, JPA maps the jpa entity classes automatically to the database and creates the corresponding data table.
8+
9+
If you like to to create the table manually you can do it like this:
10+
11+
```sql
12+
CREATE TABLE document2 (
13+
id character varying(255) NOT NULL,
14+
created timestamp without time zone,
15+
data bytea,
16+
modified timestamp without time zone,
17+
type character varying(255),
18+
version integer
19+
);
20+
21+
ALTER TABLE document ADD CONSTRAINT document_pkey PRIMARY KEY (id);
22+
```
23+
24+
```sql
25+
CREATE TABLE eventlog (
26+
id character varying(255) NOT NULL,
27+
created timestamp without time zone,
28+
data bytea,
29+
ref character varying(255),
30+
timeout timestamp without time zone,
31+
topic character varying(255),
32+
version integer
33+
);
34+
35+
ALTER TABLE eventlog ADD CONSTRAINT eventlog_pkey PRIMARY KEY (id);
36+
```
837

9-
CREATE TABLE `DOCUMENT` (
10-
`ID` varchar(255) NOT NULL,
11-
`CREATED` datetime DEFAULT NULL,
12-
`DATA` longblob,
13-
`MODIFIED` datetime DEFAULT NULL,
14-
`TYPE` varchar(255) DEFAULT NULL,
15-
`VERSION` int(11) DEFAULT NULL,
16-
PRIMARY KEY (`ID`)
17-
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
38+
## Performance
1839

40+
In large databases with many documents it is recommended to provide additional indexes to the following columns:
1941

42+
- type
43+
- created
44+
- modified
45+
- version
2046

21-
## Performance
22-
In large databases with many documents it is recommended to provide additional indexes to the following columns:
47+
### MySQL
2348

24-
* type
25-
* created
26-
* modified
27-
* version
28-
29-
30-
### MySQL
49+
The following statement adds the necessary indexes for a MySQL Database:
3150

32-
The following statement adds the necessary indexes for a MySQL Database:
33-
34-
ALTER TABLE `DOCUMENT` ADD INDEX `index1`(`CREATED`,`MODIFIED`,`TYPE`,`VERSION`);
51+
ALTER TABLE `DOCUMENT` ADD INDEX `index1`(`CREATED`,`MODIFIED`,`TYPE`,`VERSION`);
3552

3653
### PostgreSQL
3754

38-
The following statement adds the necessary indexes for a PostgreSQL Database:
55+
The following statement adds the necessary indexes for a PostgreSQL Database:
56+
57+
CREATE INDEX index_document1 ON document USING btree(created, modified, type , version);
3958

40-
CREATE INDEX index_document1 ON document USING btree(created, modified, type , version);
41-

0 commit comments

Comments
 (0)