mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-14 05:52:43 +00:00
Decouple unit test code from business code (#17623)
This commit is contained in:
parent
7f802631c5
commit
df64fa4865
136 changed files with 1058 additions and 830 deletions
|
@ -124,7 +124,8 @@ func NewEngine() (*xorm.Engine, error) {
|
|||
return engine, nil
|
||||
}
|
||||
|
||||
func syncTables() error {
|
||||
//SyncAllTables sync the schemas of all tables, is required by unit test code
|
||||
func SyncAllTables() error {
|
||||
return x.StoreEngine("InnoDB").Sync2(tables...)
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ func InitEngineWithMigration(ctx context.Context, migrateFunc func(*xorm.Engine)
|
|||
return fmt.Errorf("migrate: %v", err)
|
||||
}
|
||||
|
||||
if err = syncTables(); err != nil {
|
||||
if err = SyncAllTables(); err != nil {
|
||||
return fmt.Errorf("sync database struct error: %v", err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue