Skip to content

Commit

Permalink
ar(feat) DPCP-13: Get seed to work
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloreale committed Jul 13, 2024
1 parent 4e58941 commit 7dbc2a6
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ export {

/* rm-decorators */
export { decorateRMCharacters } from './decorators';

/* prisma */
export { default as PrivatePrisma } from './prisma-private-connector';
export { default as PublicPrisma } from './prisma-public-connector';
15 changes: 15 additions & 0 deletions lib/model/prisma-private-connector.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { PrismaClient as PrivatePrisma } from '@dreampipcom/db-private/prisma-client';

const prismaClientSingleton = () => {
return new PrivatePrisma();
};

declare const globalThis: {
prismaPrivateGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

const privatePrisma = globalThis.prismaPrivateGlobal ?? prismaClientSingleton();

export default privatePrisma;

if (process.env.NODE_ENV !== 'production') globalThis.prismaPrivateGlobal = privatePrisma;
15 changes: 15 additions & 0 deletions lib/model/prisma-public-connector.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { PrismaClient as PublicPrisma } from '@dreampipcom/db-public/prisma-client';

const prismaClientSingleton = () => {
return new PublicPrisma();
};

declare const globalThis: {
prismaPublicGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

const publicPrisma = globalThis.prismaPublicGlobal ?? prismaClientSingleton();

export default publicPrisma;

if (process.env.NODE_ENV !== 'production') globalThis.prismaPublicGlobal = publicPrisma;
2 changes: 1 addition & 1 deletion prisma/getSeeds.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// getSeeds.ts
import { PrismaClient as PrivatePrisma } from '@huntydev/db-private/prisma-client';
import { PrismaClient as PrivatePrisma } from '@dreampipcom/db-private/prisma-client';

import fs from 'node:fs';

Expand Down
2 changes: 1 addition & 1 deletion prisma/schema-private.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
generator client {
provider = "prisma-client-js"
output = "../node_modules/@huntydev/db-private/prisma-client"
output = "../node_modules/@dreampipcom/db-private/prisma-client"
}

datasource db {
Expand Down
2 changes: 1 addition & 1 deletion prisma/schema-public.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
generator client {
provider = "prisma-client-js"
output = "../node_modules/@huntydev/db-public/prisma-client"
output = "../node_modules/@dreampipcom/db-public/prisma-client"
}

datasource db {
Expand Down

0 comments on commit 7dbc2a6

Please sign in to comment.