(table, quote)
| 42 | } |
| 43 | |
| 44 | export function uniqueConstraintClause(table, quote) { |
| 45 | const constraints = (table.uniqueConstraints || []).filter( |
| 46 | (uc) => Array.isArray(uc.fields) && uc.fields.length > 0, |
| 47 | ); |
| 48 | if (constraints.length === 0) return ""; |
| 49 | |
| 50 | return ( |
| 51 | ",\n" + |
| 52 | constraints |
| 53 | .map( |
| 54 | (uc) => |
| 55 | `\tCONSTRAINT ${quote(uc.name)} UNIQUE (${uc.fields |
| 56 | .map((f) => quote(f)) |
| 57 | .join(", ")})`, |
| 58 | ) |
| 59 | .join(",\n") |
| 60 | ); |
| 61 | } |
| 62 | |
| 63 | export function getInlineFK(table, obj) { |
| 64 | let fks = []; |
no outgoing calls
no test coverage detected