diff --git a/README.md b/README.md index b09e216..1091285 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ Supports the following databases: MySQL, Microsoft SQL Server, SQLite and Postgr `npx sql-ts-knex-generator -c ./config.json` +It will create a folder and generate a file for each table containing CRUD (create, read, update, delete) functions based on DB schema. + +It respects nullable and required fields. + ## Config file options [Config file options](https://saostad.github.io/sql-ts-knex-generator/interfaces/config.html) diff --git a/dist/cli.js b/dist/cli.js index 3c95182..30fcd3d 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -52,6 +52,7 @@ if (typeof config.template !== "string") { /** Create out directory if not exist */ try { fs.mkdirSync(outDirPath); + console.log(`${outDirPath} folder has been created.`); } catch (error) { if (error.code !== "EEXIST") { @@ -59,11 +60,14 @@ catch (error) { } } (async () => { + console.log(`Connecting to db...`); const decoratedDatabase = await index_1.toObject(config); const { tables } = decoratedDatabase; + console.log(`Analyzing table's schema...`); const eachTable = tables.map((el) => // TODO: add enums instead of ignoring it index_1.DatabaseTasks.stringifyDatabase({ tables: [el], enums: [] }, config)); + console.log(`Creating TS files...`); eachTable.forEach((el, index) => { const filePath = path.join(outDirPath, `${decoratedDatabase.tables[index].name}.ts`); fs.writeFileSync(filePath, el); @@ -76,6 +80,7 @@ export * from "./{{table.name}}"; const filePath = path.join(outDirPath, `index.ts`); fs.writeFileSync(filePath, indexContent); } - console.log(`files written in directory ${outDirPath}`); + console.log(`Files written in directory ${outDirPath}`); + console.log(`You can use "import {} form 'index.ts'"`); })(); //# sourceMappingURL=cli.js.map \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index b13c421..f22b4b1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -67,6 +67,8 @@
npx sql-ts-knex-generator -c ./config.json
It will create a folder and generate a file for each table containing CRUD (create, read, update, delete) functions based on DB schema.
+It respects nullable and required fields.