feat: 新增 Job Worker 系統與 API 文檔全面更新
This commit is contained in:
22
migrations/005_change_duration_float.sql
Normal file
22
migrations/005_change_duration_float.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- ================================================================
|
||||
-- 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';
|
||||
Reference in New Issue
Block a user