1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-06-14 13:58:37 -04:00

Split reports into models

This commit is contained in:
2017-12-05 05:58:36 -05:00
parent 5f296e8669
commit 3e3038295d
7 changed files with 122 additions and 117 deletions

View File

@ -5,7 +5,6 @@ import (
"fmt"
"github.com/aclindsa/gorp"
"github.com/aclindsa/moneygo/internal/config"
"github.com/aclindsa/moneygo/internal/handlers"
"github.com/aclindsa/moneygo/internal/models"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
@ -44,8 +43,8 @@ func GetDbMap(db *sql.DB, dbtype config.DbType) (*gorp.DbMap, error) {
dbmap.AddTableWithName(models.Transaction{}, "transactions").SetKeys(true, "TransactionId")
dbmap.AddTableWithName(models.Split{}, "splits").SetKeys(true, "SplitId")
dbmap.AddTableWithName(models.Price{}, "prices").SetKeys(true, "PriceId")
rtable := dbmap.AddTableWithName(handlers.Report{}, "reports").SetKeys(true, "ReportId")
rtable.ColMap("Lua").SetMaxSize(handlers.LuaMaxLength + luaMaxLengthBuffer)
rtable := dbmap.AddTableWithName(models.Report{}, "reports").SetKeys(true, "ReportId")
rtable.ColMap("Lua").SetMaxSize(models.LuaMaxLength + luaMaxLengthBuffer)
err := dbmap.CreateTablesIfNotExists()
if err != nil {