You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/cli/db.go

27 lines
603 B
Go

//
// Copyright (C) 2024 veypi <i@veypi.com>
// 2025-03-04 16:08:06
// Distributed under terms of the MIT license.
//
package main
import (
"oa/cfg"
"oa/models"
"github.com/veypi/OneBD/rest/middlewares/crud"
)
var cmdDB = CMD.SubCommand("db", "database operations")
func init() {
cmdDB.SubCommand("migrate", "migrate database").Command = func() error {
return crud.AutoMigrate(cfg.DB(), cfg.StaticObjs)
}
cmdDB.SubCommand("drop", "drop database").Command = func() error {
return crud.AutoDrop(cfg.DB(), cfg.StaticObjs)
}
cmdDB.SubCommand("init", "init db data").Command = models.Init
}