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,96 +1,90 @@
|
||||
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"
|
||||
// //ModelCoreMastertask - Generated Table for Schema core
|
||||
// type ModelCoreMastertask struct {
|
||||
// bun.BaseModel `bun:"table:core.mastertask,alias:mastertask"`
|
||||
// Allactionsmustcomplete resolvespec_common.SqlInt16 `json:"allactionsmustcomplete" bun:"allactionsmustcomplete,type:smallint,"`
|
||||
// Condition resolvespec_common.SqlString `json:"condition" bun:"condition,type:citext,"`
|
||||
// Description resolvespec_common.SqlString `json:"description" bun:"description,type:citext,"`
|
||||
// Dueday resolvespec_common.SqlInt16 `json:"dueday" bun:"dueday,type:smallint,"`
|
||||
// Dueoption resolvespec_common.SqlString `json:"dueoption" bun:"dueoption,type:citext,"`
|
||||
// Escalation resolvespec_common.SqlInt32 `json:"escalation" bun:"escalation,type:integer,"`
|
||||
// Escalationoption resolvespec_common.SqlString `json:"escalationoption" bun:"escalationoption,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,"`
|
||||
// Mastertasknote resolvespec_common.SqlString `json:"mastertasknote" bun:"mastertasknote,type:citext,"`
|
||||
// Repeatinterval resolvespec_common.SqlInt16 `json:"repeatinterval" bun:"repeatinterval,type:smallint,"`
|
||||
// Repeattype resolvespec_common.SqlString `json:"repeattype" bun:"repeattype,type:citext,"`
|
||||
// Ridjsonschema resolvespec_common.SqlInt32 `json:"rid_jsonschema" bun:"rid_jsonschema,type:integer,"`
|
||||
// Ridmasterprocess resolvespec_common.SqlInt32 `json:"rid_masterprocess" bun:"rid_masterprocess,type:integer,"`
|
||||
// Ridmastertask resolvespec_common.SqlInt32 `json:"rid_mastertask" bun:"rid_mastertask,type:integer,pk,default:nextval('core.identity_mastertask_rid_mastertask'::regclass),"`
|
||||
// Ridmastertypetasktype resolvespec_common.SqlInt32 `json:"rid_mastertype_tasktype" bun:"rid_mastertype_tasktype,type:integer,"`
|
||||
// Sequenceno resolvespec_common.SqlInt32 `json:"sequenceno" bun:"sequenceno,type:integer,"`
|
||||
// Singletask resolvespec_common.SqlInt16 `json:"singletask" bun:"singletask,type:smallint,"`
|
||||
// Startday resolvespec_common.SqlInt16 `json:"startday" bun:"startday,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"`
|
||||
// MPR *ModelCoreMasterprocess `json:"MPR,omitempty" bun:"rel:has-one,join:rid_masterprocess=rid_masterprocess"`
|
||||
// MTT *ModelCoreMastertype `json:"MTT,omitempty" bun:"rel:has-one,join:rid_mastertype_tasktype=rid_mastertype"`
|
||||
|
||||
//ModelCoreMastertask - Generated Table for Schema core
|
||||
type ModelCoreMastertask struct {
|
||||
bun.BaseModel `bun:"table:core.mastertask,alias:mastertask"`
|
||||
Allactionsmustcomplete resolvespec_common.SqlInt16 `json:"allactionsmustcomplete" bun:"allactionsmustcomplete,type:smallint,"`
|
||||
Condition resolvespec_common.SqlString `json:"condition" bun:"condition,type:citext,"`
|
||||
Description resolvespec_common.SqlString `json:"description" bun:"description,type:citext,"`
|
||||
Dueday resolvespec_common.SqlInt16 `json:"dueday" bun:"dueday,type:smallint,"`
|
||||
Dueoption resolvespec_common.SqlString `json:"dueoption" bun:"dueoption,type:citext,"`
|
||||
Escalation resolvespec_common.SqlInt32 `json:"escalation" bun:"escalation,type:integer,"`
|
||||
Escalationoption resolvespec_common.SqlString `json:"escalationoption" bun:"escalationoption,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,"`
|
||||
Mastertasknote resolvespec_common.SqlString `json:"mastertasknote" bun:"mastertasknote,type:citext,"`
|
||||
Repeatinterval resolvespec_common.SqlInt16 `json:"repeatinterval" bun:"repeatinterval,type:smallint,"`
|
||||
Repeattype resolvespec_common.SqlString `json:"repeattype" bun:"repeattype,type:citext,"`
|
||||
Ridjsonschema resolvespec_common.SqlInt32 `json:"rid_jsonschema" bun:"rid_jsonschema,type:integer,"`
|
||||
Ridmasterprocess resolvespec_common.SqlInt32 `json:"rid_masterprocess" bun:"rid_masterprocess,type:integer,"`
|
||||
Ridmastertask resolvespec_common.SqlInt32 `json:"rid_mastertask" bun:"rid_mastertask,type:integer,pk,default:nextval('core.identity_mastertask_rid_mastertask'::regclass),"`
|
||||
Ridmastertypetasktype resolvespec_common.SqlInt32 `json:"rid_mastertype_tasktype" bun:"rid_mastertype_tasktype,type:integer,"`
|
||||
Sequenceno resolvespec_common.SqlInt32 `json:"sequenceno" bun:"sequenceno,type:integer,"`
|
||||
Singletask resolvespec_common.SqlInt16 `json:"singletask" bun:"singletask,type:smallint,"`
|
||||
Startday resolvespec_common.SqlInt16 `json:"startday" bun:"startday,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"`
|
||||
MPR *ModelCoreMasterprocess `json:"MPR,omitempty" bun:"rel:has-one,join:rid_masterprocess=rid_masterprocess"`
|
||||
MTT *ModelCoreMastertype `json:"MTT,omitempty" bun:"rel:has-one,join:rid_mastertype_tasktype=rid_mastertype"`
|
||||
// MAL []*ModelCoreMastertaskitem `json:"MAL,omitempty" bun:"rel:has-many,join:rid_mastertask=rid_mastertask"`
|
||||
// TAS []*ModelCoreTasklist `json:"TAS,omitempty" bun:"rel:has-many,join:rid_mastertask=rid_mastertask"`
|
||||
// db.DBAdhocBuffer `json:",omitempty" bun:",scanonly"`
|
||||
// db.DBGetIDInterface `json:",omitempty" bun:"-"`
|
||||
// types.SQLTypable `json:",omitempty" bun:"-"`
|
||||
// }
|
||||
|
||||
MAL []*ModelCoreMastertaskitem `json:"MAL,omitempty" bun:"rel:has-many,join:rid_mastertask=rid_mastertask"`
|
||||
TAS []*ModelCoreTasklist `json:"TAS,omitempty" bun:"rel:has-many,join:rid_mastertask=rid_mastertask"`
|
||||
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 ModelCoreMastertask) TableName() string {
|
||||
// return "core.mastertask"
|
||||
// }
|
||||
|
||||
// TableName - Returns the table name for the object.
|
||||
func (m ModelCoreMastertask) TableName() string {
|
||||
return "core.mastertask"
|
||||
}
|
||||
// // TableName - Returns the table name for the object.
|
||||
// func (m ModelCoreMastertask) TableNameOnly() string {
|
||||
// return "mastertask"
|
||||
// }
|
||||
|
||||
// TableName - Returns the table name for the object.
|
||||
func (m ModelCoreMastertask) TableNameOnly() string {
|
||||
return "mastertask"
|
||||
}
|
||||
// // SchemaName - Returns the schema name for the object.
|
||||
// func (m ModelCoreMastertask) SchemaName() string {
|
||||
// return "core"
|
||||
// }
|
||||
|
||||
// SchemaName - Returns the schema name for the object.
|
||||
func (m ModelCoreMastertask) SchemaName() string {
|
||||
return "core"
|
||||
}
|
||||
// // GetID - ID interface
|
||||
// func (m ModelCoreMastertask) GetID() int64 {
|
||||
// return m.Ridmastertask.Int64()
|
||||
// }
|
||||
|
||||
// GetID - ID interface
|
||||
func (m ModelCoreMastertask) GetID() int64 {
|
||||
return m.Ridmastertask.Int64()
|
||||
}
|
||||
// // GetIDStr - ID interface
|
||||
// func (m ModelCoreMastertask) GetIDStr() string {
|
||||
// return fmt.Sprintf("%d", m.Ridmastertask)
|
||||
// }
|
||||
|
||||
// GetIDStr - ID interface
|
||||
func (m ModelCoreMastertask) GetIDStr() string {
|
||||
return fmt.Sprintf("%d", m.Ridmastertask)
|
||||
}
|
||||
// // SetID - ID interface
|
||||
// func (m ModelCoreMastertask) SetID(newid int64) {
|
||||
// m.UpdateID(newid)
|
||||
// }
|
||||
|
||||
// SetID - ID interface
|
||||
func (m ModelCoreMastertask) SetID(newid int64) {
|
||||
m.UpdateID(newid)
|
||||
}
|
||||
// func (m *ModelCoreMastertask) UpdateID(newid int64) {
|
||||
// m.Ridmastertask.FromString(fmt.Sprintf("%d", newid))
|
||||
// }
|
||||
|
||||
func (m *ModelCoreMastertask) UpdateID(newid int64) {
|
||||
m.Ridmastertask.FromString(fmt.Sprintf("%d", newid))
|
||||
}
|
||||
// // GetIDName - ID interface
|
||||
// func (m ModelCoreMastertask) GetIDName() string {
|
||||
// return "rid_mastertask"
|
||||
// }
|
||||
|
||||
// GetIDName - ID interface
|
||||
func (m ModelCoreMastertask) GetIDName() string {
|
||||
return "rid_mastertask"
|
||||
}
|
||||
// // GetPrefix - Returns a table prefix
|
||||
// func (m ModelCoreMastertask) GetPrefix() string {
|
||||
// return "MTL"
|
||||
// }
|
||||
|
||||
// GetPrefix - Returns a table prefix
|
||||
func (m ModelCoreMastertask) GetPrefix() string {
|
||||
return "MTL"
|
||||
}
|
||||
// // GetRowNumber - Returns the row number of the record
|
||||
// func (m ModelCoreMastertask) GetRowNumber() int64 {
|
||||
// return m.RowNumber
|
||||
// }
|
||||
|
||||
// GetRowNumber - Returns the row number of the record
|
||||
func (m ModelCoreMastertask) GetRowNumber() int64 {
|
||||
return m.RowNumber
|
||||
}
|
||||
|
||||
// SetRowNumber - Set the row number of a record
|
||||
func (m *ModelCoreMastertask) SetRowNumber(num int64) {
|
||||
m.RowNumber = num
|
||||
}
|
||||
// // SetRowNumber - Set the row number of a record
|
||||
// func (m *ModelCoreMastertask) SetRowNumber(num int64) {
|
||||
// m.RowNumber = num
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user