package main import ( "fmt" "nearle/db" "github.com/joho/godotenv" ) func main() { _ = godotenv.Load() db.Connect() if db.DB == nil { fmt.Println("❌ Failed to connect to DB") return } tables := []string{"deliveries", "deliveryqueues", "deliverylogs"} for _, table := range tables { fmt.Printf("\n--- Schema for %s ---\n", table) var results []struct { ColumnName string `gorm:"column:column_name"` DataType string `gorm:"column:data_type"` IsNullable string `gorm:"column:is_nullable"` ColumnDefault *string `gorm:"column:column_default"` } db.DB.Raw(` SELECT column_name, data_type, is_nullable, column_default FROM information_schema.columns WHERE table_name = ? AND column_name LIKE '%id' `, table).Scan(&results) for _, r := range results { def := "NULL" if r.ColumnDefault != nil { def = *r.ColumnDefault } fmt.Printf("Col: %-15s | Type: %-10s | Null: %-3s | Def: %s\n", r.ColumnName, r.DataType, r.IsNullable, def) } } }