chore: sync collection after set collection fields (#3112)
This commit is contained in:
parent
f62134a4ed
commit
79d2647c51
@ -14,14 +14,14 @@ export default {
|
|||||||
|
|
||||||
const db = ctx.app.db as Database;
|
const db = ctx.app.db as Database;
|
||||||
|
|
||||||
const collection = await db.getRepository('collections').findOne({
|
const collectionModel = await db.getRepository('collections').findOne({
|
||||||
filter: {
|
filter: {
|
||||||
name: filterByTk,
|
name: filterByTk,
|
||||||
},
|
},
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
const existFields = await collection.getFields({
|
const existFields = await collectionModel.getFields({
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -65,10 +65,19 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await collection.loadFields({
|
await collectionModel.loadFields({
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const collection = db.getCollection(filterByTk);
|
||||||
|
await collection.sync({
|
||||||
|
force: false,
|
||||||
|
alter: {
|
||||||
|
drop: false,
|
||||||
|
},
|
||||||
|
transaction,
|
||||||
|
} as any);
|
||||||
|
|
||||||
await transaction.commit();
|
await transaction.commit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await transaction.rollback();
|
await transaction.rollback();
|
||||||
|
Loading…
Reference in New Issue
Block a user