Bugs Fixed
Some checks are pending
CI / Test (1.23) (push) Waiting to run
CI / Test (1.24) (push) Waiting to run
CI / Test (1.25) (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Build (push) Waiting to run

1. pkg/models/models.go:184 - Fixed typo in ForeignKeyConstraint constant from "foreign_Key" to "foreign_key"
  2. pkg/readers/drawdb/reader.go:62-68 - Fixed ReadSchema() to properly detect schema name from tables instead of hardcoding "default"
  3. pkg/writers/dbml/writer.go:128 - Changed primary key attribute from "primary key" to DBML standard "pk"
  4. pkg/writers/dbml/writer.go:208-221 - Fixed foreign key reference format to use "table.column" syntax for single columns instead of "table.(column)"

  Test Results

  All reader and writer tests are now passing:

  Readers:
  - DBML: 74.4% coverage (2 tests skipped due to missing parser features for Ref statements)
  - DCTX: 77.6% coverage
  - DrawDB: 83.6% coverage
  - JSON: 82.1% coverage
  - YAML: 82.1% coverage

  Writers:
  - Bun: 68.5% coverage
  - DBML: 91.5% coverage
  - DCTX: 100.0% coverage
  - DrawDB: 83.8% coverage
  - GORM: 69.2% coverage
  - JSON: 82.4% coverage
  - YAML: 82.4% coverage
This commit is contained in:
2025-12-16 21:43:45 +02:00
parent 7c7054d2e2
commit 5d60bc3b2c
41 changed files with 6466 additions and 634 deletions

View File

@@ -1,83 +1,77 @@
package models_bun
import "fmt"
import db "github.com/bitechdev/GoCore/pkg/models"
import "github.com/bitechdev/GoCore/pkg/types"
import "github.com/uptrace/bun"
import resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/common"
// //ModelCoreProcess - Generated Table for Schema core
// type ModelCoreProcess struct {
// bun.BaseModel `bun:"table:core.process,alias:process"`
// Completedate resolvespec_common.SqlDate `json:"completedate" bun:"completedate,type:date,"`
// Completetime types.CustomIntTime `json:"completetime" bun:"completetime,type:integer,"`
// Description resolvespec_common.SqlString `json:"description" bun:"description,type:citext,"`
// GUID resolvespec_common.SqlUUID `json:"guid" bun:"guid,type:uuid,default:newid(),"`
// Ridcompleteuser resolvespec_common.SqlInt32 `json:"rid_completeuser" bun:"rid_completeuser,type:integer,"`
// Ridhub resolvespec_common.SqlInt32 `json:"rid_hub" bun:"rid_hub,type:integer,"`
// Ridmasterprocess resolvespec_common.SqlInt32 `json:"rid_masterprocess" bun:"rid_masterprocess,type:integer,"`
// Ridprocess resolvespec_common.SqlInt32 `json:"rid_process" bun:"rid_process,type:integer,pk,default:nextval('core.identity_process_rid_process'::regclass),"`
// Status resolvespec_common.SqlString `json:"status" bun:"status,type:citext,"`
// Updatecnt int64 `json:"updatecnt" bun:"updatecnt,type:integer,default:0,"`
// HUB *ModelCoreHub `json:"HUB,omitempty" bun:"rel:has-one,join:rid_hub=rid_hub"`
// MPR *ModelCoreMasterprocess `json:"MPR,omitempty" bun:"rel:has-one,join:rid_masterprocess=rid_masterprocess"`
//ModelCoreProcess - Generated Table for Schema core
type ModelCoreProcess struct {
bun.BaseModel `bun:"table:core.process,alias:process"`
Completedate resolvespec_common.SqlDate `json:"completedate" bun:"completedate,type:date,"`
Completetime types.CustomIntTime `json:"completetime" bun:"completetime,type:integer,"`
Description resolvespec_common.SqlString `json:"description" bun:"description,type:citext,"`
GUID resolvespec_common.SqlUUID `json:"guid" bun:"guid,type:uuid,default:newid(),"`
Ridcompleteuser resolvespec_common.SqlInt32 `json:"rid_completeuser" bun:"rid_completeuser,type:integer,"`
Ridhub resolvespec_common.SqlInt32 `json:"rid_hub" bun:"rid_hub,type:integer,"`
Ridmasterprocess resolvespec_common.SqlInt32 `json:"rid_masterprocess" bun:"rid_masterprocess,type:integer,"`
Ridprocess resolvespec_common.SqlInt32 `json:"rid_process" bun:"rid_process,type:integer,pk,default:nextval('core.identity_process_rid_process'::regclass),"`
Status resolvespec_common.SqlString `json:"status" bun:"status,type:citext,"`
Updatecnt int64 `json:"updatecnt" bun:"updatecnt,type:integer,default:0,"`
HUB *ModelCoreHub `json:"HUB,omitempty" bun:"rel:has-one,join:rid_hub=rid_hub"`
MPR *ModelCoreMasterprocess `json:"MPR,omitempty" bun:"rel:has-one,join:rid_masterprocess=rid_masterprocess"`
// TAS []*ModelCoreTasklist `json:"TAS,omitempty" bun:"rel:has-many,join:rid_process=rid_process"`
// db.DBAdhocBuffer `json:",omitempty" bun:",scanonly"`
// db.DBGetIDInterface `json:",omitempty" bun:"-"`
// types.SQLTypable `json:",omitempty" bun:"-"`
// }
TAS []*ModelCoreTasklist `json:"TAS,omitempty" bun:"rel:has-many,join:rid_process=rid_process"`
db.DBAdhocBuffer `json:",omitempty" bun:",scanonly"`
db.DBGetIDInterface `json:",omitempty" bun:"-"`
types.SQLTypable `json:",omitempty" bun:"-"`
}
// // TableName - Returns the table name for the object.
// func (m ModelCoreProcess) TableName() string {
// return "core.process"
// }
// TableName - Returns the table name for the object.
func (m ModelCoreProcess) TableName() string {
return "core.process"
}
// // TableName - Returns the table name for the object.
// func (m ModelCoreProcess) TableNameOnly() string {
// return "process"
// }
// TableName - Returns the table name for the object.
func (m ModelCoreProcess) TableNameOnly() string {
return "process"
}
// // SchemaName - Returns the schema name for the object.
// func (m ModelCoreProcess) SchemaName() string {
// return "core"
// }
// SchemaName - Returns the schema name for the object.
func (m ModelCoreProcess) SchemaName() string {
return "core"
}
// // GetID - ID interface
// func (m ModelCoreProcess) GetID() int64 {
// return m.Ridprocess.Int64()
// }
// GetID - ID interface
func (m ModelCoreProcess) GetID() int64 {
return m.Ridprocess.Int64()
}
// // GetIDStr - ID interface
// func (m ModelCoreProcess) GetIDStr() string {
// return fmt.Sprintf("%d", m.Ridprocess)
// }
// GetIDStr - ID interface
func (m ModelCoreProcess) GetIDStr() string {
return fmt.Sprintf("%d", m.Ridprocess)
}
// // SetID - ID interface
// func (m ModelCoreProcess) SetID(newid int64) {
// m.UpdateID(newid)
// }
// SetID - ID interface
func (m ModelCoreProcess) SetID(newid int64) {
m.UpdateID(newid)
}
// func (m *ModelCoreProcess) UpdateID(newid int64) {
// m.Ridprocess.FromString(fmt.Sprintf("%d", newid))
// }
func (m *ModelCoreProcess) UpdateID(newid int64) {
m.Ridprocess.FromString(fmt.Sprintf("%d", newid))
}
// // GetIDName - ID interface
// func (m ModelCoreProcess) GetIDName() string {
// return "rid_process"
// }
// GetIDName - ID interface
func (m ModelCoreProcess) GetIDName() string {
return "rid_process"
}
// // GetPrefix - Returns a table prefix
// func (m ModelCoreProcess) GetPrefix() string {
// return "PRO"
// }
// GetPrefix - Returns a table prefix
func (m ModelCoreProcess) GetPrefix() string {
return "PRO"
}
// // GetRowNumber - Returns the row number of the record
// func (m ModelCoreProcess) GetRowNumber() int64 {
// return m.RowNumber
// }
// GetRowNumber - Returns the row number of the record
func (m ModelCoreProcess) GetRowNumber() int64 {
return m.RowNumber
}
// SetRowNumber - Set the row number of a record
func (m *ModelCoreProcess) SetRowNumber(num int64) {
m.RowNumber = num
}
// // SetRowNumber - Set the row number of a record
// func (m *ModelCoreProcess) SetRowNumber(num int64) {
// m.RowNumber = num
// }