Difficulties migrating PostgreSQL to v7.0.0

Hello, PS: Im using PostgreSQL v17.5 I am trying to upgrade from PrismaORM v6.5 to v7 and im finding the following error:
node:internal/modules/esm/resolve:274
throw new ERR_MODULE_NOT_FOUND(
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/<username>/repos/server/server/config/generated/prisma/client/enums' imported from /Users/<username>/repos/server/server/config/generated/prisma/client/client.ts
node:internal/modules/esm/resolve:274
throw new ERR_MODULE_NOT_FOUND(
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/<username>/repos/server/server/config/generated/prisma/client/enums' imported from /Users/<username>/repos/server/server/config/generated/prisma/client/client.ts
My current setup is: prisma.config.ts
prisma.config.ts
import { defineConfig, env } from "prisma/config";

export default defineConfig({
schema: './schema.prisma',
migrations: {
path: './migrations',
seed: 'tsx prisma/seed.ts',
},
datasource: {
url: env("PRISMA_POSTGRES_DIRECT_URL"),
}
});
prisma.config.ts
import { defineConfig, env } from "prisma/config";

export default defineConfig({
schema: './schema.prisma',
migrations: {
path: './migrations',
seed: 'tsx prisma/seed.ts',
},
datasource: {
url: env("PRISMA_POSTGRES_DIRECT_URL"),
}
});
prisma.schema
generator client {
provider = "prisma-client"
output = "../server/config/generated/prisma/client"
}

datasource db {
provider = "postgresql"
}
generator client {
provider = "prisma-client"
output = "../server/config/generated/prisma/client"
}

datasource db {
provider = "postgresql"
}
example implementation on userModel.js
import { PrismaClient } from '../config/generated/prisma/client/index.js';

const prisma = new PrismaClient();

export const createCustomerInDB = async (userData) => {
const createUserInDbQuery = await prisma.user.create({
data: {
email: userData.username,
password: userData.password,
role: userData.role,
},
Company: {
create: {
},
},
},
});
import { PrismaClient } from '../config/generated/prisma/client/index.js';

const prisma = new PrismaClient();

export const createCustomerInDB = async (userData) => {
const createUserInDbQuery = await prisma.user.create({
data: {
email: userData.username,
password: userData.password,
role: userData.role,
},
Company: {
create: {
},
},
},
});
Im trying to follow the prisma-provided migration guide but i dont think im successfully doing so files: * schema.prisma * prisma.config.ts are located in ./prisma
Upgrade to Prisma ORM 7 | Prisma Documentation
Guide on how to upgrade to Prisma ORM 7
No description
2 Replies
SergioNR
SergioNROP2w ago
@Prisma AI Help hi
Nurul
Nurul2w ago
In prisma.config.ts you need to import dotenv first to make sure that env variables are loaded. You seem to be missing that
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
// the main entry for your schema
schema: 'prisma/schema.prisma',
// where migrations should be generated
// what script to run for "prisma db seed"
migrations: {
path: 'prisma/migrations',
seed: 'tsx prisma/seed.ts',
},
// The database URL
datasource: {
// Type Safe env() helper
// Does not replace the need for dotenv
url: env('DATABASE_URL'),
},
})
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
// the main entry for your schema
schema: 'prisma/schema.prisma',
// where migrations should be generated
// what script to run for "prisma db seed"
migrations: {
path: 'prisma/migrations',
seed: 'tsx prisma/seed.ts',
},
// The database URL
datasource: {
// Type Safe env() helper
// Does not replace the need for dotenv
url: env('DATABASE_URL'),
},
})
After this did you run npx prisma generate?

Did you find this page helpful?