Prisma Init

This commit is contained in:
Myle
2026-09-21 15:23:23 +03:00
parent d7cf735beb
commit b7154a3ca3
105 changed files with 12866 additions and 43 deletions
+35
View File
@@ -0,0 +1,35 @@
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "../src/generated/prisma/client.js";
const connectionString = process.env.DATABASE_URL;
if (!connectionString) {
throw new Error("DATABASE_URL is not set");
}
const prisma = new PrismaClient({
adapter: new PrismaPg({ connectionString }),
});
const PROFILE_ID = "00000000-0000-4000-8000-000000000001";
const profile = {
name: "Whoami",
description: "Seeded profile",
};
async function main() {
await prisma.profile.upsert({
where: { id: PROFILE_ID },
create: {
id: PROFILE_ID,
...profile,
},
update: profile,
});
}
try {
await main();
} finally {
await prisma.$disconnect();
}