mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 16:06:36 +08:00
e7b777890e
Old schema.sql created tables with inline UNIQUE column constraints, which PostgreSQL auto-names as <table>_<column>_key. GORM expects uni_<table>_<column> (its NamingStrategy convention). On upgrade, AutoMigrate issued DROP CONSTRAINT uni_... against a name that did not exist, crashing startup with SQLSTATE 42704. Add preparePostgresLegacySchema() that runs before autoMigrateAll and renames all five mismatched constraints: - vite_config_name_key -> uni_vite_config_name - peer_share_token_key -> uni_peer_share_token - peer_share_runtime_reservation_id_key -> uni_peer_share_runtime_reservation_id - peer_share_runtime_resource_key_key -> uni_peer_share_runtime_resource_key - federation_tunnel_binding_resource_key_key -> uni_federation_tunnel_binding_resource_key The function is idempotent: it checks information_schema before each rename so re-runs on already-migrated databases are no-ops. Co-authored-by: Antigravity <antigravity@google.com>