Helix
Helix
Explore posts from servers
PPrisma
Created by Helix on 11/18/2024 in #help-and-questions
Two Schemas but only one will stay generated at a time
I figured it out!
10 replies
PPrisma
Created by Helix on 11/18/2024 in #help-and-questions
Two Schemas but only one will stay generated at a time
export const aero_db = new PrismaClient({
datasources: { db: { url: env.DATABASE_URL } },
});
export const alec_site_db = new PrismaClient({
datasources: { db: { url: env.ALEC_SITE_DB_URL } },
});
export const aero_db = new PrismaClient({
datasources: { db: { url: env.DATABASE_URL } },
});
export const alec_site_db = new PrismaClient({
datasources: { db: { url: env.ALEC_SITE_DB_URL } },
});
this is the prisma clients
10 replies
PPrisma
Created by Helix on 11/18/2024 in #help-and-questions
Two Schemas but only one will stay generated at a time
// schema1.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "prismaSchemaFolder", "multiSchema"]
output = "../node_modules/@internal/prisma-first/client"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}

// schema2.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "prismaSchemaFolder", "multiSchema"]
output = "../node_modules/@internal/prisma-second/client"
}

datasource db {
provider = "mysql"
url = env("ALEC_SITE_DB_URL")
}
// schema1.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "prismaSchemaFolder", "multiSchema"]
output = "../node_modules/@internal/prisma-first/client"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}

// schema2.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "prismaSchemaFolder", "multiSchema"]
output = "../node_modules/@internal/prisma-second/client"
}

datasource db {
provider = "mysql"
url = env("ALEC_SITE_DB_URL")
}
I have two different database schemas one called aero and one called alec_site that I'm trying to connect to, aero contains the user data & app specific data where alec_site contains other data that I need. I'm not getting any specific errors besides Property 'vendor_id_walmart' does not exist on type 'PrismaClient<{ datasources: { db: { url: string; }; }; }, never, DefaultArgs>'. for the alec_site db.
10 replies
PPrisma
Created by Helix on 11/18/2024 in #help-and-questions
Two Schemas but only one will stay generated at a time
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "prismaSchemaFolder", "multiSchema"]
output = "../node_modules/@internal/prisma-second/client"
}

datasource db {
provider = "mysql"
url = env("ALEC_SITE_DB_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "prismaSchemaFolder", "multiSchema"]
output = "../node_modules/@internal/prisma-second/client"
}

datasource db {
provider = "mysql"
url = env("ALEC_SITE_DB_URL")
}
10 replies
PPrisma
Created by Helix on 11/18/2024 in #help-and-questions
Two Schemas but only one will stay generated at a time
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "prismaSchemaFolder", "multiSchema"]
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "prismaSchemaFolder", "multiSchema"]
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
10 replies
PPrisma
Created by Helix on 11/18/2024 in #help-and-questions
Two Schemas but only one will stay generated at a time
import { PrismaClient } from "@prisma/client";

import { env } from "@/env";
const createPrismaClient = (url: string) =>
new PrismaClient({
log:
env.NODE_ENV === "development"
? ["query", "error", "warn"]
: ["error"],
datasources: {
db: {
url: url,
},
},
});

const globalForPrisma = globalThis as unknown as {
prisma: ReturnType<typeof createPrismaClient> | undefined;
};

export const aero_db =
globalForPrisma.prisma ?? createPrismaClient(env.DATABASE_URL);
export const alec_site_db = createPrismaClient(env.ALEC_SITE_DB_URL);

if (env.NODE_ENV !== "production") globalForPrisma.prisma = aero_db;
import { PrismaClient } from "@prisma/client";

import { env } from "@/env";
const createPrismaClient = (url: string) =>
new PrismaClient({
log:
env.NODE_ENV === "development"
? ["query", "error", "warn"]
: ["error"],
datasources: {
db: {
url: url,
},
},
});

const globalForPrisma = globalThis as unknown as {
prisma: ReturnType<typeof createPrismaClient> | undefined;
};

export const aero_db =
globalForPrisma.prisma ?? createPrismaClient(env.DATABASE_URL);
export const alec_site_db = createPrismaClient(env.ALEC_SITE_DB_URL);

if (env.NODE_ENV !== "production") globalForPrisma.prisma = aero_db;
10 replies