Skip to content

Instantly share code, notes, and snippets.

@gimenete
Last active March 2, 2020 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gimenete/934d4955c903eb353019ea8d1d719f46 to your computer and use it in GitHub Desktop.
Save gimenete/934d4955c903eb353019ea8d1d719f46 to your computer and use it in GitHub Desktop.
Reasons I'm migrating off prisma

After trying out prisma2 I'm migrating to typeorm + type-graphq for a few reasons.

It felt great and easy at the beginning. The data modelling is very easy to start with. Basic things are well documented but I was finding some limitations and things I wasn't liking so much:

  • Pagination. Looks like limited to paginate by id. I wanted to paginate by a date field and felt impossible
  • Generating types inside the nexus and @prisma/client packages is cool, even mind-blowing at the beginning, but sometimes tools like VSCode don't realize types have changed and they give errors when you are using new fields or entities. I had to restart the TS language server sometimes.
  • Too verbose. Example:
// prisma
await prisma.permission.create({
  data: {
    workspace: {
      connect: {
        id: workspace.id
      }
    },
    user: {
      connect: {
        id: user.id
      }
    },
    role
  },
})

// typeorm
const permission = new Permission()
permission.workspace = workspace
permission.user = user
await permission.create()
  • I like the ActiveRecord pattern so typeorm + type-graphql feels very natural. For example adding some business logic to the entities is easy. With prisma I had to do a services dir with classes and static methods.
  • With prisma I couldn't do a omposite primary key
  • Looks like findOne can only be used with primary keys, which felt weird.
  • Weird findOne where clause with a composite unique index. The generated WhereXXX type had no fields on it.
  • --experimental CLI tools hang and never exit. They work, but the process never finishes. I can send screenshots.
  • Non basic things are not very well documented. E.g. Was not easy to create DateTime fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment