feat(writers): stamp RelSpec version in generated headers; preserve DBML column order
- Add pkg/buildinfo with Version/BuildDate (set via ldflags, VCS fallback); cmd/relspec now sources version info from it - Emit "RelSpec <version> (built: <date>)" in generated file headers for bun, gorm, drizzle, pgsql (incl. migration), mssql, sqlite writers - pgsql writer: getSortedColumns now sorts by Sequence then Name so the streaming WriteSchema/WriteDatabase path preserves source column order - dbml reader: mergeTable re-bases merged-in column Sequence values past the existing max, fixing colliding sequences (and alphabetical fallback) when a table is split across multiple DBML files - Tests for bun/gorm header + column order, and dbml multi-file merge ordering
This commit is contained in:
@@ -4,14 +4,16 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"git.warky.dev/wdevs/relspecgo/pkg/buildinfo"
|
||||
"git.warky.dev/wdevs/relspecgo/pkg/models"
|
||||
)
|
||||
|
||||
// TemplateData represents the data passed to the template for code generation
|
||||
type TemplateData struct {
|
||||
Imports []string
|
||||
Enums []*EnumData
|
||||
Tables []*TableData
|
||||
GeneratedBy string
|
||||
Imports []string
|
||||
Enums []*EnumData
|
||||
Tables []*TableData
|
||||
}
|
||||
|
||||
// EnumData represents an enum in the schema
|
||||
@@ -59,7 +61,8 @@ type IndexData struct {
|
||||
// NewTemplateData creates a new TemplateData
|
||||
func NewTemplateData() *TemplateData {
|
||||
return &TemplateData{
|
||||
Imports: make([]string, 0),
|
||||
GeneratedBy: buildinfo.GeneratedComment(),
|
||||
Imports: make([]string, 0),
|
||||
Enums: make([]*EnumData, 0),
|
||||
Tables: make([]*TableData, 0),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user