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>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
749a1e860d
commit
1e63ed1873
@@ -194,10 +194,10 @@ model suggestions {
|
||||
|
||||
model message_logs {
|
||||
id String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
|
||||
channel String @db.VarChar(10) // 'sms' | 'email'
|
||||
channel String @db.VarChar(10)
|
||||
recipient String @db.VarChar(255)
|
||||
body String
|
||||
status String @db.VarChar(20) // 'sent' | 'error'
|
||||
status String @db.VarChar(20)
|
||||
error String?
|
||||
created_at DateTime @default(now()) @db.Timestamptz(6)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user