The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Migrate OAuthAuthorizedApp to InstalledIntegration
Kiran K06e7ebb1c327
diff --git a/apps/web/scripts/migrate-integrations.ts b/apps/web/scripts/migrate-integrations.tsindex 3c8f6cb796..4e4bc5bdf4 100644--- a/apps/web/scripts/migrate-integrations.ts+++ b/apps/web/scripts/migrate-integrations.ts@@ -2,43 +2,70 @@ import { prisma } from "@/lib/prisma";import "dotenv-flow/config";async function main() {- const oAuthApps = await prisma.oAuthApp.findMany({- select: {- name: true,- slug: true,- description: true,- readme: true,- developer: true,- website: true,- logo: true,- screenshots: true,- userId: true,- projectId: true,- verified: true,- createdAt: true,- updatedAt: true,- },- });-- for (const oAuthApp of oAuthApps) {- const data = {- ...oAuthApp,- screenshots: oAuthApp.screenshots ? oAuthApp.screenshots : [],- };-- // Create the integration- // @ts-ignore- const integration = await prisma.integration.create({ data });-- // Update the oAuthApp with the new integrationId- await prisma.oAuthApp.update({- // @ts-ignore- where: { slug: oAuthApp.slug },- data: { integrationId: integration.id },- });- }-- console.log("Migrated integrations");+ // Step 1: Migrate OAuthApps to Integrations+ // const oAuthApps = await prisma.oAuthApp.findMany({+ // select: {+ // id: true,+ // name: true,+ // slug: true,+ // description: true,+ // readme: true,+ // developer: true,+ // website: true,+ // logo: true,+ // screenshots: true,+ // userId: true,+ // projectId: true,+ // verified: true,+ // createdAt: true,+ // updatedAt: true,+ // },+ // });++ // for (const oAuthApp of oAuthApps) {+ // const data = {+ // ...oAuthApp,+ // screenshots: oAuthApp.screenshots ? oAuthApp.screenshots : [],+ // };++ // const integration = await prisma.integration.create({ data });++ // await prisma.oAuthApp.update({+ // where: { slug: oAuthApp.slug },+ // data: { integrationId: integration.id },+ // });+ // }++ // ----------------------------++ // Step 2: Migrate OAuthAuthorizedApp to InstalledIntegration+ // const authorizedApps = await prisma.oAuthAuthorizedApp.findMany({+ // select: {+ // id: true,+ // userId: true,+ // clientId: true,+ // projectId: true,+ // createdAt: true,+ // oAuthApp: {+ // select: {+ // id: true,+ // },+ // },+ // },+ // });++ // for (const authorizedApp of authorizedApps) {+ // await prisma.installedIntegration.create({+ // data: {+ // id: authorizedApp.id,+ // integrationId: authorizedApp.oAuthApp.id,+ // projectId: authorizedApp.projectId,+ // userId: authorizedApp.userId,+ // createdAt: authorizedApp.createdAt,+ // updatedAt: authorizedApp.createdAt,+ // },+ // });+ // }}main();