##### General Information

- Overview
- Features
- Specification
- Getting Started
- Howto Build Turbine
- Changes

##### Documentation

- Services
- Howtos
- Wiki
- JavaDocs

##### Development

- Proposals
- How To Help
- Todo

##### Project Documentation

- Project Information
- Project Reports

##### Apache

- Apache Website
- License
- How the ASF works
- Sponsorship
- Thanks
- Security

## Turbine Schema

The naming scheme is that the Turbine specific tables are prefixed with "TURBINE_". This is to avoid name collisions with applications for common tables such as PERMISSION or ROLE and also to avoid name collisions with reserved keywords in differant databases.

- TURBINE_PERMISSION
- TURBINE_ROLE
- TURBINE_GROUP
- TURBINE_ROLE_PERMISSION
- TURBINE_USER
- TURBINE_USER_GROUP_ROLE
- TURBINE_SCHEDULED_JOB
- ID_TABLE

## Relationships

    TURBINE_USER  -|------o-< TURBINE_USER_GROUP_ROLE
    TURBINE_ROLE  -|------o-< TURBINE_USER_GROUP_ROLE
    TURBINE_GROUP -|------o-< TURBINE_USER_GROUP_ROLE
    TURBINE_ROLE  -|------o-< TURBINE_ROLE_PERMISSION
    TURBINE_PERMISSION -|------o-< TURBINE_ROLE_PERMISSION

## Table Schemas

The data-types represented below are for the MySQL database. For other database specific data-types check the .sql scripts in the src/sql directory of the Turbine distribution.

### ID_TABLE

Column Name | Key | Data Type | Default Value | Null | Indexed | Comment
--- | --- | --- | --- | --- | --- | ---
ID_TABLE_ID | Primary | INTEGER |  | NOT NULL | Yes | AUTOINCREMENT
TABLE_NAME | Unique | VARCHAR(255) |  | NOT NULL |  | UNIQUE
NEXT_ID |  | INTEGER |  | NULL |  |
QUANTITY |  | INTEGER |  | NULL |  |

The ID_TABLE carries the information for the next ID number in the specified tables. This table is useful when the database being used has no data-type which carries out auto-increment operations.

### TURBINE_PERMISSION

column name | key | data type | default value | null | indexed | comment
--- | --- | --- | --- | --- | --- | ---
PERMISSION_ID | PRIMARY | INTEGER |  |  |  | AUTOINCREMENT
PERMISSION_NAME |  | VARCHAR(99) |  | NOT NULL |  | UNIQUE
OBJECTDATA |  | MEDIUMBLOB |  |  |  |

The TURBINE_PERMISSION table stores the lowest level of permissions allowed for a Turbine User.

### TURBINE_ROLE

column name | key | data type | default value | null | indexed | comment
--- | --- | --- | --- | --- | --- | ---
ROLE_ID | PRIMARY | INTEGER |  |  |  | AUTO_INCREMENT
ROLE_NAME |  | VARCHAR(99) |  | NOT NULL |  | UNIQUE
OBJECTDATA |  | MEDIUMBLOB |  |  |  |

The TURBINE_ROLE table links a Turbine User to a span of permissions. Potentially a Turbine User can have many roles within the system. In this case a role represents a descriptive word for a series of permissions or actions the Turbine User is able to undertake.

### TURBINE_GROUP

column name | key | data type | default value | null | indexed | comment
--- | --- | --- | --- | --- | --- | ---
GROUP_ID | PRIMARY | INTEGER |  |  |  | AUTOINCREMENT
GROUP_NAME |  | VARCHAR(99) |  | NOT NULL |  | UNIQUE
OBJECTDATA |  | MEDIUMBLOB |  |  |  |

The TURBINE_GROUP table allows for a series of roles and Turbine Users to be connected under a Group ID and hence Group Name. For instance there may be a group named Administrators with the necessary roles and permissions. There may also be many Administrators on the system. The Group table and it's relationship with the TURBINE_USER_GROUP_ROLE table maps this functionality.

### TURBINE_ROLE_PERMISSION

column name | key | data type | default value | null | indexed | comment
--- | --- | --- | --- | --- | --- | ---
ROLE_ID | PRIMARY | INTEGER |  | NOT NULL | Yes |
PERMISSION_ID | PRIMARY | INTEGER |  | NOT NULL | Yes |

The TURBINE_ROLE_PERMISSION table is a bridging table between TURBINE_ROLE and TURBINE_PERMISSION that allows a several differant roles to make use of the same permission.

### TURBINE_USER

column name | key | data type | default value | null | indexed | comment
--- | --- | --- | --- | --- | --- | ---
USER_ID | PRIMARY | INTEGER |  |  |  |
LOGIN_NAME |  | VARCHAR(32) |  | NOT NULL |  | UNIQUE
PASSWORD_VALUE |  | VARCHAR(32) |  | NOT NULL |  |
FIRST_NAME |  | VARCHAR(99) |  | NOT NULL |  |
LAST_NAME |  | VARCHAR(99) |  | NOT NULL |  |
EMAIL |  | VARCHAR(99) |  | NOT NULL |  |
CONFIRM_VALUE |  | VARCHAR(32) |  | NOT NULL |  |
MODIFIED |  | TIMESTAMP |  |  |  |
CREATED |  | DATETIME |  |  |  |
LAST_LOGIN |  | TIMESTAMP |  |  |  |
OBJECTDATA |  | MEDIUMBLOB |  |  |  |

The TURBINE_USER table describes the basic information on the user in the system.

### TURBINE_USER_GROUP_ROLE

column name | key | data type | default value | null | indexed | comment
--- | --- | --- | --- | --- | --- | ---
USER_ID | PRIMARY | INTEGER |  |  |  |
GROUP_ID | PRIMARY | INTEGER |  |  |  |
ROLE_ID | PRIMARY | INTEGER |  |  |  |

The TURBINE_USER_GROUP_ROLE describes what roles a given user has as a member of a given group.

### TURBINE_SCHEDULED_JOB

column name | key | data type | default value | null | indexed | comment
--- | --- | --- | --- | --- | --- | ---
JOB_ID | PRIMARY | int(11) |  | NOT NULL |  | AUTO_INCREMENT
SECOND |  | INTEGER | -1 | NOT NULL |  |
MINUTE |  | INTEGER | -1 | NOT NULL |  |
HOUR |  | INTEGER | -1 | NOT NULL |  |
WEEK_DAY |  | INTEGER | -1 | NOT NULL |  |
DAY_OF_MONTH |  | INTEGER | -1 | NOT NULL |  |
TASK |  | VARCHAR(99) |  | NOT NULL |  |
EMAIL |  | VARCHAR(99) |  | NULL |  |
PROPERTY |  | VARBINARY |  | NULL |  |