Property 'insert' does not exist on type 'QueryRunner' after upgrading
See original GitHub issueIssue type:
[X] question [ ] bug report [ ] feature request [X] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[X] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
TypeORM version:
[X] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
export class FirstReleaseChanges1487003618914 implements MigrationInterface {
async up(queryRunner: InsertQueryRunner): Promise<any> { // Next-gen Typeorm
await queryRunner.insert('configuration', {
name: 'defaultValues',
value: JSON.stringify({
// ... not important
})
});
}
}
Upgraded from 0.1.21 to 0.2.5, and none of my migrations compile anymore. Error message described in issue title.
Searched through the CHANGELOG.md for signs of something which replaces this method, but could only find this:
insert, update and delete methods of QueryRunner now use InsertQueryRunner, UpdateQueryRunner and DeleteQueryRunner inside
The documentation for QueryRunner is marked as TBD
, with no further instructions on how to retreive or use the InsertQueryBuilder
. My VSCode does not know of any class called this and it does not seem to be exported anywhere in typeorm.
How can I translate the above code to something working under TypeOrm latest?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@npatterson you can insert into custom table as well:
queryRunner.manager
BTW which provides EntityManager with createQueryBuilder and other things.