* Add lint/format checks to the Gitea release workflow and Makefile (targets: vet, fmt, fmt-check, staticcheck, govulncheck, check) * Switch .golangci.json formatter from gofmt to gofumpt (extra.group-params) * Bump golang.org/x/text 0.37.0 -> 0.39.0 for GO-2026-5970; re-vendor * Fix staticcheck S1011 in pkg/diff; drop unused pgsql writer helpers * Fix gocritic unnamedResult (pkg/diff) and rangeValCopy (pkg/pgsql) * Apply gofumpt + goimports formatting across the tree
Prisma Reader
Reads Prisma schema files and extracts database schema information.
Overview
The Prisma Reader parses .prisma schema files that define database models using Prisma's schema language and converts them into RelSpec's internal database model representation.
Features
- Parses Prisma schema syntax
- Extracts models, fields, and relationships
- Supports Prisma attributes and directives
- Handles enums and composite types
Usage
Basic Example
package main
import (
"fmt"
"git.warky.dev/wdevs/relspecgo/pkg/readers"
"git.warky.dev/wdevs/relspecgo/pkg/readers/prisma"
)
func main() {
options := &readers.ReaderOptions{
FilePath: "/path/to/schema.prisma",
}
reader := prisma.NewReader(options)
db, err := reader.ReadDatabase()
if err != nil {
panic(err)
}
fmt.Printf("Found %d schemas\n", len(db.Schemas))
}
CLI Example
# Read Prisma schema and convert to JSON
relspec --input prisma --in-file schema.prisma --output json --out-file schema.json
# Convert Prisma to GORM models
relspec --input prisma --in-file schema.prisma --output gorm --out-file models.go
Example Prisma Schema
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
username String @unique @db.VarChar(50)
email String @db.VarChar(100)
createdAt DateTime @default(now()) @map("created_at")
posts Post[]
@@map("users")
}
model Post {
id Int @id @default(autoincrement())
userId Int @map("user_id")
title String @db.VarChar(200)
content String @db.Text
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@map("posts")
}
Supported Prisma Attributes
@id- Primary key@unique- Unique constraint@default- Default value@map- Column name mapping@@map- Table name mapping@relation- Relationship definition@db.*- Database-specific type annotations
Notes
- Extracts datasource provider information
- Supports
@@mapfor custom table names - Handles Prisma-specific types and converts them to standard SQL types