updates on the ai agents and time series prediction and updates on the api to

This commit is contained in:
2026-10-09 13:50:30 +05:30
parent 29690c56f2
commit 153be40e5c
42 changed files with 4889 additions and 186 deletions

40
cmd/migratecheck/main.go Normal file
View File

@@ -0,0 +1,40 @@
// Runs migrations.Migrate() against a throwaway Postgres, so the DDL is
// executed at least once before it runs on a real database at server startup.
//
// The test suite never calls Migrate — the integration tests AutoMigrate the
// models they need — so every raw statement at the end of migrations/migrate.go
// (CREATE EXTENSION, the views, the CONCURRENTLY index, the seed) was
// unexecuted until this existed.
//
// Usage: MIGRATE_CHECK_DSN="host=... " go run ./cmd/migratecheck
package main
import (
"fmt"
"os"
"doormile/db"
"doormile/migrations"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
func main() {
dsn := os.Getenv("MIGRATE_CHECK_DSN")
if dsn == "" {
fmt.Println("MIGRATE_CHECK_DSN is required (a THROWAWAY database)")
os.Exit(2)
}
gdb, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
fmt.Println("connect:", err)
os.Exit(1)
}
db.DB = gdb // the registry seed reads the package handle
if err := migrations.Migrate(gdb); err != nil {
fmt.Println("MIGRATE FAILED:", err)
os.Exit(1)
}
fmt.Println("MIGRATE RETURNED OK")
}