@budibase/backend-core 2.28.3 → 2.28.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -56550,7 +56550,13 @@ var DatabaseImpl = class _DatabaseImpl {
56550
56550
  async sqlDiskCleanup() {
56551
56551
  const dbName = this.name;
56552
56552
  const url = `/${dbName}/_cleanup`;
56553
- return await this._sqlQuery(url, "POST");
56553
+ try {
56554
+ await this._sqlQuery(url, "POST");
56555
+ } catch (err) {
56556
+ if (err.status !== 500) {
56557
+ throw err;
56558
+ }
56559
+ }
56554
56560
  }
56555
56561
  // removes a document from sqlite
56556
56562
  async sqlPurgeDocument(docIds) {
@@ -56568,17 +56574,13 @@ var DatabaseImpl = class _DatabaseImpl {
56568
56574
  });
56569
56575
  }
56570
56576
  async destroy() {
56577
+ if (environment_default.SQS_SEARCH_ENABLE && await this.exists(SQLITE_DESIGN_DOC_ID)) {
56578
+ const definition = await this.get(SQLITE_DESIGN_DOC_ID);
56579
+ definition.sql.tables = {};
56580
+ await this.put(definition);
56581
+ await this.sqlDiskCleanup();
56582
+ }
56571
56583
  try {
56572
- if (environment_default.SQS_SEARCH_ENABLE) {
56573
- try {
56574
- const definition = await this.get(
56575
- SQLITE_DESIGN_DOC_ID
56576
- );
56577
- await this.remove(SQLITE_DESIGN_DOC_ID, definition._rev);
56578
- } finally {
56579
- await this.sqlDiskCleanup();
56580
- }
56581
- }
56582
56584
  return await this.nano().db.destroy(this.name);
56583
56585
  } catch (err) {
56584
56586
  if (err.statusCode === 404) {