fix(database): lost transaction
This commit is contained in:
parent
15e6eac3ce
commit
542dc7dace
@ -41,17 +41,21 @@ export class SortField extends Field {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async initRecordsSortValue({ syncOptions }) {
|
async initRecordsSortValue({ transaction }) {
|
||||||
const totalCount = await this.collection.repository.count();
|
const totalCount = await this.collection.repository.count({
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
const emptyCount = await this.collection.repository.count({
|
const emptyCount = await this.collection.repository.count({
|
||||||
filter: {
|
filter: {
|
||||||
[this.name]: null,
|
[this.name]: null,
|
||||||
},
|
},
|
||||||
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (emptyCount === totalCount && emptyCount > 0) {
|
if (emptyCount === totalCount && emptyCount > 0) {
|
||||||
const records = await this.collection.repository.find({
|
const records = await this.collection.repository.find({
|
||||||
order: [this.collection.model.primaryKeyAttribute],
|
order: [this.collection.model.primaryKeyAttribute],
|
||||||
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
let start = 1;
|
let start = 1;
|
||||||
@ -61,6 +65,7 @@ export class SortField extends Field {
|
|||||||
sort: start,
|
sort: start,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
transaction,
|
||||||
silent: true,
|
silent: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user