From 3ad403e0a9b7b06a6c0aac2c2e450992f639572e Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Wed, 15 May 2024 12:36:19 +1000 Subject: [PATCH] Bump version, add db migration close #207 --- webapp/package.json | 2 +- webapp/src/components/Layout.tsx | 2 +- webapp/src/migrations/1.2.0.ts | 34 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 webapp/src/migrations/1.2.0.ts diff --git a/webapp/package.json b/webapp/package.json index 27c2089a..f669c7c8 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,6 +1,6 @@ { "name": "webapp-next", - "version": "1.1.0", + "version": "1.2.0", "description": "", "main": "server.js", "scripts": { diff --git a/webapp/src/components/Layout.tsx b/webapp/src/components/Layout.tsx index 8a5dc23e..ab5b8cf2 100644 --- a/webapp/src/components/Layout.tsx +++ b/webapp/src/components/Layout.tsx @@ -622,7 +622,7 @@ export default withRouter(function Layout(props) {
); diff --git a/webapp/src/migrations/1.2.0.ts b/webapp/src/migrations/1.2.0.ts new file mode 100644 index 00000000..13f52d69 --- /dev/null +++ b/webapp/src/migrations/1.2.0.ts @@ -0,0 +1,34 @@ +import debug from 'debug'; +const log = debug('webapp:migration:1.2.0'); + +export default async function(db) { + log('Updating apps collection with new properties'); + await db.collection('apps').updateMany({}, { + $set: { + memory: false, + cache: false, + }, + }); + log('Updating datasource collection with new properties'); + await db.collection('apps').updateMany({}, { + $set: { + recordCount: {}, + }, + $unset: { + syncedCount: '', + embeddedCount: '', + } + }); + + log('Making all non builtin tasks require human input'); + //NOTE: we don't use libs here e.g. SubscriptionPlan.RAW because that struct could change/not be importable anymore. all has to be encapsulated + await db.collection('apps').updateMany({ + 'data.builtin': false + }, { + $set: { + requiresHumanInput: true, + retriever_type: 'raw', + retriever_config: {}, //not required for raw + }, + }); +}