29 lines
747 B
JavaScript
29 lines
747 B
JavaScript
const { PrismaPg } = require("@prisma/adapter-pg");
|
|
const { PrismaClient } = require("@prisma/client");
|
|
const { Pool } = require("pg");
|
|
|
|
const connectionString =
|
|
process.env.DATABASE_URL ||
|
|
"postgresql://postgres:postgres@localhost:5432/moh_sass?schema=public";
|
|
|
|
const pool = new Pool({ connectionString });
|
|
const prisma = new PrismaClient({ adapter: new PrismaPg(pool) });
|
|
|
|
async function main() {
|
|
await prisma.appConfig.upsert({
|
|
where: { key: "siteName" },
|
|
update: { value: "moh-sass" },
|
|
create: { key: "siteName", value: "moh-sass" },
|
|
});
|
|
}
|
|
|
|
main()
|
|
.catch((error) => {
|
|
console.error("Seed failed:", error);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
await pool.end();
|
|
});
|