TypeORM 0.2.0 released!

Umed Khudoiberdiev
Apr 19, 2018 · 3 min read

Today we proudly announce a new TypeORM version — 0.2.0!

For those, who don’t know — TypeORM is the most powerful ORM for TypeScript and JavaScript that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native and Electron platforms. It scales perfectly for app of any size — from small ones to enterprise applications.

Here is a short list of features we added in 0.2.0:

Electron and React Native support

TypeORM now works in React Native and Electron. TypeORM is the only cross-platform ORM and currently is able to run on server, browser, mobiles and desktop. Share your code and knowledge on multiple platforms!

Oracle support

We supported Oracle before, but there were number of issues, because Oracle is an unique database with lot of specific features. Now we announce that we completely support Oracle — we fixed all issues and completely covered all edge scenarios with tests.

GraphQL integration

We added some new functions that help you to improve your experience with GraphQL by writing less code for your entity relation resolvers. Checkout a Vesper Framework — as an example how to use TypeORM features to automatically resolve entity relations. Vesper is an amazing framework and we are strongly recommend to try it if you are using TypeORM and GraphQL on your backend.

Decorator-less entities

Now TypeORM supports entity definition outside of the entity, without using decorators. This is useful for some people who prefer to have a better separation of concerns — having a model and its schema definition separated. This feature is also useful for people who simply dislike decorators or are using pure JavaScript.

Find Operators

One of our top-requested feature is an ability to have a more advanced operations available when using find methods. We finally added a set of operators you can use:

  • Any
  • Between
  • Equal
  • In
  • IsNull
  • LessThan
  • Like
  • MoreThan
  • Not
  • Raw

Examples of usage are:

repository.find({ title: Not("hello") })

repository.find({ title: Like("%hello%") })

repository.find({ id: In([1, 2, 3]) })

See documentation here.

Persistence

Persistence is a process when you save your models into the database. It has been completely refactored and that’s what we made in persistence:

  • dramatically improved performance, up to hundred times faster!
  • re-implemented cascades and queries executed during saving entities into the database — now TypeORM does as few queries as possible during persistence
  • implemented bulk insertion when multiple objects are saved at once
  • fixed numerous issues when saving relations
  • changed the way how special columns (create date, update date, version) work — now their values are controlled by database (using SQL’s DEFAULT)
  • now updated entity is a full reflection of its database representation after updation (nullable properties are set to null, DEFAULT properties get their values)

QueryBuilder

We improved all query builders — added new methods like returning/ output and few others. Now insert and update query builders are able to execute listeners and update model after operation.

Database schema

We improved schema synchronization process and added new features, like support for CHECK and UNIQUE constraints.

Migrations

We have improved your experience working with migrations by changing migration execution process and introducing new API to create a manual migrations easily.

We also introduced a new CLI method that allows you to generate a migration file with all up and down code inside!

typeorm migration:generate -n MyMigration

It’s a very powerful feature that is going to dramatically improve your migration process. Ben Award made this amazing video on how to use migrations in TypeORM.

Other changes

We made a numerous changes in cascades, schema synchronization, table inheritance support, tree tables, etc. List of all changes including breaking changes is available here.

Thank you!

We was working hard for the last six month to bring you 0.2.0 release. For the last two years, almost every day our core team (Umed Khudoiberdiev and Dmitry Zotov) spent full-time working on it. Open Source is hard. Please consider supporting this project on Open Collective.

We want to thank all our contributors and special thanks to Daniel Lang — TypeORM powers browsers and mobiles thanks to his efforts.

TypeORM is pretty stable already, it made a huge progress in last two years. In the next 0.3.0 release we are planning to focus on following features:

  • improve tree tables support (tree remove and other tree operations)
  • improve QueryBuilder (add new methods like addSelectAndMap)
  • investigate proper cascade remove functionality
  • add triggers and views support
  • add JavaScript documentation

We are getting close to final 1.0.0 release and hopefully we do it by the end of summer.

If you are interested in contribution there is a list of “getting-started” tasks created special for the community. Join us!

TypeORM

Amazing ORM for TypeScript and JavaScript (ES7, ES6, ES5).

TypeORM

Amazing ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms

Umed Khudoiberdiev

Written by

Technical Lead and LEAN development expert. TypeScript / JavaScript developer and Open Source contributor.

TypeORM

Amazing ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms