Getting started - Setting table definition - Constraints and validators.php 6.94 KB
Newer Older
zYne's avatar
zYne committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
Following attributes are availible for columns
<table>

    <tr>
        <td>
            <b class='title' valign='top'>name</b>
        </td>
        <td>
            <b class='title' valign='top'>args</b>
        </td>
        <td>
            <b class='title'>description</b>
        </td>
    </tr>
    <tr>
        <td colspan=3>
            <hr>
        </td>

    </tr>
    <tr>
        <td colspan=3>
            &raquo;&raquo; Basic attributes
            <hr class='small'>
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>primary</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Defines column as a primary key column.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>autoincrement</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Defines column as autoincremented column. If the underlying database doesn't support autoincrementation natively its emulated with triggers and sequence tables.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>default</b>
        </td>
        <td class='title' valign='top'>
            mixed default
        </td>
        <td class='title' valign='top'>
            Sets <i>default</i> as an application level default value for a column. When default value has been set for a column every time a record is created the specified column has the <i>default</i> as its value.
        </td>
    </tr>
zYne's avatar
zYne committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
    <tr>
        <td class='title' valign='top'>
            <b>zerofill</b>
        </td>
        <td class='title' valign='top'>
            boolean zerofill
        </td>
        <td class='title' valign='top'>
            Defines column as zerofilled column. Only supported by some drivers.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>unsigned</b>
        </td>
        <td class='title' valign='top'>
            boolean true
        </td>
        <td class='title' valign='top'>
            Defines column with integer type as unsigned. Only supported by some drivers.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>fixed</b>
        </td>
        <td class='title' valign='top'>
            boolean true
        </td>
        <td class='title' valign='top'>
            Defines string typed column as fixed length.
        </td>
    </tr>
zYne's avatar
zYne committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
    <tr>
        <td class='title' valign='top'>
            <b>enum</b>
        </td>
        <td class='title' valign='top'>
            array enum
        </td>
        <td class='title' valign='top'>
            Sets <i>enum</i> as an application level enum value list for a column.
        </td>
    </tr>
    <tr>
        <td colspan=3>
            &raquo;&raquo; Basic validators
            <hr class='small'>
        </td>

    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>unique</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Acts as database level unique constraint. Also validates that the specified column is unique.
        </td>
    </tr>    
    <tr>
        <td class='title' valign='top'>
            <b>nospace</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Nospace validator. This validator validates that specified column doesn't contain any space/newline characters. <br />

        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>notblank</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Notblank validator. This validator validates that specified column doesn't contain only space/newline characters. Useful in for example comment posting applications
            where users are not allowed to post empty comments.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>notnull</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Acts as database level notnull constraint as well as notnull validator for the specified column.
        </td>
    </tr>
    <tr>
        <td colspan=3>
            &raquo;&raquo; Advanced validators
            <hr class='small'>
        </td>

    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>email</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Email validator. Validates that specified column is a valid email address.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>date</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Date validator.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>range</b>
        </td>
        <td class='title' valign='top'>
            array(min, max)
        </td>
        <td class='title' valign='top'>
            Range validator. Validates that the column is between <i>min</i> and <i>max</i>.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>country</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Country code validator validates that specified column has a valid country code.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>regexp </b>
        </td>
        <td class='title' valign='top'>
            string regexp
        </td>
        <td class='title' valign='top'>
            Regular expression validator validates that specified column matches <i>regexp</i>.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>ip</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Ip validator validates that specified column is a valid internet protocol address.
        </td>
    </tr>
    <tr>
        <td class='title' valign='top'>
            <b>usstate</b>
        </td>
        <td class='title' valign='top'>
            bool true
        </td>
        <td class='title' valign='top'>
            Usstate validator validates that specified column is a valid usstate.
        </td>
    </tr>
</table>