Config
Configuration file location
When running mysql-to-zod
, you can specify the location of the configuration file.
npx mysql-to-zod mysql://user:password@localhost:3306/dbname -f ./mysqlToZod.config.js
If you do not specify a configuration file, the tool will look for a mysqlToZod.config.js file in the current directory where the command is executed.
How to write a configuration file
The configuration file should be written as follows
const options = { output: { outDir: "./mysqlToZod", fileName: "schema.ts", }, comments: { table: { active: true, format: "// [table:!name] : !text", }, column: { active: true, format: "// !name : !text", }, }, type: { declared: "type", format: "pascal", prefix: "", suffix: "", replacements: [], }, schema: { format: "camel", prefix: "", suffix: "Schema", replacements: [], nullType: "nullish", inline: true, zod: { implementation: [], references: [], }, }, sync: { active: true, },};module.exports = options;
Can work without configuration file
If no configuration file exists, the default settings are applied.
Please refer to the next and following sections for each setting.