1.1.4 • Published 1 year ago
objection-model-generator v1.1.4
OMG
Objection Model Generator is a tool to automagically generate all ObjectionJS models from Mysql data base, using the information_schema table to let us know tables, columns and BelongsToOneRelations.
require('dotenv').config();
const fs = require('fs');
const Omg = require('objection-model-generator');
// OPTIONAL: add pluralize customization
const pluralize = require('pluralize');
pluralize.addSingularRule('mouse', 'mice');
pluralize.addSingularRule('Mouse', 'Mice');
//----
const main = async () => {
let omg = new Omg({
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASS
}, process.env.DB_NAME, '../knex'); // relative path to the knex instance, the generated file goings to require that file
let ms = await omg.createModels();
let path = 'src/api/models/generated.js'; // path to where goings to be created the output
fs.writeFileSync(path, ms);
console.log('-> file writed:', path);
process.exit();
}
main();
1.1.1
1 year ago
1.1.4
1 year ago
1.1.3
1 year ago
1.1.2
1 year ago
1.0.21
1 year ago
1.0.11
1 year ago
1.0.19
2 years ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
3 years ago
1.0.9
3 years ago
1.0.10
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago