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

Method createFile

src/auto-writer.ts:85–95  ·  view source on GitHub ↗
(table: string)

Source from the content-addressed store, hash-verified

83 }
84 }
85 private createFile(table: string) {
86 // FIXME: schema is not used to write the file name and there could be collisions. For now it
87 // is up to the developer to pick the right schema, and potentially chose different output
88 // folders for each different schema.
89 const [schemaName, tableName] = qNameSplit(table);
90 const fileName = recase(this.options.caseFile, tableName, this.options.singularize);
91 const filePath = path.join(this.options.directory, fileName + (this.options.lang === 'ts' ? '.ts' : '.js'));
92
93 const writeFile = util.promisify(fs.writeFile);
94 return writeFile(path.resolve(filePath), this.tableText[table]);
95 }
96
97 /** Create the belongsToMany/belongsTo/hasMany/hasOne association strings */
98 private createAssociations(typeScript: boolean) {

Callers 1

writeMethod · 0.95

Calls 2

qNameSplitFunction · 0.90
recaseFunction · 0.90

Tested by

no test coverage detected