sequelize-tinker
v0.4.1
Published
A REPL for sequelize inspired by Laravel Tinker.
Downloads
5
Maintainers
Readme
sequelize-tinker
A REPL for sequelize inspired by Laravel Tinker.
Introduction
$ npm -g install sequelize-tinker
$ cd path/to/your-sequelize-package
$ sequelize-tinker
Usage
$ 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]'
>>
Advance
Custom your directory:
Custom Models Dir: --models-path
option.
$ sequelize-tinker --models-path=models/index.js
Todo
- [x] Custom Sequelize model's directory path setting.
- [x] Available await command.
- [ ] Option
- [ ] Default output JSON.stringify
- [ ] Command
- [ ] ls (show local variables)
- [ ] help (show help in repl time)
Roadmap
- ts-node(for TypeScript sequelize)
- Another ORM
- TypeORM
Contribution
git clone [email protected]:nitaking/sequelize-tinker.git
cd example
./bin/run
another sequelize project
git clone [email protected]:nitaking/sequelize-tinker.git
npm link
cd another/prj
sequelize-tinker # Uninstall if you have installed.