@hot-updater/postgres 0.30.11 → 0.31.0

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.cjs CHANGED
@@ -1908,11 +1908,95 @@ const getUpdateInfo = (pool, args) => {
1908
1908
  };
1909
1909
  //#endregion
1910
1910
  //#region src/postgres.ts
1911
+ const normalizeMetadata = (value) => {
1912
+ if (!value) return;
1913
+ if (typeof value === "string") try {
1914
+ return normalizeMetadata(JSON.parse(value));
1915
+ } catch {
1916
+ return;
1917
+ }
1918
+ if (typeof value === "object" && !Array.isArray(value)) return value;
1919
+ };
1920
+ const buildBundlePatchId = (bundleId, baseBundleId) => `${bundleId}:${baseBundleId}`;
1921
+ const mapPatchRowToPatch = (row) => ({
1922
+ baseBundleId: row.base_bundle_id,
1923
+ baseFileHash: row.base_file_hash,
1924
+ patchFileHash: row.patch_file_hash,
1925
+ patchStorageUri: row.patch_storage_uri
1926
+ });
1927
+ const mapRowToBundle = (data, patchRows = []) => {
1928
+ const rawMetadata = normalizeMetadata(data.metadata);
1929
+ const patches = patchRows.slice().sort((left, right) => left.order_index - right.order_index || left.base_bundle_id.localeCompare(right.base_bundle_id)).map(mapPatchRowToPatch);
1930
+ const primaryPatch = patches[0] ?? null;
1931
+ return {
1932
+ enabled: data.enabled,
1933
+ shouldForceUpdate: data.should_force_update,
1934
+ fileHash: data.file_hash,
1935
+ gitCommitHash: data.git_commit_hash,
1936
+ id: data.id,
1937
+ message: data.message,
1938
+ platform: data.platform,
1939
+ targetAppVersion: data.target_app_version,
1940
+ channel: data.channel,
1941
+ storageUri: data.storage_uri,
1942
+ fingerprintHash: data.fingerprint_hash,
1943
+ metadata: (0, _hot_updater_core.stripBundleArtifactMetadata)(rawMetadata),
1944
+ manifestStorageUri: data.manifest_storage_uri ?? null,
1945
+ manifestFileHash: data.manifest_file_hash ?? null,
1946
+ assetBaseStorageUri: data.asset_base_storage_uri ?? null,
1947
+ patches,
1948
+ patchBaseBundleId: primaryPatch?.baseBundleId ?? null,
1949
+ patchBaseFileHash: primaryPatch?.baseFileHash ?? null,
1950
+ patchFileHash: primaryPatch?.patchFileHash ?? null,
1951
+ patchStorageUri: primaryPatch?.patchStorageUri ?? null,
1952
+ rolloutCohortCount: data.rollout_cohort_count,
1953
+ targetCohorts: data.target_cohorts
1954
+ };
1955
+ };
1956
+ const bundleToRowValues = (bundle) => ({
1957
+ id: bundle.id,
1958
+ enabled: bundle.enabled,
1959
+ should_force_update: bundle.shouldForceUpdate,
1960
+ file_hash: bundle.fileHash,
1961
+ git_commit_hash: bundle.gitCommitHash,
1962
+ message: bundle.message,
1963
+ platform: bundle.platform,
1964
+ target_app_version: bundle.targetAppVersion,
1965
+ channel: bundle.channel,
1966
+ storage_uri: bundle.storageUri,
1967
+ fingerprint_hash: bundle.fingerprintHash,
1968
+ metadata: (0, _hot_updater_core.stripBundleArtifactMetadata)(bundle.metadata) ?? {},
1969
+ manifest_storage_uri: (0, _hot_updater_core.getManifestStorageUri)(bundle),
1970
+ manifest_file_hash: (0, _hot_updater_core.getManifestFileHash)(bundle),
1971
+ asset_base_storage_uri: (0, _hot_updater_core.getAssetBaseStorageUri)(bundle),
1972
+ rollout_cohort_count: bundle.rolloutCohortCount ?? null,
1973
+ target_cohorts: bundle.targetCohorts ?? null
1974
+ });
1975
+ const bundleToPatchRows = (bundle) => (0, _hot_updater_core.getBundlePatches)(bundle).map((patch, index) => ({
1976
+ id: buildBundlePatchId(bundle.id, patch.baseBundleId),
1977
+ bundle_id: bundle.id,
1978
+ base_bundle_id: patch.baseBundleId,
1979
+ base_file_hash: patch.baseFileHash,
1980
+ patch_file_hash: patch.patchFileHash,
1981
+ patch_storage_uri: patch.patchStorageUri,
1982
+ order_index: index
1983
+ }));
1911
1984
  const postgres = (0, _hot_updater_plugin_core.createDatabasePlugin)({
1912
1985
  name: "postgres",
1913
1986
  factory: (config) => {
1914
1987
  const pool = new pg.Pool(config);
1915
1988
  const db = new kysely.Kysely({ dialect: new kysely.PostgresDialect({ pool }) });
1989
+ const fetchPatchMap = async (bundleIds) => {
1990
+ const patchMap = /* @__PURE__ */ new Map();
1991
+ if (bundleIds.length === 0) return patchMap;
1992
+ const rows = await db.selectFrom("bundle_patches").selectAll().where("bundle_id", "in", bundleIds).orderBy("order_index", "asc").execute();
1993
+ for (const row of rows) {
1994
+ const current = patchMap.get(row.bundle_id) ?? [];
1995
+ current.push(row);
1996
+ patchMap.set(row.bundle_id, current);
1997
+ }
1998
+ return patchMap;
1999
+ };
1916
2000
  return {
1917
2001
  async onUnmount() {
1918
2002
  await db.destroy();
@@ -1922,21 +2006,9 @@ const postgres = (0, _hot_updater_plugin_core.createDatabasePlugin)({
1922
2006
  return getUpdateInfo(pool, args);
1923
2007
  },
1924
2008
  async getBundleById(bundleId) {
1925
- const data = await db.selectFrom("bundles").selectAll().where("id", "=", bundleId).executeTakeFirst();
2009
+ const [data, patchMap] = await Promise.all([db.selectFrom("bundles").selectAll().where("id", "=", bundleId).executeTakeFirst(), fetchPatchMap([bundleId])]);
1926
2010
  if (!data) return null;
1927
- return {
1928
- enabled: data.enabled,
1929
- shouldForceUpdate: data.should_force_update,
1930
- fileHash: data.file_hash,
1931
- gitCommitHash: data.git_commit_hash,
1932
- id: data.id,
1933
- message: data.message,
1934
- platform: data.platform,
1935
- targetAppVersion: data.target_app_version,
1936
- channel: data.channel,
1937
- storageUri: data.storage_uri,
1938
- fingerprintHash: data.fingerprint_hash
1939
- };
2011
+ return mapRowToBundle(data, patchMap.get(bundleId) ?? []);
1940
2012
  },
1941
2013
  async getBundles(options) {
1942
2014
  const { where, limit, orderBy } = options ?? {};
@@ -1972,20 +2044,10 @@ const postgres = (0, _hot_updater_plugin_core.createDatabasePlugin)({
1972
2044
  if (where?.id?.in) query = query.where("id", "in", where.id.in);
1973
2045
  if (limit) query = query.limit(limit);
1974
2046
  if (offset) query = query.offset(offset);
2047
+ const data = await query.selectAll().execute();
2048
+ const patchMap = await fetchPatchMap(data.map((bundle) => bundle.id));
1975
2049
  return {
1976
- data: (await query.selectAll().execute()).map((bundle) => ({
1977
- enabled: bundle.enabled,
1978
- shouldForceUpdate: bundle.should_force_update,
1979
- fileHash: bundle.file_hash,
1980
- gitCommitHash: bundle.git_commit_hash,
1981
- id: bundle.id,
1982
- message: bundle.message,
1983
- platform: bundle.platform,
1984
- targetAppVersion: bundle.target_app_version,
1985
- channel: bundle.channel,
1986
- storageUri: bundle.storage_uri,
1987
- fingerprintHash: bundle.fingerprint_hash
1988
- })),
2050
+ data: data.map((bundle) => mapRowToBundle(bundle, patchMap.get(bundle.id) ?? [])),
1989
2051
  pagination: (0, _hot_updater_plugin_core.calculatePagination)(total, {
1990
2052
  limit,
1991
2053
  offset
@@ -1999,33 +2061,17 @@ const postgres = (0, _hot_updater_plugin_core.createDatabasePlugin)({
1999
2061
  if (changedSets.length === 0) return;
2000
2062
  await db.transaction().execute(async (tx) => {
2001
2063
  for (const op of changedSets) if (op.operation === "delete") {
2064
+ await tx.deleteFrom("bundle_patches").where("bundle_id", "=", op.data.id).execute();
2065
+ await tx.deleteFrom("bundle_patches").where("base_bundle_id", "=", op.data.id).execute();
2002
2066
  if ((await tx.deleteFrom("bundles").where("id", "=", op.data.id).executeTakeFirst()).numDeletedRows === 0n) throw new Error(`Bundle with id ${op.data.id} not found`);
2003
2067
  } else if (op.operation === "insert" || op.operation === "update") {
2004
2068
  const bundle = op.data;
2005
- await tx.insertInto("bundles").values({
2006
- id: bundle.id,
2007
- enabled: bundle.enabled,
2008
- should_force_update: bundle.shouldForceUpdate,
2009
- file_hash: bundle.fileHash,
2010
- git_commit_hash: bundle.gitCommitHash,
2011
- message: bundle.message,
2012
- platform: bundle.platform,
2013
- target_app_version: bundle.targetAppVersion,
2014
- channel: bundle.channel,
2015
- storage_uri: bundle.storageUri,
2016
- fingerprint_hash: bundle.fingerprintHash
2017
- }).onConflict((oc) => oc.column("id").doUpdateSet({
2018
- enabled: bundle.enabled,
2019
- should_force_update: bundle.shouldForceUpdate,
2020
- file_hash: bundle.fileHash,
2021
- git_commit_hash: bundle.gitCommitHash,
2022
- message: bundle.message,
2023
- platform: bundle.platform,
2024
- target_app_version: bundle.targetAppVersion,
2025
- channel: bundle.channel,
2026
- storage_uri: bundle.storageUri,
2027
- fingerprint_hash: bundle.fingerprintHash
2028
- })).execute();
2069
+ const values = bundleToRowValues(bundle);
2070
+ const patchRows = bundleToPatchRows(bundle);
2071
+ const { id: _id, ...updateValues } = values;
2072
+ await tx.insertInto("bundles").values(values).onConflict((oc) => oc.column("id").doUpdateSet(updateValues)).execute();
2073
+ await tx.deleteFrom("bundle_patches").where("bundle_id", "=", bundle.id).execute();
2074
+ if (patchRows.length > 0) await tx.insertInto("bundle_patches").values(patchRows).execute();
2029
2075
  }
2030
2076
  });
2031
2077
  }
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
- import { NIL_UUID } from "@hot-updater/core";
2
+ import { NIL_UUID, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, stripBundleArtifactMetadata } from "@hot-updater/core";
3
3
  import { calculatePagination, createDatabasePlugin } from "@hot-updater/plugin-core";
4
4
  import { Kysely, PostgresDialect } from "kysely";
5
5
  import { Pool } from "pg";
@@ -1909,11 +1909,95 @@ const getUpdateInfo = (pool, args) => {
1909
1909
  };
1910
1910
  //#endregion
1911
1911
  //#region src/postgres.ts
1912
+ const normalizeMetadata = (value) => {
1913
+ if (!value) return;
1914
+ if (typeof value === "string") try {
1915
+ return normalizeMetadata(JSON.parse(value));
1916
+ } catch {
1917
+ return;
1918
+ }
1919
+ if (typeof value === "object" && !Array.isArray(value)) return value;
1920
+ };
1921
+ const buildBundlePatchId = (bundleId, baseBundleId) => `${bundleId}:${baseBundleId}`;
1922
+ const mapPatchRowToPatch = (row) => ({
1923
+ baseBundleId: row.base_bundle_id,
1924
+ baseFileHash: row.base_file_hash,
1925
+ patchFileHash: row.patch_file_hash,
1926
+ patchStorageUri: row.patch_storage_uri
1927
+ });
1928
+ const mapRowToBundle = (data, patchRows = []) => {
1929
+ const rawMetadata = normalizeMetadata(data.metadata);
1930
+ const patches = patchRows.slice().sort((left, right) => left.order_index - right.order_index || left.base_bundle_id.localeCompare(right.base_bundle_id)).map(mapPatchRowToPatch);
1931
+ const primaryPatch = patches[0] ?? null;
1932
+ return {
1933
+ enabled: data.enabled,
1934
+ shouldForceUpdate: data.should_force_update,
1935
+ fileHash: data.file_hash,
1936
+ gitCommitHash: data.git_commit_hash,
1937
+ id: data.id,
1938
+ message: data.message,
1939
+ platform: data.platform,
1940
+ targetAppVersion: data.target_app_version,
1941
+ channel: data.channel,
1942
+ storageUri: data.storage_uri,
1943
+ fingerprintHash: data.fingerprint_hash,
1944
+ metadata: stripBundleArtifactMetadata(rawMetadata),
1945
+ manifestStorageUri: data.manifest_storage_uri ?? null,
1946
+ manifestFileHash: data.manifest_file_hash ?? null,
1947
+ assetBaseStorageUri: data.asset_base_storage_uri ?? null,
1948
+ patches,
1949
+ patchBaseBundleId: primaryPatch?.baseBundleId ?? null,
1950
+ patchBaseFileHash: primaryPatch?.baseFileHash ?? null,
1951
+ patchFileHash: primaryPatch?.patchFileHash ?? null,
1952
+ patchStorageUri: primaryPatch?.patchStorageUri ?? null,
1953
+ rolloutCohortCount: data.rollout_cohort_count,
1954
+ targetCohorts: data.target_cohorts
1955
+ };
1956
+ };
1957
+ const bundleToRowValues = (bundle) => ({
1958
+ id: bundle.id,
1959
+ enabled: bundle.enabled,
1960
+ should_force_update: bundle.shouldForceUpdate,
1961
+ file_hash: bundle.fileHash,
1962
+ git_commit_hash: bundle.gitCommitHash,
1963
+ message: bundle.message,
1964
+ platform: bundle.platform,
1965
+ target_app_version: bundle.targetAppVersion,
1966
+ channel: bundle.channel,
1967
+ storage_uri: bundle.storageUri,
1968
+ fingerprint_hash: bundle.fingerprintHash,
1969
+ metadata: stripBundleArtifactMetadata(bundle.metadata) ?? {},
1970
+ manifest_storage_uri: getManifestStorageUri(bundle),
1971
+ manifest_file_hash: getManifestFileHash(bundle),
1972
+ asset_base_storage_uri: getAssetBaseStorageUri(bundle),
1973
+ rollout_cohort_count: bundle.rolloutCohortCount ?? null,
1974
+ target_cohorts: bundle.targetCohorts ?? null
1975
+ });
1976
+ const bundleToPatchRows = (bundle) => getBundlePatches(bundle).map((patch, index) => ({
1977
+ id: buildBundlePatchId(bundle.id, patch.baseBundleId),
1978
+ bundle_id: bundle.id,
1979
+ base_bundle_id: patch.baseBundleId,
1980
+ base_file_hash: patch.baseFileHash,
1981
+ patch_file_hash: patch.patchFileHash,
1982
+ patch_storage_uri: patch.patchStorageUri,
1983
+ order_index: index
1984
+ }));
1912
1985
  const postgres = createDatabasePlugin({
1913
1986
  name: "postgres",
1914
1987
  factory: (config) => {
1915
1988
  const pool = new Pool(config);
1916
1989
  const db = new Kysely({ dialect: new PostgresDialect({ pool }) });
1990
+ const fetchPatchMap = async (bundleIds) => {
1991
+ const patchMap = /* @__PURE__ */ new Map();
1992
+ if (bundleIds.length === 0) return patchMap;
1993
+ const rows = await db.selectFrom("bundle_patches").selectAll().where("bundle_id", "in", bundleIds).orderBy("order_index", "asc").execute();
1994
+ for (const row of rows) {
1995
+ const current = patchMap.get(row.bundle_id) ?? [];
1996
+ current.push(row);
1997
+ patchMap.set(row.bundle_id, current);
1998
+ }
1999
+ return patchMap;
2000
+ };
1917
2001
  return {
1918
2002
  async onUnmount() {
1919
2003
  await db.destroy();
@@ -1923,21 +2007,9 @@ const postgres = createDatabasePlugin({
1923
2007
  return getUpdateInfo(pool, args);
1924
2008
  },
1925
2009
  async getBundleById(bundleId) {
1926
- const data = await db.selectFrom("bundles").selectAll().where("id", "=", bundleId).executeTakeFirst();
2010
+ const [data, patchMap] = await Promise.all([db.selectFrom("bundles").selectAll().where("id", "=", bundleId).executeTakeFirst(), fetchPatchMap([bundleId])]);
1927
2011
  if (!data) return null;
1928
- return {
1929
- enabled: data.enabled,
1930
- shouldForceUpdate: data.should_force_update,
1931
- fileHash: data.file_hash,
1932
- gitCommitHash: data.git_commit_hash,
1933
- id: data.id,
1934
- message: data.message,
1935
- platform: data.platform,
1936
- targetAppVersion: data.target_app_version,
1937
- channel: data.channel,
1938
- storageUri: data.storage_uri,
1939
- fingerprintHash: data.fingerprint_hash
1940
- };
2012
+ return mapRowToBundle(data, patchMap.get(bundleId) ?? []);
1941
2013
  },
1942
2014
  async getBundles(options) {
1943
2015
  const { where, limit, orderBy } = options ?? {};
@@ -1973,20 +2045,10 @@ const postgres = createDatabasePlugin({
1973
2045
  if (where?.id?.in) query = query.where("id", "in", where.id.in);
1974
2046
  if (limit) query = query.limit(limit);
1975
2047
  if (offset) query = query.offset(offset);
2048
+ const data = await query.selectAll().execute();
2049
+ const patchMap = await fetchPatchMap(data.map((bundle) => bundle.id));
1976
2050
  return {
1977
- data: (await query.selectAll().execute()).map((bundle) => ({
1978
- enabled: bundle.enabled,
1979
- shouldForceUpdate: bundle.should_force_update,
1980
- fileHash: bundle.file_hash,
1981
- gitCommitHash: bundle.git_commit_hash,
1982
- id: bundle.id,
1983
- message: bundle.message,
1984
- platform: bundle.platform,
1985
- targetAppVersion: bundle.target_app_version,
1986
- channel: bundle.channel,
1987
- storageUri: bundle.storage_uri,
1988
- fingerprintHash: bundle.fingerprint_hash
1989
- })),
2051
+ data: data.map((bundle) => mapRowToBundle(bundle, patchMap.get(bundle.id) ?? [])),
1990
2052
  pagination: calculatePagination(total, {
1991
2053
  limit,
1992
2054
  offset
@@ -2000,33 +2062,17 @@ const postgres = createDatabasePlugin({
2000
2062
  if (changedSets.length === 0) return;
2001
2063
  await db.transaction().execute(async (tx) => {
2002
2064
  for (const op of changedSets) if (op.operation === "delete") {
2065
+ await tx.deleteFrom("bundle_patches").where("bundle_id", "=", op.data.id).execute();
2066
+ await tx.deleteFrom("bundle_patches").where("base_bundle_id", "=", op.data.id).execute();
2003
2067
  if ((await tx.deleteFrom("bundles").where("id", "=", op.data.id).executeTakeFirst()).numDeletedRows === 0n) throw new Error(`Bundle with id ${op.data.id} not found`);
2004
2068
  } else if (op.operation === "insert" || op.operation === "update") {
2005
2069
  const bundle = op.data;
2006
- await tx.insertInto("bundles").values({
2007
- id: bundle.id,
2008
- enabled: bundle.enabled,
2009
- should_force_update: bundle.shouldForceUpdate,
2010
- file_hash: bundle.fileHash,
2011
- git_commit_hash: bundle.gitCommitHash,
2012
- message: bundle.message,
2013
- platform: bundle.platform,
2014
- target_app_version: bundle.targetAppVersion,
2015
- channel: bundle.channel,
2016
- storage_uri: bundle.storageUri,
2017
- fingerprint_hash: bundle.fingerprintHash
2018
- }).onConflict((oc) => oc.column("id").doUpdateSet({
2019
- enabled: bundle.enabled,
2020
- should_force_update: bundle.shouldForceUpdate,
2021
- file_hash: bundle.fileHash,
2022
- git_commit_hash: bundle.gitCommitHash,
2023
- message: bundle.message,
2024
- platform: bundle.platform,
2025
- target_app_version: bundle.targetAppVersion,
2026
- channel: bundle.channel,
2027
- storage_uri: bundle.storageUri,
2028
- fingerprint_hash: bundle.fingerprintHash
2029
- })).execute();
2070
+ const values = bundleToRowValues(bundle);
2071
+ const patchRows = bundleToPatchRows(bundle);
2072
+ const { id: _id, ...updateValues } = values;
2073
+ await tx.insertInto("bundles").values(values).onConflict((oc) => oc.column("id").doUpdateSet(updateValues)).execute();
2074
+ await tx.deleteFrom("bundle_patches").where("bundle_id", "=", bundle.id).execute();
2075
+ if (patchRows.length > 0) await tx.insertInto("bundle_patches").values(patchRows).execute();
2030
2076
  }
2031
2077
  });
2032
2078
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/postgres",
3
3
  "type": "module",
4
- "version": "0.30.11",
4
+ "version": "0.31.0",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
@@ -31,8 +31,8 @@
31
31
  "dependencies": {
32
32
  "kysely": "0.28.16",
33
33
  "pg": "8.13.1",
34
- "@hot-updater/core": "0.30.11",
35
- "@hot-updater/plugin-core": "0.30.11"
34
+ "@hot-updater/core": "0.31.0",
35
+ "@hot-updater/plugin-core": "0.31.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@electric-sql/pglite": "0.2.17",
@@ -40,8 +40,8 @@
40
40
  "@types/pg": "^8.11.10",
41
41
  "camelcase-keys": "^9.1.3",
42
42
  "pg-minify": "^1.6.5",
43
- "@hot-updater/js": "0.30.11",
44
- "@hot-updater/test-utils": "0.30.11"
43
+ "@hot-updater/js": "0.31.0",
44
+ "@hot-updater/test-utils": "0.31.0"
45
45
  },
46
46
  "inlinedDependencies": {
47
47
  "camelcase": "8.0.0",
package/sql/bundles.sql CHANGED
@@ -18,13 +18,28 @@ CREATE TABLE bundles (
18
18
  (target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL)
19
19
  ),
20
20
  metadata jsonb DEFAULT '{}'::jsonb,
21
+ manifest_storage_uri text,
22
+ manifest_file_hash text,
23
+ asset_base_storage_uri text,
21
24
  rollout_cohort_count INTEGER DEFAULT 1000
22
25
  CHECK (rollout_cohort_count >= 0 AND rollout_cohort_count <= 1000),
23
26
  target_cohorts TEXT[]
24
27
  );
25
28
 
29
+ CREATE TABLE bundle_patches (
30
+ id text PRIMARY KEY,
31
+ bundle_id uuid NOT NULL REFERENCES bundles(id) ON DELETE CASCADE,
32
+ base_bundle_id uuid NOT NULL REFERENCES bundles(id) ON DELETE CASCADE,
33
+ base_file_hash text NOT NULL,
34
+ patch_file_hash text NOT NULL,
35
+ patch_storage_uri text NOT NULL,
36
+ order_index integer NOT NULL DEFAULT 0
37
+ );
38
+
26
39
  CREATE INDEX bundles_target_app_version_idx ON bundles(target_app_version);
27
40
  CREATE INDEX bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
28
41
  CREATE INDEX bundles_channel_idx ON bundles(channel);
29
42
  CREATE INDEX bundles_rollout_idx ON bundles(rollout_cohort_count);
30
43
  CREATE INDEX bundles_target_cohorts_idx ON bundles USING GIN (target_cohorts);
44
+ CREATE INDEX bundle_patches_bundle_id_idx ON bundle_patches(bundle_id);
45
+ CREATE INDEX bundle_patches_base_bundle_id_idx ON bundle_patches(base_bundle_id);
@@ -157,6 +157,7 @@ const getUpdateInfo = createGetUpdateInfo(db);
157
157
 
158
158
  describe("getUpdateInfo", () => {
159
159
  beforeEach(async () => {
160
+ await db.exec("DELETE FROM bundle_patches");
160
161
  await db.exec("DELETE FROM bundles");
161
162
  });
162
163