From eeae6d3b61da473f3495b596a517b60d3e15ed02 Mon Sep 17 00:00:00 2001 From: Yoginth Date: Thu, 19 Dec 2024 17:52:58 +0530 Subject: [PATCH] Migrate to Lens v3 --- packages/db/package.json | 1 - packages/db/prisma/db/seed/index.ts | 41 ------------------- .../prisma/db/seed/seedAccountPermission.ts | 23 ----------- .../db/prisma/db/seed/seedAccountStatus.ts | 19 --------- .../db/prisma/db/seed/seedAccountTheme.ts | 18 -------- packages/db/prisma/db/seed/seedEmails.ts | 18 -------- packages/db/prisma/db/seed/seedPermissions.ts | 22 ---------- packages/db/prisma/db/seed/seedPreferences.ts | 15 ------- packages/db/prisma/db/seed/seedTokens.ts | 22 ---------- 9 files changed, 179 deletions(-) delete mode 100644 packages/db/prisma/db/seed/index.ts delete mode 100644 packages/db/prisma/db/seed/seedAccountPermission.ts delete mode 100644 packages/db/prisma/db/seed/seedAccountStatus.ts delete mode 100644 packages/db/prisma/db/seed/seedAccountTheme.ts delete mode 100644 packages/db/prisma/db/seed/seedEmails.ts delete mode 100644 packages/db/prisma/db/seed/seedPermissions.ts delete mode 100644 packages/db/prisma/db/seed/seedPreferences.ts delete mode 100644 packages/db/prisma/db/seed/seedTokens.ts diff --git a/packages/db/package.json b/packages/db/package.json index 8b9900ca24b8..fd8aef87b99f 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -9,7 +9,6 @@ "prisma:clean": "prisma migrate reset --schema ./prisma/db/schema.prisma", "prisma:format": "prisma format --schema ./prisma/db/schema.prisma", "prisma:migrate": "prisma migrate dev --schema ./prisma/db/schema.prisma", - "prisma:seed": "ts-node ./prisma/db/seed/index.ts", "typecheck": "tsc --pretty" }, "dependencies": { diff --git a/packages/db/prisma/db/seed/index.ts b/packages/db/prisma/db/seed/index.ts deleted file mode 100644 index 1a5591aa8871..000000000000 --- a/packages/db/prisma/db/seed/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -import prisma from "../client"; -import seedAccountPermission from "./seedAccountPermission"; -import seedAccountStatus from "./seedAccountStatus"; -import seedAccountTheme from "./seedAccountTheme"; -import seedEmails from "./seedEmails"; -import seedPermissions from "./seedPermissions"; -import seedPreferences from "./seedPreferences"; -import seedTokens from "./seedTokens"; - -async function main() { - const preferences = await seedPreferences(); - console.log(`Seeded ${preferences} preferences`); - - const permissions = await seedPermissions(); - console.log(`Seeded ${permissions} permissions`); - - const accountPermission = await seedAccountPermission(); - console.log(`Seeded ${accountPermission} account permissions`); - - const tokens = await seedTokens(); - console.log(`Seeded ${tokens} tokens`); - - const accountStatus = await seedAccountStatus(); - console.log(`Seeded ${accountStatus} account status`); - - const accountTheme = await seedAccountTheme(); - console.log(`Seeded ${accountTheme} account theme`); - - const emails = await seedEmails(); - console.log(`Seeded ${emails} emails`); -} - -main() - .then(async () => { - await prisma.$disconnect(); - }) - .catch(async (error) => { - console.error(error); - await prisma.$disconnect(); - process.exit(1); - }); diff --git a/packages/db/prisma/db/seed/seedAccountPermission.ts b/packages/db/prisma/db/seed/seedAccountPermission.ts deleted file mode 100644 index 935dc44a5f92..000000000000 --- a/packages/db/prisma/db/seed/seedAccountPermission.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { PermissionId } from "@hey/data/permissions"; -import prisma from "../client"; - -const seedAccountPermission = async (): Promise => { - // Delete all profile permissions - await prisma.accountPermission.deleteMany(); - - // Seed profile permissions - const accountPermissions = await prisma.accountPermission.createMany({ - data: [ - { permissionId: PermissionId.Verified, accountAddress: TEST_LENS_ID }, - { permissionId: PermissionId.StaffPick, accountAddress: TEST_LENS_ID }, - { - permissionId: PermissionId.Suspended, - accountAddress: TEST_SUSPENDED_LENS_ID - } - ] - }); - - return accountPermissions.count; -}; - -export default seedAccountPermission; diff --git a/packages/db/prisma/db/seed/seedAccountStatus.ts b/packages/db/prisma/db/seed/seedAccountStatus.ts deleted file mode 100644 index 9287aa06f1d9..000000000000 --- a/packages/db/prisma/db/seed/seedAccountStatus.ts +++ /dev/null @@ -1,19 +0,0 @@ -import prisma from "../client"; - -const seedAccountStatus = async (): Promise => { - // Delete all accountStatus - await prisma.accountStatus.deleteMany(); - - // Seed accountStatus - await prisma.accountStatus.create({ - data: { - accountAddress: TEST_LENS_ID, - emoji: "😀", - message: "Status message" - } - }); - - return 1; -}; - -export default seedAccountStatus; diff --git a/packages/db/prisma/db/seed/seedAccountTheme.ts b/packages/db/prisma/db/seed/seedAccountTheme.ts deleted file mode 100644 index dd1d928bc11f..000000000000 --- a/packages/db/prisma/db/seed/seedAccountTheme.ts +++ /dev/null @@ -1,18 +0,0 @@ -import prisma from "../client"; - -const seedAccountTheme = async (): Promise => { - // Delete all accountTheme - await prisma.accountTheme.deleteMany(); - - // Seed accountTheme - await prisma.accountTheme.createMany({ - data: [ - { accountAddress: TEST_LENS_ID, fontStyle: "bioRhyme" }, - { accountAddress: "0x0d", fontStyle: "bioRhyme" } - ] - }); - - return 1; -}; - -export default seedAccountTheme; diff --git a/packages/db/prisma/db/seed/seedEmails.ts b/packages/db/prisma/db/seed/seedEmails.ts deleted file mode 100644 index ce5980da2467..000000000000 --- a/packages/db/prisma/db/seed/seedEmails.ts +++ /dev/null @@ -1,18 +0,0 @@ -import prisma from "../client"; - -const seedEmails = async (): Promise => { - // Delete all emails - await prisma.email.deleteMany(); - - // Seed emails - const emails = await prisma.email.createMany({ - data: [ - { accountAddress: TEST_LENS_ID, email: "test@hey.xyz", verified: true }, - { accountAddress: "0x0d", email: "hey@yoginth.com", verified: true } - ] - }); - - return emails.count; -}; - -export default seedEmails; diff --git a/packages/db/prisma/db/seed/seedPermissions.ts b/packages/db/prisma/db/seed/seedPermissions.ts deleted file mode 100644 index d3943c1a5279..000000000000 --- a/packages/db/prisma/db/seed/seedPermissions.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Permission, PermissionId } from "@hey/data/permissions"; -import prisma from "../client"; - -const seedPermissions = async (): Promise => { - // Delete all permissions - await prisma.permission.deleteMany(); - - // Seed permissions - const permissions = await prisma.permission.createMany({ - data: [ - { id: PermissionId.CommentSuspended, key: Permission.CommentSuspended }, - { id: PermissionId.Suspended, key: Permission.Suspended }, - { id: PermissionId.Verified, key: Permission.Verified }, - { id: PermissionId.StaffPick, key: Permission.StaffPick }, - { id: PermissionId.Beta, key: Permission.Beta } - ] - }); - - return permissions.count; -}; - -export default seedPermissions; diff --git a/packages/db/prisma/db/seed/seedPreferences.ts b/packages/db/prisma/db/seed/seedPreferences.ts deleted file mode 100644 index f0d2f93aea1c..000000000000 --- a/packages/db/prisma/db/seed/seedPreferences.ts +++ /dev/null @@ -1,15 +0,0 @@ -import prisma from "../client"; - -const seedPreferences = async (): Promise => { - // Delete all preferences - await prisma.preference.deleteMany(); - - // Seed preferences - const preferences = await prisma.preference.createMany({ - data: [{ accountAddress: TEST_LENS_ID }] - }); - - return preferences.count; -}; - -export default seedPreferences; diff --git a/packages/db/prisma/db/seed/seedTokens.ts b/packages/db/prisma/db/seed/seedTokens.ts deleted file mode 100644 index c306c68f5096..000000000000 --- a/packages/db/prisma/db/seed/seedTokens.ts +++ /dev/null @@ -1,22 +0,0 @@ -import prisma from "../client"; - -const seedTokens = async (): Promise => { - // Delete all allowedToken - await prisma.allowedToken.deleteMany(); - - // Seed allowedToken - const allowedTokens = await prisma.allowedToken.createMany({ - data: [ - { - contractAddress: "0x3d2bD0e15829AA5C362a4144FdF4A1112fa29B5c", - name: "Bonsai", - symbol: "BONSAI", - decimals: 18 - } - ] - }); - - return allowedTokens.count; -}; - -export default seedTokens;