diff --git a/vidformer-igni/init/setup.sql b/vidformer-igni/init/setup.sql index 07b4170..4c51a0c 100644 --- a/vidformer-igni/init/setup.sql +++ b/vidformer-igni/init/setup.sql @@ -60,7 +60,7 @@ CREATE TABLE spec_t ( pos INT NOT NULL, t_numer BIGINT NOT NULL, t_denom BIGINT NOT NULL, - frame JSONB, + frame TEXT, PRIMARY KEY (spec_id, pos) ); @@ -100,7 +100,7 @@ CREATE TABLE spec_part_staged_t ( in_part_pos INT NOT NULL, t_numer BIGINT, t_denom BIGINT, - frame JSONB, + frame TEXT, PRIMARY KEY (spec_id, pos, in_part_pos), FOREIGN KEY (spec_id, pos) REFERENCES spec_part_staged(spec_id, pos) ); diff --git a/vidformer-igni/src/server/api.rs b/vidformer-igni/src/server/api.rs index c9f0b6f..c608844 100644 --- a/vidformer-igni/src/server/api.rs +++ b/vidformer-igni/src/server/api.rs @@ -342,13 +342,13 @@ pub(crate) async fn push_part( let mut in_part_poss = Vec::with_capacity(req.frames.len()); let mut t_numers = Vec::with_capacity(req.frames.len()); let mut t_denoms = Vec::with_capacity(req.frames.len()); - let mut frames: Vec> = Vec::with_capacity(req.frames.len()); + let mut frames: Vec> = Vec::with_capacity(req.frames.len()); for (idx, ((numer, denom), frame)) in req.frames.iter().enumerate() { in_part_poss.push(idx as i32); t_numers.push(numer); t_denoms.push(denom); if let Some(expr) = frame { - frames.push(Some(serde_json::to_value(expr).unwrap())); + frames.push(Some(serde_json::to_string(expr).unwrap())); } else { frames.push(None); } @@ -446,7 +446,7 @@ pub(crate) async fn push_part( .execute(&mut *transaction) .await?; - sqlx::query("INSERT INTO spec_part_staged_t (spec_id, pos, in_part_pos, t_numer, t_denom, frame) VALUES (unnest($1::uuid[]), unnest($2::int[]), unnest($3::int[]), unnest($4::bigint[]), unnest($5::bigint[]), unnest($6::jsonb[]))") + sqlx::query("INSERT INTO spec_part_staged_t (spec_id, pos, in_part_pos, t_numer, t_denom, frame) VALUES (unnest($1::uuid[]), unnest($2::int[]), unnest($3::int[]), unnest($4::bigint[]), unnest($5::bigint[]), unnest($6::text[]))") .bind(&spec_ids) .bind(&pos) .bind(&in_part_poss) diff --git a/vidformer-igni/src/server/vod.rs b/vidformer-igni/src/server/vod.rs index e2640b7..7efe94e 100644 --- a/vidformer-igni/src/server/vod.rs +++ b/vidformer-igni/src/server/vod.rs @@ -231,7 +231,7 @@ pub(crate) async fn get_segment( }; // Get the frames from spec_t that are in the segment (pos between first_t and last_t) - let rows: Vec<(i64, i64, serde_json::Value)> = sqlx::query_as( + let rows: Vec<(i64, i64, String)> = sqlx::query_as( "SELECT t_numer, t_denom, frame FROM spec_t WHERE spec_id = $1 AND pos BETWEEN $2 AND $3", ) .bind(spec_id) @@ -251,7 +251,7 @@ pub(crate) async fn get_segment( // Map json values to FrameExpr let frames: Vec = rows .iter() - .map(|(_, _, frame)| serde_json::from_value(frame.clone()).unwrap()) + .map(|(_, _, frame)| serde_json::from_str(frame).unwrap()) .collect(); struct IgniSpec {