mirror of
				https://github.com/teamhanko/hanko.git
				synced 2025-10-31 08:35:47 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			565 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			565 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package migrate
 | |
| 
 | |
| import (
 | |
| 	"github.com/spf13/cobra"
 | |
| 	"github.com/teamhanko/hanko/config"
 | |
| 	"github.com/teamhanko/hanko/persistence"
 | |
| 	"log"
 | |
| )
 | |
| 
 | |
| func NewMigrateUpCommand(config *config.Config) *cobra.Command {
 | |
| 	cmd := &cobra.Command{
 | |
| 		Use:   "up",
 | |
| 		Short: "migrate the database up",
 | |
| 		Long:  ``,
 | |
| 		Run: func(cmd *cobra.Command, args []string) {
 | |
| 			log.Println("migrate up")
 | |
| 			persister, err := persistence.New(config.Database)
 | |
| 			if err != nil {
 | |
| 				log.Fatal(err)
 | |
| 			}
 | |
| 			err = persister.MigrateUp()
 | |
| 			if err != nil {
 | |
| 				log.Fatal(err)
 | |
| 			}
 | |
| 		},
 | |
| 	}
 | |
| 	return cmd
 | |
| }
 | 
