package core

import (
	"dbweb/lib/model"
	"fmt"
)

//ModelOptionName Model Option name
const ModelOptionName = "OPTIONS"

type modelOption struct {
	Name  string `dbx:"str(50) primary key"`
	Dept  string `dbx:"str(50) not null"`
	Value string `dbx:"str"`
}

func init() {
	RegisterModel(modelOption{}, 1, false, ModelOptionName)
	RegisterInstitutionModel(DeptRoot, ModelOptionName, "name='ProjectLabel'", "", "")
}
func (m modelOption) OnAfterSchemaUpdate(md *model.Model, oldver int64) error {
	if oldver == 0 {
		fmt.Println("set default project label")
		return md.Set(modelOption{
			Name:  "ProjectLabel",
			Dept:  "r",
			Value: "第一个项目",
		})
	}

	return nil
}
