MCPcopy
hub / github.com/sequelize/sequelize-auto / addSchemaForRelations

Method addSchemaForRelations

src/auto-generator.ts:589–601  ·  view source on GitHub ↗

Add schema to table so it will match the relation data. Fixes mysql problem.

(table: string)

Source from the content-addressed store, hash-verified

587
588 /** Add schema to table so it will match the relation data. Fixes mysql problem. */
589 private addSchemaForRelations(table: string) {
590 if (!table.includes('.') && !this.relations.some(rel => rel.childTable === table)) {
591 // if no tables match the given table, then assume we need to fix the schema
592 const first = this.relations.find(rel => !!rel.childTable);
593 if (first) {
594 const [schemaName, tableName] = qNameSplit(first.childTable);
595 if (schemaName) {
596 table = qNameJoin(schemaName, table);
597 }
598 }
599 }
600 return table;
601 }
602
603 private addTypeScriptAssociationMixins(table: string): Record<string, any> {
604 const sp = this.space[1];

Callers 1

Calls 2

qNameSplitFunction · 0.90
qNameJoinFunction · 0.90

Tested by

no test coverage detected