Skip to content

Commit e1a40c3

Browse files
committed
local migrations
1 parent d0580a0 commit e1a40c3

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

apps/roam/src/utils/fireQuery.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ const fireQuery: FireQuery = async (_args) => {
352352
}
353353

354354
let queryResults: unknown[][] = [];
355-
console.log("local", local);
356355
if (local) {
357356
// look for propNames in query. Could consider looking only in pull when that exists.
358357
const propNames = new Set(

apps/roam/src/utils/getRelationData.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ import type { DiscourseRelation } from "./getDiscourseRelations";
55

66
// lifted from getExportTypes
77

8-
export const getRelationDataUtil = async (
9-
allRelations: DiscourseRelation[],
10-
nodeLabelByType: Record<string, string>,
11-
) =>
8+
export const getRelationDataUtil = async ({
9+
allRelations,
10+
nodeLabelByType,
11+
local,
12+
}: {
13+
allRelations: DiscourseRelation[];
14+
nodeLabelByType: Record<string, string>;
15+
local?: boolean;
16+
}) =>
1217
Promise.all(
1318
allRelations
1419
.filter(
@@ -23,6 +28,7 @@ export const getRelationDataUtil = async (
2328
? []
2429
: fireQuery({
2530
returnNode: sourceLabel,
31+
local,
2632
conditions: [
2733
{
2834
relation: s.label,
@@ -50,13 +56,13 @@ export const getRelationDataUtil = async (
5056
}),
5157
).then((r) => r.flat());
5258

53-
const getRelationData = async () => {
59+
const getRelationData = async (local?: boolean) => {
5460
const allRelations = getDiscourseRelations();
5561
const allNodes = getDiscourseNodes(allRelations);
5662
const nodeLabelByType = Object.fromEntries(
5763
allNodes.map((a) => [a.type, a.text]),
5864
);
59-
return await getRelationDataUtil(allRelations, nodeLabelByType);
65+
return await getRelationDataUtil({ allRelations, nodeLabelByType, local });
6066
};
6167

6268
export default getRelationData;

apps/roam/src/utils/migrateRelations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const migrateRelations = async (dryRun = false): Promise<number> => {
1414
const authorized = getSetting("use-reified-relations");
1515
if (!authorized) return 0;
1616
const processed = new Set<string>();
17-
const relationData = await getRelationData();
17+
const relationData = await getRelationData(true);
1818
let numProcessed = 0;
1919
for (const rel of relationData) {
2020
const key = `${rel.source}:${rel.relUid}:${rel.target}`;

0 commit comments

Comments
 (0)