fix: guard all legacy migrations against fresh schema for CI compat

On fresh databases, 0001_init.up.sql creates providers/provider_id
(not llm_providers/llm_provider_id). Migrations 0013, 0041, 0046, 0047
referenced the old names without guards, causing CI migration failures.

- 0013: check llm_provider_id column exists before adding old constraint
- 0041: check llm_providers table exists before backfill/constraint DDL
- 0046: wrap CREATE TABLE in DO block with llm_providers existence check
- 0047: use ALTER TABLE IF EXISTS + DO block guard
This commit is contained in:
Acbox
2026-04-08 00:59:04 +08:00
parent 889b6dbaa4
commit e9b7acd2b4
5 changed files with 52 additions and 42 deletions
-14
View File
@@ -298,20 +298,6 @@ type LifecycleEvent struct {
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type LlmProviderOauthToken struct {
ID pgtype.UUID `json:"id"`
LlmProviderID pgtype.UUID `json:"llm_provider_id"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
Scope string `json:"scope"`
TokenType string `json:"token_type"`
State string `json:"state"`
PkceCodeVerifier string `json:"pkce_code_verifier"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type McpConnection struct {
ID pgtype.UUID `json:"id"`
BotID pgtype.UUID `json:"bot_id"`