A REPL for sequelize inspired by Laravel Tinker.
$ npm -g install sequelize-tinker
$ cd path/to/your-sequelize-package
$ sequelize-tinker
$ sequelize-tinker
>> Start sequelize-tinker!
...
>> models
# [ 'Task', 'User' ]
$ sequelize-tinker
>> Start sequelize-tinker!
...
>> User.findOne({ raw: true })
Executing (default): SELECT `id`, `firstName`, `lastName`, `createdAt`, `updatedAt` FROM `Users` AS `User` LIMIT 1;
{ id: 1,
firstName: 'John',
lastName: 'Doe',
createdAt: 2020-02-01T12:50:17.000Z,
updatedAt: 2020-02-01T12:50:17.000Z }
$ sequelize-tinker
>> Start sequelize-tinker!
...
>> const u = await User.findOne({ raw: true, where: { id: 49197 } })
undefined
>> u.email
'[email protected]'
>>
Custom Models Dir: --models-path
option.
$ sequelize-tinker --models-path=models/index.js
- Custom Sequelize model's directory path setting.
- Available await command.
- Option
- Default output JSON.stringify
- Command
- ls (show local variables)
- help (show help in repl time)
- Multi Line
- ts-node(for TypeScript sequelize)
- Another ORM
- TypeORM
git clone [email protected]:nitaking/sequelize-tinker.git
cd example
./bin/run
# fork from [email protected]:nitaking/sequelize-tinker.git
npm link
cd another/prj
sequelize-tinker # Uninstall if you have installed.