feat(checklist): exibe descricao do template e do item no ticket
- Adiciona campo templateDescription ao schema do checklist - Copia descricao do template ao aplicar checklist no ticket - Exibe ambas descricoes na visualizacao do ticket (template em italico) - Adiciona documentacao de desenvolvimento local (docs/LOCAL-DEV.md) - Corrige prisma-client.mjs para usar PostgreSQL em vez de SQLite 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6430d33c7c
commit
6e8a6fe890
8 changed files with 212 additions and 71 deletions
|
|
@ -1,63 +1,24 @@
|
|||
import path from "node:path"
|
||||
import pg from "pg"
|
||||
|
||||
// NOTE: This helper imports the generated Prisma client from TypeScript files.
|
||||
// Run scripts that rely on it via a transpiling runner (e.g. `tsx` or Bun).
|
||||
import { PrismaClient } from "../../src/generated/prisma/client.ts"
|
||||
import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3"
|
||||
import { PrismaPg } from "@prisma/adapter-pg"
|
||||
|
||||
const PROJECT_ROOT = process.cwd()
|
||||
const PRISMA_DIR = path.join(PROJECT_ROOT, "prisma")
|
||||
|
||||
function resolveFileUrl(url) {
|
||||
if (!url.startsWith("file:")) {
|
||||
return url
|
||||
}
|
||||
|
||||
const filePath = url.slice("file:".length)
|
||||
|
||||
if (filePath.startsWith("//")) {
|
||||
return url
|
||||
}
|
||||
|
||||
if (path.isAbsolute(filePath)) {
|
||||
return `file:${path.normalize(filePath)}`
|
||||
}
|
||||
|
||||
const normalized = path.normalize(filePath)
|
||||
const prismaPrefix = `prisma${path.sep}`
|
||||
const relativeToPrisma = normalized.startsWith(prismaPrefix)
|
||||
? normalized.slice(prismaPrefix.length)
|
||||
: normalized
|
||||
|
||||
const absolutePath = path.resolve(PRISMA_DIR, relativeToPrisma)
|
||||
|
||||
if (!absolutePath.startsWith(PROJECT_ROOT)) {
|
||||
throw new Error(`DATABASE_URL path escapes project directory: ${filePath}`)
|
||||
}
|
||||
|
||||
return `file:${absolutePath}`
|
||||
}
|
||||
|
||||
function normalizeDatasourceUrl(envUrl) {
|
||||
const trimmed = envUrl?.trim()
|
||||
if (trimmed) {
|
||||
return resolveFileUrl(trimmed)
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
return "file:/app/data/db.sqlite"
|
||||
}
|
||||
|
||||
return resolveFileUrl("file:./db.dev.sqlite")
|
||||
}
|
||||
const { Pool } = pg
|
||||
|
||||
export function createPrismaClient() {
|
||||
const resolvedDatabaseUrl = normalizeDatasourceUrl(process.env.DATABASE_URL)
|
||||
process.env.DATABASE_URL = resolvedDatabaseUrl
|
||||
const databaseUrl = process.env.DATABASE_URL
|
||||
|
||||
const adapter = new PrismaBetterSqlite3({
|
||||
url: resolvedDatabaseUrl,
|
||||
if (!databaseUrl) {
|
||||
throw new Error("DATABASE_URL environment variable is required")
|
||||
}
|
||||
|
||||
const pool = new Pool({
|
||||
connectionString: databaseUrl,
|
||||
})
|
||||
|
||||
const adapter = new PrismaPg(pool)
|
||||
|
||||
return new PrismaClient({ adapter })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue