SimpleCloudNotifier/scnserver/cmd/dbhash/main.go

49 lines
1.0 KiB
Go
Raw Normal View History

2023-05-28 19:59:57 +02:00
package main
import (
"blackforestbytes.com/simplecloudnotifier/db/schema"
"context"
"fmt"
2024-06-01 01:01:58 +02:00
"gogs.mikescher.com/BlackForestBytes/goext/exerr"
2023-05-28 19:59:57 +02:00
"gogs.mikescher.com/BlackForestBytes/goext/sq"
"time"
)
func main() {
2024-06-01 01:01:58 +02:00
exerr.Init(exerr.ErrorPackageConfigInit{})
2023-05-28 19:59:57 +02:00
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
sqlite3.Version() // ensure slite3 loaded
2024-06-01 01:01:58 +02:00
fmt.Println()
for i := 2; i <= schema.PrimarySchemaVersion; i++ {
h0, err := sq.HashGoSqliteSchema(ctx, schema.PrimarySchema[i].SQL)
if err != nil {
h0 = "ERR"
}
2024-06-01 01:01:58 +02:00
fmt.Printf("PrimarySchema%d := %s\n", i, h0)
}
2024-06-01 01:01:58 +02:00
for i := 1; i <= schema.RequestsSchemaVersion; i++ {
h0, err := sq.HashGoSqliteSchema(ctx, schema.RequestsSchema[i].SQL)
2023-05-28 19:59:57 +02:00
if err != nil {
h0 = "ERR"
}
2024-06-01 01:01:58 +02:00
fmt.Printf("RequestsSchema%d := %s\n", i, h0)
2023-05-28 19:59:57 +02:00
}
2024-06-01 01:01:58 +02:00
for i := 1; i <= schema.LogsSchemaVersion; i++ {
h0, err := sq.HashGoSqliteSchema(ctx, schema.LogsSchema[i].SQL)
2023-05-28 19:59:57 +02:00
if err != nil {
h0 = "ERR"
}
2024-06-01 01:01:58 +02:00
fmt.Printf("LogsSchema%d := %s\n", i, h0)
2023-05-28 19:59:57 +02:00
}
2024-06-01 01:01:58 +02:00
fmt.Println()
2023-05-28 19:59:57 +02:00
}