Bugs Fixed
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:
@@ -1,88 +1,82 @@
|
||||
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"
|
||||
// //ModelCoreMasterprocess - Generated Table for Schema core
|
||||
// type ModelCoreMasterprocess struct {
|
||||
// bun.BaseModel `bun:"table:core.masterprocess,alias:masterprocess"`
|
||||
// Description resolvespec_common.SqlString `json:"description" bun:"description,type:citext,"`
|
||||
// GUID resolvespec_common.SqlUUID `json:"guid" bun:"guid,type:uuid,default:newid(),"`
|
||||
// Inactive resolvespec_common.SqlInt16 `json:"inactive" bun:"inactive,type:smallint,"`
|
||||
// Jsonvalue resolvespec_common.SqlJSONB `json:"jsonvalue" bun:"jsonvalue,type:jsonb,"`
|
||||
// Ridjsonschema resolvespec_common.SqlInt32 `json:"rid_jsonschema" bun:"rid_jsonschema,type:integer,"`
|
||||
// Ridmasterprocess resolvespec_common.SqlInt32 `json:"rid_masterprocess" bun:"rid_masterprocess,type:integer,pk,default:nextval('core.identity_masterprocess_rid_masterprocess'::regclass),"`
|
||||
// Ridmastertypehubtype resolvespec_common.SqlInt32 `json:"rid_mastertype_hubtype" bun:"rid_mastertype_hubtype,type:integer,"`
|
||||
// Ridmastertypeprocesstype resolvespec_common.SqlInt32 `json:"rid_mastertype_processtype" bun:"rid_mastertype_processtype,type:integer,"`
|
||||
// Ridprogrammodule resolvespec_common.SqlInt32 `json:"rid_programmodule" bun:"rid_programmodule,type:integer,"`
|
||||
// Sequenceno resolvespec_common.SqlInt32 `json:"sequenceno" bun:"sequenceno,type:integer,"`
|
||||
// Singleprocess resolvespec_common.SqlInt16 `json:"singleprocess" bun:"singleprocess,type:smallint,"`
|
||||
// Updatecnt int64 `json:"updatecnt" bun:"updatecnt,type:integer,default:0,"`
|
||||
// JSON *ModelCoreJsonschema `json:"JSON,omitempty" bun:"rel:has-one,join:rid_jsonschema=rid_jsonschema"`
|
||||
// MTT_RID_MASTERTYPE_HUBTYPE *ModelCoreMastertype `json:"MTT_RID_MASTERTYPE_HUBTYPE,omitempty" bun:"rel:has-one,join:rid_mastertype_hubtype=rid_mastertype"`
|
||||
// MTT_RID_MASTERTYPE_PROCESSTYPE *ModelCoreMastertype `json:"MTT_RID_MASTERTYPE_PROCESSTYPE,omitempty" bun:"rel:has-one,join:rid_mastertype_processtype=rid_mastertype"`
|
||||
// PMO *ModelPublicProgrammodule `json:"PMO,omitempty" bun:"rel:has-one,join:rid_programmodule=rid_programmodule"`
|
||||
|
||||
//ModelCoreMasterprocess - Generated Table for Schema core
|
||||
type ModelCoreMasterprocess struct {
|
||||
bun.BaseModel `bun:"table:core.masterprocess,alias:masterprocess"`
|
||||
Description resolvespec_common.SqlString `json:"description" bun:"description,type:citext,"`
|
||||
GUID resolvespec_common.SqlUUID `json:"guid" bun:"guid,type:uuid,default:newid(),"`
|
||||
Inactive resolvespec_common.SqlInt16 `json:"inactive" bun:"inactive,type:smallint,"`
|
||||
Jsonvalue resolvespec_common.SqlJSONB `json:"jsonvalue" bun:"jsonvalue,type:jsonb,"`
|
||||
Ridjsonschema resolvespec_common.SqlInt32 `json:"rid_jsonschema" bun:"rid_jsonschema,type:integer,"`
|
||||
Ridmasterprocess resolvespec_common.SqlInt32 `json:"rid_masterprocess" bun:"rid_masterprocess,type:integer,pk,default:nextval('core.identity_masterprocess_rid_masterprocess'::regclass),"`
|
||||
Ridmastertypehubtype resolvespec_common.SqlInt32 `json:"rid_mastertype_hubtype" bun:"rid_mastertype_hubtype,type:integer,"`
|
||||
Ridmastertypeprocesstype resolvespec_common.SqlInt32 `json:"rid_mastertype_processtype" bun:"rid_mastertype_processtype,type:integer,"`
|
||||
Ridprogrammodule resolvespec_common.SqlInt32 `json:"rid_programmodule" bun:"rid_programmodule,type:integer,"`
|
||||
Sequenceno resolvespec_common.SqlInt32 `json:"sequenceno" bun:"sequenceno,type:integer,"`
|
||||
Singleprocess resolvespec_common.SqlInt16 `json:"singleprocess" bun:"singleprocess,type:smallint,"`
|
||||
Updatecnt int64 `json:"updatecnt" bun:"updatecnt,type:integer,default:0,"`
|
||||
JSON *ModelCoreJsonschema `json:"JSON,omitempty" bun:"rel:has-one,join:rid_jsonschema=rid_jsonschema"`
|
||||
MTT_RID_MASTERTYPE_HUBTYPE *ModelCoreMastertype `json:"MTT_RID_MASTERTYPE_HUBTYPE,omitempty" bun:"rel:has-one,join:rid_mastertype_hubtype=rid_mastertype"`
|
||||
MTT_RID_MASTERTYPE_PROCESSTYPE *ModelCoreMastertype `json:"MTT_RID_MASTERTYPE_PROCESSTYPE,omitempty" bun:"rel:has-one,join:rid_mastertype_processtype=rid_mastertype"`
|
||||
PMO *ModelPublicProgrammodule `json:"PMO,omitempty" bun:"rel:has-one,join:rid_programmodule=rid_programmodule"`
|
||||
// MTL []*ModelCoreMastertask `json:"MTL,omitempty" bun:"rel:has-many,join:rid_masterprocess=rid_masterprocess"`
|
||||
// PRO []*ModelCoreProcess `json:"PRO,omitempty" bun:"rel:has-many,join:rid_masterprocess=rid_masterprocess"`
|
||||
// db.DBAdhocBuffer `json:",omitempty" bun:",scanonly"`
|
||||
// db.DBGetIDInterface `json:",omitempty" bun:"-"`
|
||||
// types.SQLTypable `json:",omitempty" bun:"-"`
|
||||
// }
|
||||
|
||||
MTL []*ModelCoreMastertask `json:"MTL,omitempty" bun:"rel:has-many,join:rid_masterprocess=rid_masterprocess"`
|
||||
PRO []*ModelCoreProcess `json:"PRO,omitempty" bun:"rel:has-many,join:rid_masterprocess=rid_masterprocess"`
|
||||
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 ModelCoreMasterprocess) TableName() string {
|
||||
// return "core.masterprocess"
|
||||
// }
|
||||
|
||||
// TableName - Returns the table name for the object.
|
||||
func (m ModelCoreMasterprocess) TableName() string {
|
||||
return "core.masterprocess"
|
||||
}
|
||||
// // TableName - Returns the table name for the object.
|
||||
// func (m ModelCoreMasterprocess) TableNameOnly() string {
|
||||
// return "masterprocess"
|
||||
// }
|
||||
|
||||
// TableName - Returns the table name for the object.
|
||||
func (m ModelCoreMasterprocess) TableNameOnly() string {
|
||||
return "masterprocess"
|
||||
}
|
||||
// // SchemaName - Returns the schema name for the object.
|
||||
// func (m ModelCoreMasterprocess) SchemaName() string {
|
||||
// return "core"
|
||||
// }
|
||||
|
||||
// SchemaName - Returns the schema name for the object.
|
||||
func (m ModelCoreMasterprocess) SchemaName() string {
|
||||
return "core"
|
||||
}
|
||||
// // GetID - ID interface
|
||||
// func (m ModelCoreMasterprocess) GetID() int64 {
|
||||
// return m.Ridmasterprocess.Int64()
|
||||
// }
|
||||
|
||||
// GetID - ID interface
|
||||
func (m ModelCoreMasterprocess) GetID() int64 {
|
||||
return m.Ridmasterprocess.Int64()
|
||||
}
|
||||
// // GetIDStr - ID interface
|
||||
// func (m ModelCoreMasterprocess) GetIDStr() string {
|
||||
// return fmt.Sprintf("%d", m.Ridmasterprocess)
|
||||
// }
|
||||
|
||||
// GetIDStr - ID interface
|
||||
func (m ModelCoreMasterprocess) GetIDStr() string {
|
||||
return fmt.Sprintf("%d", m.Ridmasterprocess)
|
||||
}
|
||||
// // SetID - ID interface
|
||||
// func (m ModelCoreMasterprocess) SetID(newid int64) {
|
||||
// m.UpdateID(newid)
|
||||
// }
|
||||
|
||||
// SetID - ID interface
|
||||
func (m ModelCoreMasterprocess) SetID(newid int64) {
|
||||
m.UpdateID(newid)
|
||||
}
|
||||
// func (m *ModelCoreMasterprocess) UpdateID(newid int64) {
|
||||
// m.Ridmasterprocess.FromString(fmt.Sprintf("%d", newid))
|
||||
// }
|
||||
|
||||
func (m *ModelCoreMasterprocess) UpdateID(newid int64) {
|
||||
m.Ridmasterprocess.FromString(fmt.Sprintf("%d", newid))
|
||||
}
|
||||
// // GetIDName - ID interface
|
||||
// func (m ModelCoreMasterprocess) GetIDName() string {
|
||||
// return "rid_masterprocess"
|
||||
// }
|
||||
|
||||
// GetIDName - ID interface
|
||||
func (m ModelCoreMasterprocess) GetIDName() string {
|
||||
return "rid_masterprocess"
|
||||
}
|
||||
// // GetPrefix - Returns a table prefix
|
||||
// func (m ModelCoreMasterprocess) GetPrefix() string {
|
||||
// return "MPR"
|
||||
// }
|
||||
|
||||
// GetPrefix - Returns a table prefix
|
||||
func (m ModelCoreMasterprocess) GetPrefix() string {
|
||||
return "MPR"
|
||||
}
|
||||
// // GetRowNumber - Returns the row number of the record
|
||||
// func (m ModelCoreMasterprocess) GetRowNumber() int64 {
|
||||
// return m.RowNumber
|
||||
// }
|
||||
|
||||
// GetRowNumber - Returns the row number of the record
|
||||
func (m ModelCoreMasterprocess) GetRowNumber() int64 {
|
||||
return m.RowNumber
|
||||
}
|
||||
|
||||
// SetRowNumber - Set the row number of a record
|
||||
func (m *ModelCoreMasterprocess) SetRowNumber(num int64) {
|
||||
m.RowNumber = num
|
||||
}
|
||||
// // SetRowNumber - Set the row number of a record
|
||||
// func (m *ModelCoreMasterprocess) SetRowNumber(num int64) {
|
||||
// m.RowNumber = num
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user