Files
advx/prisma/migrations/[timestamp]_create_configuracao_documento.ts
rodrigo 5acec6b71e Lint errors
Signed-off-by: Rodrigo Martins <rodrigo.sousa.577@gmail.com>
2025-04-12 20:32:39 -03:00

35 lines
794 B
TypeScript

import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
async function main() {
await prisma.$executeRaw`
CREATE TABLE IF NOT EXISTS "configuracao_documento" (
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
"headerImageUrl" TEXT,
"footerImageUrl" TEXT,
"logoUrl" TEXT,
"criadoEm" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "configuracao_documento_pkey" PRIMARY KEY ("id")
);
`;
// Inserir configuração padrão
await prisma.configuracaoDocumento.create({
data: {
headerImageUrl: "",
footerImageUrl: "",
logoUrl: "",
},
});
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});