Files
advx/prisma/migrations/[timestamp]_create_configuracao_documento.ts
2025-04-10 23:07:21 -03:00

35 lines
788 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();
});