package updates import ( "github.com/go-gormigrate/gormigrate/v2" "gorm.io/gorm" ) // aiModelsMigration creates golem15_golem_models, one row per AI model // (the WinterCMS plugin kept them as a repeater inside its system_settings // row; golem:import-settings copies them over once). var aiModelsMigration = &gormigrate.Migration{ ID: "202610030101_create_golem_models", Migrate: func(tx *gorm.DB) error { return tx.Exec(` CREATE TABLE golem15_golem_models ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, adapter TEXT NOT NULL DEFAULT 'openai', api_key TEXT, base_url TEXT, model TEXT NOT NULL, system_prompt TEXT, is_enabled BOOLEAN NOT NULL DEFAULT FALSE, is_default BOOLEAN NOT NULL DEFAULT FALSE, generates_images BOOLEAN NOT NULL DEFAULT FALSE, accepts_images BOOLEAN NOT NULL DEFAULT FALSE, has_files_endpoint BOOLEAN NOT NULL DEFAULT FALSE, max_completion_tokens INTEGER DEFAULT 4096, sort_order INTEGER NOT NULL DEFAULT 0, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() )`).Error }, Rollback: func(tx *gorm.DB) error { return tx.Exec(`DROP TABLE IF EXISTS golem15_golem_models`).Error }, } func init() { Register(aiModelsMigration) }