This commit is contained in:
delete 2026-06-10 20:51:17 +03:00
commit b15b95781c
108 changed files with 14802 additions and 0 deletions

34
cmd/migrate/main.go Normal file
View file

@ -0,0 +1,34 @@
package main
import (
"context"
"fmt"
"os"
"update_server/internal/config"
"update_server/internal/db"
)
func main() {
cfg, err := config.Load()
if err != nil {
exitWithError(err)
}
database, err := db.Open(context.Background(), cfg.SQLitePath)
if err != nil {
exitWithError(err)
}
defer database.Close()
if err := db.Migrate(context.Background(), database, cfg.MigrationsDir); err != nil {
exitWithError(err)
}
fmt.Fprintf(os.Stdout, "migrations applied successfully to %s\n", cfg.SQLitePath)
}
func exitWithError(err error) {
fmt.Fprintf(os.Stderr, "update_server migrate: %v\n", err)
os.Exit(1)
}