Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): allow disabling transactions #4260

Merged
merged 1 commit into from
Apr 23, 2023
Merged

Commits on Apr 23, 2023

  1. feat(core): allow disabling transactions

    Is it now possible to disable transactions, either globally via `disableTransactions` config option, or locally when using `em.transactional()`.
    
    ```ts
    // only the outer transaction will be opened
    await orm.em.transactional(async em => {
      // but the inner calls to both em.transactional and em.begin will be no-op
      await em.transactional(...);
    }, { disableTransactions: true });
    ```
    
    Alternatively, you can disable transactions when creating new forks:
    
    ```ts
    const em = await orm.em.fork({ disableTransactions: true });
    await em.transactional(...); // no-op
    await em.begin(...); // no-op
    await em.commit(...); // commit still calls `flush`
    ```
    
    Closes #3747
    Closes #3992
    B4nan committed Apr 23, 2023
    Configuration menu
    Copy the full SHA
    4636d92 View commit details
    Browse the repository at this point in the history