aboutsummaryrefslogtreecommitdiff
path: root/database/migrate.go
blob: a20a211b3a4bc0e1429b74b03480b4cc38cefa79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package database

import (
	"fmt"
	"metachan/entities"
	"metachan/utils/logger"
)

func AutoMigrate() {
	err := DB.AutoMigrate(
		&entities.TaskLog{},
		&entities.AnimeMapping{},
	)
	if err != nil {
		logger.Log(fmt.Sprintf("Error during auto migration: %v", err), logger.LogOptions{
			Prefix: "Database",
			Level:  logger.Error,
			Fatal:  true,
		})
	} else {
		logger.Log("Auto migration completed successfully", logger.LogOptions{
			Prefix: "Database",
			Level:  logger.Success,
		})
	}
}