Skip to content

Commit

Permalink
feat: add mysql support for locks
Browse files Browse the repository at this point in the history
Add pessimistic_write_or_fail and pessimistic_partial_write support for mysql

Closes: typeorm#6530
  • Loading branch information
lacunadream committed Dec 30, 2020
1 parent f47b877 commit 07415c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/query-builder/SelectQueryBuilder.ts
Expand Up @@ -1686,14 +1686,14 @@ export class SelectQueryBuilder<Entity> extends QueryBuilder<Entity> implements
throw new LockNotSupportedOnGivenDriverError();
}
case "pessimistic_partial_write":
if (driver instanceof PostgresDriver) {
if (driver instanceof PostgresDriver || driver instanceof MysqlDriver) {
return " FOR UPDATE SKIP LOCKED";

} else {
throw new LockNotSupportedOnGivenDriverError();
}
case "pessimistic_write_or_fail":
if (driver instanceof PostgresDriver) {
if (driver instanceof PostgresDriver || driver instanceof MysqlDriver) {
return " FOR UPDATE NOWAIT";
} else {
throw new LockNotSupportedOnGivenDriverError();
Expand Down

0 comments on commit 07415c1

Please sign in to comment.