Fix startup crash: add DEFAULT to new watched_boost column
Build and Deploy / build-and-deploy (push) Successful in 1m52s
Build and Deploy / build-and-deploy (push) Successful in 1m52s
ddl-auto=update generated "ALTER TABLE scoring_config ADD COLUMN
watched_boost ... NOT NULL" with no default, which Postgres rejects on the
already-populated singleton config row ("column contains null values").
That aborted the migration, so every later query against scoring_config
failed with "column watched_boost does not exist" - including
/api/recommendations. @ColumnDefault backfills the existing row instead.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e8c795aebc
commit
e31bc87c4f
@@ -3,6 +3,7 @@ package com.recommendarr.entity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
/**
|
||||
* Singleton settings row (id always = 1) holding the configurable weights
|
||||
@@ -42,7 +43,12 @@ public class ScoringConfig {
|
||||
* (>=90% progress), on top of any rewatch amplification. Being watched
|
||||
* is a weight boost only - it never determines source membership.
|
||||
*/
|
||||
// ColumnDefault ensures the ALTER TABLE ... ADD COLUMN ... NOT NULL that
|
||||
// ddl-auto=update generates on an already-populated table carries a
|
||||
// DEFAULT, so Postgres can backfill the existing row instead of failing
|
||||
// with "column contains null values".
|
||||
@Column(nullable = false)
|
||||
@ColumnDefault("0.5")
|
||||
private double watchedBoost = 0.5;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user