dehaze

Transactions

You can perform multiple mutations in a single database transaction with automatic rollbacks in case of failures. (i.e. either all of them succeed or none)

For example, let’s say you want to trade a pokemon, i.e. add a new pokemon to your list of pokemons and delete one from it simultaneously. This is how you would do it:

mutation {
  insert_caught_pokemons(
    docs: [
      {id: 5, name: "Charizard"}
    ]
  ) @postgres {
    status
  }
  delete_caught_pokemons(
    where: {id: 4}
  ) @postgres {
    status
  }
}

Have a technical question?

Improve the docs!