fix errors on insertion to game, fix db creation of game

This commit is contained in:
lbenedar
2026-04-23 19:03:56 +03:00
parent f46ff8333e
commit 07025afefc
36 changed files with 1820 additions and 693 deletions

View File

@@ -41,9 +41,9 @@ type Game struct {
Items []*Item
Settings []*Setting
Journals []*Journal
Tables []*Table //
Tables []*Table
Playlists []*Playlist
Actors []Actor //
Actors []*Actor
// Scenes []Scene
}
@@ -62,22 +62,25 @@ func (g *Game) InsertObjects(tx *sqlx.Tx) error {
InsertWithCtxParallel(group, ctx, tx, g.World, relDataString)
InsertWithCtxParallel(group, ctx, tx, g.System, relDataString)
InsertSimpleSliceParallel(group, tx, g.ActiveUsers, &InsertId[uint]{id: g.ID, fieldName: "game_id", tableName: "active_users"})
InsertSimpleSliceParallel(group, tx, g.ActiveUsers,
&InsertId[uint]{id: g.ID, fieldName: "game_id", tableName: "active_users"})
InsertSliceParallel(group, tx, g.Modules, relData)
InsertSliceParallel(group, tx, g.PackageWarnings, relData)
InsertSliceParallel(group, tx, g.Packs, relDataString)
InsertSliceParallel(group, tx, g.Messages, relData)
InsertSliceParallel(group, tx, g.Combats, relData)
InsertSliceParallel(group, tx, g.CardDeck, relData)
InsertSliceParallel(group, tx, g.Users, relData)
InsertSliceParallel(group, tx, g.Macros, relData)
InsertSliceParallel(group, tx, g.Folders, relData)
InsertSliceParallel(group, tx, g.Items, relData)
InsertSliceParallel(group, tx, g.Settings, relData)
InsertSliceParallel(group, tx, g.Journals, relData)
InsertSliceParallel(group, tx, g.Tables, relData)
InsertSliceParallel(group, tx, g.Playlists, relData)
// InsertSliceParallel(group, tx, g.Messages, relData)
// InsertSliceParallel(group, tx, g.Combats, relData)
// InsertSliceParallel(group, tx, g.CardDeck, relData)
// InsertSliceParallel(group, tx, g.Users, relData)
// InsertSliceParallel(group, tx, g.Macros, relData)
// InsertSliceParallel(group, tx, g.Folders, relData)
// InsertSliceParallel(group, tx, g.Items,
// InsertId[string]{id: strconv.FormatUint(uint64(g.ID), 10), fieldName: "game_id"})
// InsertSliceParallel(group, tx, g.Settings, relData)
// InsertSliceParallel(group, tx, g.Journals, relData)
// InsertSliceParallel(group, tx, g.Tables, relData)
// InsertSliceParallel(group, tx, g.Playlists, relData)
// InsertSliceParallel(group, tx, g.Actors, relData)
err := group.Wait()
if err != nil && !errors.Is(err, sql.ErrNoRows) {