MCPcopy
hub / github.com/drawdb-io/drawdb / uniqueConstraintClause

Function uniqueConstraintClause

src/utils/exportSQL/shared.js:44–61  ·  view source on GitHub ↗
(table, quote)

Source from the content-addressed store, hash-verified

42}
43
44export 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
63export function getInlineFK(table, obj) {
64 let fks = [];

Callers 13

toPostgresFunction · 0.90
jsonToMySQLFunction · 0.90
jsonToPostgreSQLFunction · 0.90
jsonToSQLiteFunction · 0.90
jsonToMariaDBFunction · 0.90
jsonToSQLServerFunction · 0.90
jsonToOracleSQLFunction · 0.90
toSqliteFunction · 0.90
toMariaDBFunction · 0.90
toMSSQLFunction · 0.90
toMySQLFunction · 0.90
toOracleSQLFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected