Skip to content

Commit

Permalink
fix import/export for field size
Browse files Browse the repository at this point in the history
  • Loading branch information
ubaldus committed May 19, 2024
1 parent e8038ab commit 7ec5359
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion db/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func ModuleExport(moduleId int64, data bool) (module TypeModule, err error) {
SortList: row["sortList"],
}

rows, err = Rows("SELECT translate, powerEdit, name, type, powerList, powerSearch, value FROM ejaFields WHERE ejaModuleId=?", moduleId)
rows, err = Rows("SELECT * FROM ejaFields WHERE ejaModuleId=?", moduleId)
if err != nil {
return
}
Expand All @@ -31,6 +31,9 @@ func ModuleExport(moduleId int64, data bool) (module TypeModule, err error) {
PowerSearch: Number(row["powerSearch"]),
PowerList: Number(row["powerList"]),
PowerEdit: Number(row["powerEdit"]),
SizeSearch: Number(row["sizeSearch"]),
SizeList: Number(row["sizeList"]),
SizeEdit: Number(row["sizeEdit"]),
Type: row["type"],
Translate: Number(row["translate"]),
})
Expand Down
5 changes: 4 additions & 1 deletion db/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func ModuleImport(module TypeModule, moduleName string) error {
}
}
}
_, err = Run(`
run, err := Run(`
INSERT INTO ejaFields
(ejaId, ejaOwner, ejaLog, ejaModuleId, name, type, value, translate, powerSearch, powerList, powerEdit)
VALUES
Expand All @@ -68,6 +68,9 @@ func ModuleImport(module TypeModule, moduleName string) error {
if err != nil {
return err
}
Run(`UPDATE ejaFields SET sizeSearch=? WHERE ejaId=?`, field.SizeSearch, run.LastId)
Run(`UPDATE ejaFields SET sizeList=? WHERE ejaId=?`, field.SizeList, run.LastId)
Run(`UPDATE ejaFields SET sizeEdit=? WHERE ejaId=?`, field.SizeEdit, run.LastId)
}

ejaPermissionsId := ModuleGetIdByName("ejaPermissions")
Expand Down
3 changes: 3 additions & 0 deletions db/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ type TypeModuleField struct {
Translate int64 `json:"translate"`
PowerSearch int64 `json:"powerSearch"`
Name string `json:"name"`
SizeSearch int64 `json:"sizeSearch"`
SizeList int64 `json:"sizeList"`
SizeEdit int64 `json:"sizeEdit"`
}

// TypeModuleTranslation represents translation information within a TypeModule.
Expand Down

0 comments on commit 7ec5359

Please sign in to comment.