Skip to content

Commit

Permalink
add migration and adapt filter
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns committed Nov 21, 2024
1 parent fa0e30e commit a32a6fb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/pool/lib/pool-gql-loader.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ export class PoolGqlLoaderService {
...(where?.hasHook !== undefined && where.hasHook
? { hook: { not: {} } }
: where?.hasHook !== undefined && !where.hasHook
? { hook: { equals: {} } }
? { hook: { equals: Prisma.DbNull } }
: {}),
};

Expand Down
7 changes: 6 additions & 1 deletion modules/pool/pool-debug.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ContentController } from '../controllers/content-controller';
import { chainToIdMap } from '../network/network-config';
import { PoolController } from '../controllers';
import { GqlPoolComposableStable, GqlPoolStable } from '../../schema';
import { Prisma } from '@prisma/client';
describe('pool debugging', () => {
it('query pools', async () => {
initRequestScopedContext();
Expand Down Expand Up @@ -372,7 +373,11 @@ describe('pool debugging', () => {
});

const poolsWithoutHooks = await prisma.prismaPool.findMany({
where: { chain: 'SEPOLIA', protocolVersion: 3, hook: { equals: {} } },
where: { chain: 'SEPOLIA', protocolVersion: 3, hook: { equals: Prisma.AnyNull } },
});

const poolsWithHooks = await prisma.prismaPool.findMany({
where: { chain: 'SEPOLIA', protocolVersion: 3, hook: { not: {} } },
});

console.log(gqlPoolsWithHooks.length);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Warnings:
- You are about to drop the column `hookId` on the `PrismaPool` table. All the data in the column will be lost.
- You are about to drop the `PrismaHook` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `PrismaHookReviewData` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "PrismaHookReviewData" DROP CONSTRAINT "PrismaHookReviewData_chain_hookAddress_fkey";

-- DropForeignKey
ALTER TABLE "PrismaPool" DROP CONSTRAINT "PrismaPool_hookId_fkey";

-- AlterTable
ALTER TABLE "PrismaPool" DROP COLUMN "hookId",
ADD COLUMN "hook" JSONB;

-- DropTable
DROP TABLE "PrismaHook";

-- DropTable
DROP TABLE "PrismaHookReviewData";

0 comments on commit a32a6fb

Please sign in to comment.