Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

use loop, log, fix timeout

Roman Pominovd442e1ee8a83
diff --git a/packages/prisma-client/prisma/migrations/20220909124542_builds-data/migration.ts b/packages/prisma-client/prisma/migrations/20220909124542_builds-data/migration.ts
index a6c17de323..382918738f 100644
--- a/packages/prisma-client/prisma/migrations/20220909124542_builds-data/migration.ts
+++ b/packages/prisma-client/prisma/migrations/20220909124542_builds-data/migration.ts
@@ -66,6 +66,6 @@ export default () => {
await prisma.build.createMany({ data: builds });
},
- { timeout: 1000 * 60 * 15 }
+ { timeout: 1000 * 60 }
);
};
diff --git a/packages/prisma-client/prisma/migrations/20220915144008_breakpoints-build_data/migration.ts b/packages/prisma-client/prisma/migrations/20220915144008_breakpoints-build_data/migration.ts
index cc77482ba2..10d1654800 100644
--- a/packages/prisma-client/prisma/migrations/20220915144008_breakpoints-build_data/migration.ts
+++ b/packages/prisma-client/prisma/migrations/20220915144008_breakpoints-build_data/migration.ts
@@ -30,32 +30,58 @@ export default () => {
pages: PagesSchema.parse(JSON.parse(build.pages)),
}));
- await Promise.all(
- breakpoints.map((breakpoint) => {
- const build = buildsParsed.find(
- (build) => build.pages.homePage.treeId === breakpoint.treeId
- );
+ // await Promise.all(
+ // breakpoints.map((breakpoint) => {
+ // const build = buildsParsed.find(
+ // (build) => build.pages.homePage.treeId === breakpoint.treeId
+ // );
+
+ // if (build === undefined) {
+ // // eslint-disable-next-line no-console
+ // console.warn(
+ // `Build not found for breakpoint ${breakpoint.treeId}. Deleting!`
+ // );
- if (build === undefined) {
- // eslint-disable-next-line no-console
- console.warn(
- `Build not found for breakpoint ${breakpoint.treeId}. Deleting!`
- );
+ // return prisma.breakpoints.delete({
+ // where: { treeId: breakpoint.treeId },
+ // });
+ // }
- return prisma.breakpoints.delete({
- where: { treeId: breakpoint.treeId },
- });
- }
+ // return prisma.breakpoints.update({
+ // where: { treeId: breakpoint.treeId },
+ // data: {
+ // buildId: build.id,
+ // },
+ // });
+ // })
+ // );
- return prisma.breakpoints.update({
+ for (const breakpoint of breakpoints) {
+ const build = buildsParsed.find(
+ (build) => build.pages.homePage.treeId === breakpoint.treeId
+ );
+
+ if (build === undefined) {
+ // eslint-disable-next-line no-console
+ console.warn(
+ `Build not found for breakpoint ${breakpoint.treeId}. Deleting!`
+ );
+
+ await prisma.breakpoints.delete({
+ where: { treeId: breakpoint.treeId },
+ });
+ } else {
+ // eslint-disable-next-line no-console
+ console.log(`Updating breakpoint ${breakpoint.treeId}`);
+ await prisma.breakpoints.update({
where: { treeId: breakpoint.treeId },
data: {
buildId: build.id,
},
});
- })
- );
+ }
+ }
},
- { timeout: 1000 * 60 }
+ { timeout: 1000 * 60 * 15 }
);
};