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,88 +1,81 @@
package models
import (
"fmt"
// // ModelCoreMasterprocess - Generated Table for Schema core
// type ModelCoreMasterprocess struct {
// Description string `json:"description" gorm:"Column:description;type:citext;"`
// GUID types.NullableUUID `json:"guid" gorm:"Column:guid;type:uuid;default:newid();"`
// Inactive types.SInt16 `json:"inactive" gorm:"Column:inactive;type:smallint;"`
// Jsonvalue types.NullableJSONB `json:"jsonvalue" gorm:"Column:jsonvalue;type:jsonb;"`
// Ridjsonschema types.ZNullInt32 `json:"rid_jsonschema" gorm:"Column:rid_jsonschema;type:integer;"`
// Ridmasterprocess int32 `json:"rid_masterprocess" gorm:"Column:rid_masterprocess;type:integer;primaryKey;default:nextval('core.identity_masterprocess_rid_masterprocess'::regclass);"`
// Ridmastertypehubtype types.ZNullInt32 `json:"rid_mastertype_hubtype" gorm:"Column:rid_mastertype_hubtype;type:integer;"`
// Ridmastertypeprocesstype types.ZNullInt32 `json:"rid_mastertype_processtype" gorm:"Column:rid_mastertype_processtype;type:integer;"`
// Ridprogrammodule types.ZNullInt32 `json:"rid_programmodule" gorm:"Column:rid_programmodule;type:integer;"`
// Sequenceno types.ZNullInt32 `json:"sequenceno" gorm:"Column:sequenceno;type:integer;"`
// Singleprocess types.SInt16 `json:"singleprocess" gorm:"Column:singleprocess;type:smallint;"`
// Updatecnt int64 `json:"updatecnt" gorm:"Column:updatecnt;type:integer;default:0;"`
// //JSON *ModelCoreJsonschema `json:"JSON,omitempty" gorm:"references:rid_jsonschema;foreignKey:rid_jsonschema;"`
// MTT_RID_MASTERTYPE_HUBTYPE *ModelCoreMastertype `json:"MTT_RID_MASTERTYPE_HUBTYPE,omitempty" gorm:"references:rid_mastertype_hubtype;foreignKey:rid_mastertype;"`
// MTT_RID_MASTERTYPE_PROCESSTYPE *ModelCoreMastertype `json:"MTT_RID_MASTERTYPE_PROCESSTYPE,omitempty" gorm:"references:rid_mastertype_processtype;foreignKey:rid_mastertype;"`
// //PMO *ModelPublicProgrammodule `json:"PMO,omitempty" gorm:"references:rid_programmodule;foreignKey:rid_programmodule;"`
db "github.com/bitechdev/GoCore/pkg/models"
"github.com/bitechdev/GoCore/pkg/types"
)
// MTL []*ModelCoreMastertask `json:"MTL,omitempty" gorm:"references:rid_masterprocess;foreignKey:rid_masterprocess;opt_c"`
// PRO []*ModelCoreProcess `json:"PRO,omitempty" gorm:"references:rid_masterprocess;foreignKey:rid_masterprocess;opt_c"`
// db.DBAdhocBuffer `json:",omitempty"`
// db.DBGetIDInterface `json:",omitempty" gorm:"-"`
// types.SQLTypable `json:",omitempty" gorm:"-"`
// }
// ModelCoreMasterprocess - Generated Table for Schema core
type ModelCoreMasterprocess struct {
Description string `json:"description" gorm:"Column:description;type:citext;"`
GUID types.NullableUUID `json:"guid" gorm:"Column:guid;type:uuid;default:newid();"`
Inactive types.SInt16 `json:"inactive" gorm:"Column:inactive;type:smallint;"`
Jsonvalue types.NullableJSONB `json:"jsonvalue" gorm:"Column:jsonvalue;type:jsonb;"`
Ridjsonschema types.ZNullInt32 `json:"rid_jsonschema" gorm:"Column:rid_jsonschema;type:integer;"`
Ridmasterprocess int32 `json:"rid_masterprocess" gorm:"Column:rid_masterprocess;type:integer;primaryKey;default:nextval('core.identity_masterprocess_rid_masterprocess'::regclass);"`
Ridmastertypehubtype types.ZNullInt32 `json:"rid_mastertype_hubtype" gorm:"Column:rid_mastertype_hubtype;type:integer;"`
Ridmastertypeprocesstype types.ZNullInt32 `json:"rid_mastertype_processtype" gorm:"Column:rid_mastertype_processtype;type:integer;"`
Ridprogrammodule types.ZNullInt32 `json:"rid_programmodule" gorm:"Column:rid_programmodule;type:integer;"`
Sequenceno types.ZNullInt32 `json:"sequenceno" gorm:"Column:sequenceno;type:integer;"`
Singleprocess types.SInt16 `json:"singleprocess" gorm:"Column:singleprocess;type:smallint;"`
Updatecnt int64 `json:"updatecnt" gorm:"Column:updatecnt;type:integer;default:0;"`
//JSON *ModelCoreJsonschema `json:"JSON,omitempty" gorm:"references:rid_jsonschema;foreignKey:rid_jsonschema;"`
MTT_RID_MASTERTYPE_HUBTYPE *ModelCoreMastertype `json:"MTT_RID_MASTERTYPE_HUBTYPE,omitempty" gorm:"references:rid_mastertype_hubtype;foreignKey:rid_mastertype;"`
MTT_RID_MASTERTYPE_PROCESSTYPE *ModelCoreMastertype `json:"MTT_RID_MASTERTYPE_PROCESSTYPE,omitempty" gorm:"references:rid_mastertype_processtype;foreignKey:rid_mastertype;"`
//PMO *ModelPublicProgrammodule `json:"PMO,omitempty" gorm:"references:rid_programmodule;foreignKey:rid_programmodule;"`
// // TableName - Returns the table name for the object.
// func (m ModelCoreMasterprocess) TableName() string {
// return "core.masterprocess"
// }
MTL []*ModelCoreMastertask `json:"MTL,omitempty" gorm:"references:rid_masterprocess;foreignKey:rid_masterprocess;opt_c"`
PRO []*ModelCoreProcess `json:"PRO,omitempty" gorm:"references:rid_masterprocess;foreignKey:rid_masterprocess;opt_c"`
db.DBAdhocBuffer `json:",omitempty"`
db.DBGetIDInterface `json:",omitempty" gorm:"-"`
types.SQLTypable `json:",omitempty" gorm:"-"`
}
// // 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) TableName() string {
return "core.masterprocess"
}
// // SchemaName - Returns the schema name for the object.
// func (m ModelCoreMasterprocess) SchemaName() string {
// return "core"
// }
// TableName - Returns the table name for the object.
func (m ModelCoreMasterprocess) TableNameOnly() string {
return "masterprocess"
}
// // GetID - ID interface
// func (m ModelCoreMasterprocess) GetID() int64 {
// return int64(m.Ridmasterprocess)
// }
// SchemaName - Returns the schema name for the object.
func (m ModelCoreMasterprocess) SchemaName() string {
return "core"
}
// // GetIDStr - ID interface
// func (m ModelCoreMasterprocess) GetIDStr() string {
// return fmt.Sprintf("%d", m.Ridmasterprocess)
// }
// GetID - ID interface
func (m ModelCoreMasterprocess) GetID() int64 {
return int64(m.Ridmasterprocess)
}
// // SetID - ID interface
// func (m ModelCoreMasterprocess) SetID(newid int64) {
// m.UpdateID(newid)
// }
// GetIDStr - ID interface
func (m ModelCoreMasterprocess) GetIDStr() string {
return fmt.Sprintf("%d", m.Ridmasterprocess)
}
// func (m *ModelCoreMasterprocess) UpdateID(newid int64) {
// m.Ridmasterprocess = int32(newid)
// }
// SetID - ID interface
func (m ModelCoreMasterprocess) SetID(newid int64) {
m.UpdateID(newid)
}
// // GetIDName - ID interface
// func (m ModelCoreMasterprocess) GetIDName() string {
// return "rid_masterprocess"
// }
func (m *ModelCoreMasterprocess) UpdateID(newid int64) {
m.Ridmasterprocess = int32(newid)
}
// // GetPrefix - Returns a table prefix
// func (m ModelCoreMasterprocess) GetPrefix() string {
// return "MPR"
// }
// GetIDName - ID interface
func (m ModelCoreMasterprocess) GetIDName() string {
return "rid_masterprocess"
}
// // GetRowNumber - Returns the row number of the record
// func (m ModelCoreMasterprocess) GetRowNumber() int64 {
// return m.RowNumber
// }
// 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
}
// 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
// }