( schemaName: string, cursor: CursorV2 )
| 152 | } |
| 153 | |
| 154 | function parseColumnDef( |
| 155 | schemaName: string, |
| 156 | cursor: CursorV2 |
| 157 | ): DatabaseTableColumn | null { |
| 158 | const columnName = cursor.consumeIdentifier(); |
| 159 | if (!columnName) return null; |
| 160 | |
| 161 | let dataType = cursor.read(); |
| 162 | cursor.next(); |
| 163 | |
| 164 | // Handle case such as VARCHAR(255) where we need to read |
| 165 | // something inside the parens |
| 166 | if (cursor.match("(")) { |
| 167 | dataType += cursor.consumeParen().toStringWithParen(); |
| 168 | } |
| 169 | |
| 170 | const constraint = parseColumnConstraint(schemaName, cursor); |
| 171 | |
| 172 | return { |
| 173 | name: columnName, |
| 174 | pk: constraint?.primaryKey, |
| 175 | constraint, |
| 176 | type: dataType, |
| 177 | }; |
| 178 | } |
| 179 | |
| 180 | function parseConstraintConflict( |
| 181 | cursor: CursorV2 |
no test coverage detected
searching dependent graphs…