Generates Objection.js model files from a MySQL database schema by querying information_schema. Latest version 1.1.4 supports automatic detection of tables, columns, and BelongsToOneRelations. Requires a database connection and a knex instance path. Primarily a development tool for scaffolding models, not actively maintained since 2023. Alternatives include sequelize-auto or typeorm-model-generator.
npm install objection-model-generatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Generates Objection.js model files from a MySQL database using environment variables for connection.
Adjust the third argument to Omg constructor to match relative path from output file to knex file.
Ensure knex is installed and the knex file exports a knex instance.
Consider switching to actively maintained alternatives like sequelize-auto or writing custom generation.
Manually add other relations after generation.
Ensure third argument to new Omg() correctly points to your knex file, e.g., '../../knex' if models are deep.
Use const Omg = require('objection-model-generator');Check that database connection parameters are correct and that the database exists.
No dependency data recorded yet.