Repository navigation
Document interactive transactions - #2098
Conversation
|
|
||
| TypeORM only offers limit-offset pagination while Prisma conveniently provides dedicated APIs for both limit-offset but also cursor-based. You can learn more about both approaches in the [Pagination](../../components/prisma-client/pagination) section of the docs or in the API comparison [below](#pagination-1). | ||
|
|
||
| ### Transactions |
There was a problem hiding this comment.
I was debating whether or not to delete or rewrite this section.
There are still a few minor differences: they support isolation levels, we support more ways to do transactions. Decided it wasn't worth calling out as differences, but happy to revisit if you feel differently.
molebox
left a comment
There was a problem hiding this comment.
Looks good! Left a few minor changes and questions 😊
| The following is an example of purchasing a movie ticket online. This is a good use case for an interactive transactions because you don't want to sell the same ticket twice. | ||
|
|
||
| ```tsx | ||
| import { Ticket } from 'prisma' |
There was a problem hiding this comment.
Is this a model type from the movie schema used in this example? Would this be importable from prisma ?
There was a problem hiding this comment.
Yep, but you make a good point. This is not really clear without a Prisma Schema. I need to re-work this example anyways, so I'll address this in another PR.
|
|
||
| In the example above, both the `findFirst` and `update` queries run within a database transaction. When your application reaches the end of the function, the transaction is **committed** to the database. | ||
|
|
||
| If your application encounters an error along the way, the async function will throw an exception and automatically **rollback** the transaction. To catch the exception, you can wrap `$transaction` in a try-catch block. |
There was a problem hiding this comment.
I think it would be helpful to show the try catch block. being as clear as possible will reduce the risk of people misunderstanding from a copy paste
There was a problem hiding this comment.
Good call, added!
…actions.mdx Co-authored-by: Rich Haines <[email protected]>
…actions.mdx Co-authored-by: Rich Haines <[email protected]>
…or on null values (#2077) Clarify behaviour of null values with atomic number operations
Fixed by changing isAdmmin to isAdmin.
* add npm install --save bson * Update content/200-concepts/200-database-connectors/07-mongodb.mdx Co-authored-by: Rich Haines <[email protected]> Co-authored-by: Rich Haines <[email protected]>
* Cross linked debug info * Added note to update table about migrate and schema - ref actions
Fix a few location where it used `model` but `data model` was meant.
…E_BINARY (#2069) * fix(environment-variables-reference): Elaborate on PRISMA_QUERY_ENGINE_BINARY * Update content/400-reference/200-api-reference/300-environment-variables-reference.mdx Co-authored-by: Rich Haines <[email protected]> Co-authored-by: Rich Haines <[email protected]>
* Cross linked debug info * Changed import to new interface
* Cross linked debug info * Fixed broken links on error code page
* Fix typo in docker-compose command Missing "-" in ```docker-compose up -d```
no supported -> not supported
The mongodb example did not make the authorId optional
* start porting constraint changes again * remaining old content ported * first round of fixes * add feedback link * tag fixes * Fixed errors with tab component * fix naming and broken links add some todos * Update content/200-concepts/100-components/01-prisma-schema/07-names-in-underlying-database.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Update content/200-concepts/100-components/01-prisma-schema/07-names-in-underlying-database.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-to-latest/10-upgrade-to-2290.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Added new upgrade structure and preview feature section * Restructure `namedConstraints` preview feature guide page (#2112) * Update content/200-concepts/100-components/01-prisma-schema/07-names-in-underlying-database.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Update content/200-concepts/100-components/01-prisma-schema/07-names-in-underlying-database.mdx Co-authored-by: Jan Piotrowski <[email protected]> * incorporate datamodel feedback * flesh out new structure for upgrade guide Co-authored-by: Rich Haines <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]>
* Cross linked debug info * Added new dev env section, moved files, changed links * Update content/300-guides/125-development-environment/index.mdx Co-authored-by: Hervé Labas <[email protected]> Co-authored-by: Hervé Labas <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
- Unify "Submit feedback" styling - Add "since 2.x.0" with link to release notes - Fix MongoDB feedback issue link - Add referentialActions feedback link - Sort by release version
* start restructuring upgrade guide * finalized upgrade path structure * preview feedback * more formatting
Co-authored-by: Renovate Bot <[email protected]>
* Cross linked debug info * Moved ref actions down nav list, fixed code block indent
This PR adds documentation for our upcoming Interactive Transactions feature.
Preview
Other changes:
chmod +x .husky/pre-committo hopefully fix that.