feat(ws server): added in a websocket on port system to help with better logging
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
||||
|
||||
var DB *gorm.DB
|
||||
|
||||
type JSONB map[string]interface{}
|
||||
|
||||
func InitDB() error {
|
||||
dsn := fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s",
|
||||
os.Getenv("DB_HOST"),
|
||||
@@ -25,8 +27,17 @@ func InitDB() error {
|
||||
return fmt.Errorf("failed to connect to database: %v", err)
|
||||
}
|
||||
|
||||
// Auto-migrate all models
|
||||
DB.AutoMigrate(&Log{}) // Add other models here
|
||||
fmt.Println("✅ Connected to database")
|
||||
|
||||
// ensures we have the uuid stuff setup properly
|
||||
DB.Exec(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`)
|
||||
|
||||
err = DB.AutoMigrate(&Log{}, &Config{}, &ClientRecord{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to auto-migrate models: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("✅ Database migration completed successfully")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user