예제 #1
0
파일: cmd_up.go 프로젝트: Vektah/goose
func upRun(cmd *Command, conf *goose.DBConf, args ...string) {

	target, err := goose.GetMostRecentDBVersion(conf.MigrationsDir)
	if err != nil {
		log.Fatal(err)
	}

	if err := goose.RunMigrations(conf, conf.MigrationsDir, target); err != nil {
		log.Fatal(err)
	}
}
예제 #2
0
파일: cmd_down.go 프로젝트: Vektah/goose
func downRun(cmd *Command, conf *goose.DBConf, args ...string) {

	current, err := goose.GetDBVersion(conf)
	if err != nil {
		log.Fatal(err)
	}

	previous, err := goose.GetPreviousDBVersion(conf.MigrationsDir, current)
	if err != nil {
		log.Fatal(err)
	}

	if err = goose.RunMigrations(conf, conf.MigrationsDir, previous); err != nil {
		log.Fatal(err)
	}
}