22 lines
962 B
SQL
22 lines
962 B
SQL
-- ================================================================
|
|
-- Migration 005: Change duration_secs to FLOAT8
|
|
-- Version: 005
|
|
-- Date: 2026-03-26
|
|
-- Description: Change processor_results.duration_secs from INT to FLOAT8
|
|
-- to match Rust f64 type and preserve fractional seconds.
|
|
-- ================================================================
|
|
|
|
-- 5.1.1: Drop the existing generated column
|
|
ALTER TABLE processor_results DROP COLUMN IF EXISTS duration_secs;
|
|
|
|
-- 5.1.2: Re-add as double precision (float8) computed column
|
|
ALTER TABLE processor_results ADD COLUMN duration_secs DOUBLE PRECISION GENERATED ALWAYS AS (
|
|
CASE
|
|
WHEN completed_at IS NOT NULL AND started_at IS NOT NULL
|
|
THEN EXTRACT(EPOCH FROM (completed_at - started_at))
|
|
ELSE NULL
|
|
END
|
|
) STORED;
|
|
|
|
-- 5.1.3: Update comment
|
|
COMMENT ON COLUMN processor_results.duration_secs IS 'Computed duration in seconds (completed - started) as double precision'; |