An adapter-based ORM for ThinkJS 3.x framework, providing database access with support for MySQL and other databases via adapters. Version 1.5.4 is the latest stable release; the package is mature and has low release cadence. Key differentiators include tight integration with ThinkJS, promise-based API, and support for associations, transactions, and query building. It is limited to ThinkJS ecosystem and not a standalone ORM like Sequelize or TypeORM.
npm install think-modelNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up think-model with MySQL adapter, define a model, and run a select query.
Ensure your project is based on ThinkJS 3.x and think-model is loaded as a middleware.
Switch to think-orm and its adapters for future compatibility.
Use async/await or .then() for asynchronous operations.
Update custom model constructors to include options parameter.
Call this.tablePrefix() in model methods to prepend prefix.
Install the adapter: npm install think-db-mysql
Ensure model is instantiated after calling thinkModel() and database config is correct.
Check import: import thinkModel from 'think-model' or const thinkModel = require('think-model');Verify user, password, and host in database configuration.