<?xml version="1.0" encoding="utf-8" ?>
<database Name="otrs">

    <TableCreate Name="notification_event">
        <Column Name="id" Required="true" PrimaryKey="true" AutoIncrement="true" Type="INTEGER"/>
        <Column Name="name" Required="true" Size="200" Type="VARCHAR"/>
        <Column Name="subject" Required="true" Size="200" Type="VARCHAR"/>
        <Column Name="text" Required="true" Size="4000" Type="VARCHAR"/>
        <Column Name="content_type" Required="true" Size="100" Type="VARCHAR"/>
        <Column Name="charset" Required="true" Size="100" Type="VARCHAR"/>
        <Column Name="valid_id" Required="true" Type="SMALLINT"/>
        <Column Name="create_time" Required="true" Type="DATE"/>
        <Column Name="create_by" Required="true" Type="INTEGER"/>
        <Column Name="change_time" Required="true" Type="DATE"/>
        <Column Name="change_by" Required="true" Type="INTEGER"/>
        <Unique Name="notification_event_name">
            <UniqueColumn Name="name"/>
        </Unique>
        <ForeignKey ForeignTable="users">
            <Reference Local="create_by" Foreign="id"/>
            <Reference Local="change_by" Foreign="id"/>
        </ForeignKey>
        <ForeignKey ForeignTable="valid">
            <Reference Local="valid_id" Foreign="id"/>
        </ForeignKey>
    </TableCreate>

    <TableCreate Name="notification_event_item">
        <Column Name="notification_id" Required="true" Type="INTEGER"/>
        <Column Name="event_key" Required="true" Size="200" Type="VARCHAR"/>
        <Column Name="event_value" Required="true" Size="200" Type="VARCHAR"/>
        <ForeignKey ForeignTable="notification_event">
            <Reference Foreign="id" Local="notification_id"/>
        </ForeignKey>
        <Index Name="notification_event_item_notification_id">
            <IndexColumn Name="notification_id"/>
        </Index>
        <Index Name="notification_event_item_event_key">
            <IndexColumn Name="event_key"/>
        </Index>
        <Index Name="notification_event_item_event_value">
            <IndexColumn Name="event_value"/>
        </Index>
    </TableCreate>

    <TableAlter Name="postmaster_filter">
        <ColumnAdd Name="f_stop" Required="false" Type="SMALLINT"/>
    </TableAlter>

    <TableAlter Name="ticket">
        <ColumnChange NameOld="until_time" NameNew="until_time" Required="true" Type="INTEGER"/>
        <IndexCreate Name="ticket_until_time">
            <IndexColumn Name="until_time"/>
        </IndexCreate>
        <ColumnChange NameOld="timeout" NameNew="timeout" Required="true" Type="INTEGER"/>
        <IndexCreate Name="ticket_timeout">
            <IndexColumn Name="timeout"/>
        </IndexCreate>
    </TableAlter>

    <TableAlter Name="article">
        <ColumnAdd Name="a_in_reply_to" Required="false" Size="3800" Type="VARCHAR"/>
        <ColumnAdd Name="a_references" Required="false" Size="3800" Type="VARCHAR"/>
    </TableAlter>

    <TableAlter Name="article_attachment">
        <ColumnAdd Name="content_id" Required="false" Size="250" Type="VARCHAR"/>
        <ColumnAdd Name="content_alternative" Required="false" Size="50" Type="VARCHAR"/>
    </TableAlter>

    <TableCreate Name="service_preferences">
        <Column Name="service_id" Required="true" Type="INTEGER"/>
        <Column Name="preferences_key" Required="true" Size="150" Type="VARCHAR"/>
        <Column Name="preferences_value" Required="false" Size="250" Type="VARCHAR"/>
        <Index Name="service_preferences_service_id">
            <IndexColumn Name="service_id"/>
        </Index>
        <ForeignKey ForeignTable="service">
            <Reference Local="service_id" Foreign="id"/>
        </ForeignKey>
    </TableCreate>

    <TableCreate Name="sla_preferences">
        <Column Name="sla_id" Required="true" Type="INTEGER"/>
        <Column Name="preferences_key" Required="true" Size="150" Type="VARCHAR"/>
        <Column Name="preferences_value" Required="false" Size="250" Type="VARCHAR"/>
        <Index Name="sla_preferences_sla_id">
            <IndexColumn Name="sla_id"/>
        </Index>
        <ForeignKey ForeignTable="sla">
            <Reference Local="sla_id" Foreign="id"/>
        </ForeignKey>
    </TableCreate>

    <TableAlter Name="customer_user">
        <ColumnAdd Name="phone" Required="false" Size="150" Type="VARCHAR"/>
        <ColumnAdd Name="fax" Required="false" Size="150" Type="VARCHAR"/>
        <ColumnAdd Name="mobile" Required="false" Size="150" Type="VARCHAR"/>
        <ColumnAdd Name="street" Required="false" Size="150" Type="VARCHAR"/>
        <ColumnAdd Name="zip" Required="false" Size="150" Type="VARCHAR"/>
        <ColumnAdd Name="city" Required="false" Size="150" Type="VARCHAR"/>
        <ColumnAdd Name="country" Required="false" Size="150" Type="VARCHAR"/>
    </TableAlter>

    <TableAlter Name="salutation">
        <ColumnAdd Name="content_type" Required="false" Size="250" Type="VARCHAR"/>
    </TableAlter>

    <TableAlter Name="signature">
        <ColumnAdd Name="content_type" Required="false" Size="250" Type="VARCHAR"/>
    </TableAlter>

    <TableAlter Name="standard_response">
        <ColumnAdd Name="content_type" Required="false" Size="250" Type="VARCHAR"/>
    </TableAlter>

    <TableAlter Name="auto_response">
        <ColumnAdd Name="content_type" Required="false" Size="250" Type="VARCHAR"/>
    </TableAlter>

    <TableAlter Name="notifications">
        <ColumnAdd Name="content_type" Required="false" Size="250" Type="VARCHAR"/>
    </TableAlter>

    <TableAlter Name="web_upload_cache">
        <ColumnAdd Name="content_id" Required="false" Size="250" Type="VARCHAR"/>
    </TableAlter>

</database>
