* H-300: wire Captain Skills into Web runtime * H-300: enforce effective model and conservative skill budget * H-300: fix CI gosec step * ci: extend golangci-lint timeout * fix lint findings across backend * fix(push): resolve delivery protocol blockers * test(repository): close SQLite test databases * test(repository): reuse SQLite schema per package * H-307: restore backend Go cache in CI * H-307: prefetch modules before cold lint * H-307: resolve govulncheck security gate * H-307: build lint with patched Go toolchain * H-307: clear remaining security scan findings --------- Co-authored-by: Rogee <rogee@ipao.vip>
42 lines
962 B
Go
42 lines
962 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/gochat/gochat/internal/model"
|
|
"gorm.io/driver/sqlite"
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm/logger"
|
|
)
|
|
|
|
func main() {
|
|
db, err := gorm.Open(sqlite.Open("file::memory:"), &gorm.Config{
|
|
Logger: logger.Default.LogMode(logger.Info),
|
|
})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if err := db.AutoMigrate(&model.DashboardApp{}); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Create an app with Active=false
|
|
app := &model.DashboardApp{
|
|
AccountID: 1,
|
|
Title: "InactiveApp",
|
|
Kind: "frame",
|
|
Active: model.BoolPtr(false),
|
|
Content: json.RawMessage(`[]`),
|
|
}
|
|
result := db.Select("AccountID", "UserID", "Title", "Description",
|
|
"Icon", "URL", "Kind", "Content", "Active").Create(app)
|
|
fmt.Printf("Create error: %v\n", result.Error)
|
|
fmt.Printf("App Active after create: %v\n", app.Active)
|
|
|
|
// Read it back
|
|
var found model.DashboardApp
|
|
db.First(&found, app.ID)
|
|
fmt.Printf("Found Active: %v\n", found.Active)
|
|
}
|