Files
sqlc_example/sqlc/sqlc.yml
Nikolai Papin abd374d63b feat: implement comprehensive recipe management schema
- Add full database schema with accounts, dishes, ingredients, categories, and pricing
- Implement custom types for weight, currency, recipe difficulty, and color hex
- Add soft delete pattern with deleted_at and active views for all tables
- Include journaling triggers for created_at/updated_at automation

feat: add SQLC configuration with proper type overrides
- Configure SQLC to use UUID, decimal, and timestamptz types with proper Go mappings
- Add github.com/shopspring/decimal dependency for precise decimal handling
- Set up proper pointer handling for nullable fields in generated structs

refactor: replace simple food_items with full dish management system
- Remove old FoodItem model and replace with comprehensive Dish model
- Implement dish creation and retrieval queries with full field support
- Add ingredient management with weight/amount tracking

chore: update infrastructure dependencies
- Switch to custom PostgreSQL image with pg_idkit extension for UUIDv7 support
- Add DATABASE_URI environment variable configuration
- Update Docker Compose configuration for new database image

chore: organize SQL with fold markers and section comments
- Add vim fold markers for better code navigation
- Structure schema into clear sections: extensions, types, tables, triggers
- Separate query files with organized comment blocks
2025-10-29 20:49:00 +03:00

65 lines
1.7 KiB
YAML

version: "2"
servers:
- engine: postgresql
uri: "postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable"
sql:
- schema: "schema.sql"
queries: "query.sql"
engine: "postgresql"
gen:
go:
out: "../backend/internal/db"
sql_package: "pgx/v5"
emit_prepared_queries: true
emit_pointers_for_null_types: true
overrides:
- db_type: "color_hex"
nullable: false
go_type:
type: string
- db_type: "color_hex"
nullable: true
go_type:
type: "string"
pointer: true
- db_type: "pg_catalog.numeric"
nullable: false
go_type:
import: "github.com/shopspring/decimal"
type: "Decimal"
pointer: false
- db_type: "pg_catalog.numeric"
nullable: true
go_type:
import: "github.com/shopspring/decimal"
type: "Decimal"
pointer: true
- db_type: "uuid"
nullable: true
go_type:
import: "github.com/google/uuid"
type: "UUID"
pointer: true
- db_type: "uuid"
nullable: false
go_type:
import: "github.com/google/uuid"
type: "UUID"
pointer: false
- db_type: "timestamptz"
nullable: true
go_type:
type: "time.Time"
pointer: true
- db_type: "timestamptz"
nullable: false
go_type:
type: "time.Time"
pointer: false
database:
managed: true
# uri: "postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable"
rules:
- sqlc/db-prepare