Files
prosapp-migration/backend/prisma/migrations/0002_add_message_logs/migration.sql
T
Lizandro GuarnizoandClaude Sonnet 4.6 1e63ed1873 feat(db): idempotent migrations + auto-deploy on startup
- Rewrite 0000_init with IF NOT EXISTS on all tables, indexes and enums;
  wrap FK constraints in DO/EXCEPTION blocks so re-runs never fail
- Add missing suggestions table to init migration
- Add migration 0002 to create message_logs table (IF NOT EXISTS)
- Add entrypoint.sh: runs prisma migrate deploy before starting the server
- Update Dockerfile to copy entrypoint.sh and use it as CMD
- Add prisma:migrate script to package.json for manual runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 13:10:33 -05:00

13 lines
390 B
SQL

-- CreateTable
CREATE TABLE IF NOT EXISTS "message_logs" (
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
"channel" VARCHAR(10) NOT NULL,
"recipient" VARCHAR(255) NOT NULL,
"body" TEXT NOT NULL,
"status" VARCHAR(20) NOT NULL,
"error" TEXT,
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "message_logs_pkey" PRIMARY KEY ("id")
);