MCPcopy Create free account
hub / github.com/andywer/postguard / checkSchemasForDuplicates

Function checkSchemasForDuplicates

src/cli.ts:39–56  ·  view source on GitHub ↗
(allTableSchemas: TableSchema[])

Source from the content-addressed store, hash-verified

37const watchMode = Boolean(cli.flags.watch || cli.flags.w)
38
39function checkSchemasForDuplicates(allTableSchemas: TableSchema[]) {
40 for (const schema of allTableSchemas) {
41 const schemasMatchingThatName = allTableSchemas.filter(
42 someSchema => someSchema.tableName === schema.tableName
43 )
44 if (schemasMatchingThatName.length > 1) {
45 throw new Error(
46 `Table "${schema.tableName}" has been defined more than once:\n` +
47 schemasMatchingThatName
48 .map(duplicate => {
49 const lineRef = duplicate.loc ? `:${duplicate.loc.start.line}` : ``
50 return ` - ${duplicate.sourceFile.filePath}${lineRef}`
51 })
52 .join("\n")
53 )
54 }
55 }
56}
57
58function run(sourceFilePaths: string[], moreSchemas: TableSchema[] = []) {
59 let allQueries: QueryInvocation[] = []

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected