* Unlimited length TEXT column
| 112 | * Unlimited length TEXT column |
| 113 | */ |
| 114 | class TEXT extends ABSTRACT { |
| 115 | /** |
| 116 | * @param {string} [length=''] could be tiny, medium, long. |
| 117 | */ |
| 118 | constructor(length) { |
| 119 | super(); |
| 120 | const options = typeof length === 'object' && length || { length }; |
| 121 | this.options = options; |
| 122 | this._length = options.length || ''; |
| 123 | } |
| 124 | toSql() { |
| 125 | switch (this._length.toLowerCase()) { |
| 126 | case 'tiny': |
| 127 | return 'TINYTEXT'; |
| 128 | case 'medium': |
| 129 | return 'MEDIUMTEXT'; |
| 130 | case 'long': |
| 131 | return 'LONGTEXT'; |
| 132 | default: |
| 133 | return this.key; |
| 134 | } |
| 135 | } |
| 136 | validate(value) { |
| 137 | if (typeof value !== 'string') { |
| 138 | throw new sequelizeErrors.ValidationError(util.format('%j is not a valid string', value)); |
| 139 | } |
| 140 | return true; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * An unlimited length case-insensitive text column. |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…