fix(share-collection): sync plugins when install sub app (#2650)
This commit is contained in:
parent
34b0ce06ba
commit
dbe3af26a1
@ -95,9 +95,17 @@ class SubAppPlugin extends Plugin {
|
|||||||
// delete old collection
|
// delete old collection
|
||||||
await subApp.db.sequelize.query(`TRUNCATE ${subAppPluginsCollection.quotedTableName()}`);
|
await subApp.db.sequelize.query(`TRUNCATE ${subAppPluginsCollection.quotedTableName()}`);
|
||||||
|
|
||||||
|
const columnsInfo = await subApp.db.sequelize
|
||||||
|
.getQueryInterface()
|
||||||
|
.describeTable(subAppPluginsCollection.getTableNameWithSchema());
|
||||||
|
|
||||||
|
const columns = Object.keys(columnsInfo).sort();
|
||||||
|
|
||||||
|
const columnsInSql = columns.map((column) => `"${column}"`).join(', ');
|
||||||
|
|
||||||
await subApp.db.sequelize.query(`
|
await subApp.db.sequelize.query(`
|
||||||
INSERT INTO ${subAppPluginsCollection.quotedTableName()}
|
INSERT INTO ${subAppPluginsCollection.quotedTableName()} (${columnsInSql})
|
||||||
SELECT *
|
SELECT ${columnsInSql}
|
||||||
FROM ${mainAppPluginsCollection.quotedTableName()}
|
FROM ${mainAppPluginsCollection.quotedTableName()}
|
||||||
WHERE "name" not in ('multi-app-manager', 'multi-app-share-collection');
|
WHERE "name" not in ('multi-app-manager', 'multi-app-share-collection');
|
||||||
`);
|
`);
|
||||||
|
Loading…
Reference in New Issue
Block a user