Parakeet is a Rust-based Bluesky AppView aiming to implement most of the functionality required to support the Bluesky client

feat!: change records table to store cid as bytes

Changed files
+5 -5
consumer
migrations
2025-05-03-103435_records
parakeet-db
src
+2 -2
consumer/src/db/copy.rs
··· 384 384 let writer = conn 385 385 .copy_in("COPY records_tmp (at_uri, did, cid) FROM STDIN (FORMAT binary)") 386 386 .await?; 387 - let writer = BinaryCopyInWriter::new(writer, &[Type::TEXT, Type::TEXT, Type::TEXT]); 387 + let writer = BinaryCopyInWriter::new(writer, &[Type::TEXT, Type::TEXT, Type::BYTEA]); 388 388 389 389 pin_mut!(writer); 390 390 391 391 for (at_uri, cid) in data { 392 392 let writer = writer.as_mut(); 393 - writer.write(&[&at_uri, &did, &cid.to_string()]).await?; 393 + writer.write(&[&at_uri, &did, &cid.to_bytes()]).await?; 394 394 } 395 395 396 396 writer.finish().await?;
+1 -1
consumer/src/db/record.rs
··· 13 13 ) -> PgExecResult { 14 14 conn.execute( 15 15 "INSERT INTO records (at_uri, did, cid) VALUES ($1, $2, $3) ON CONFLICT (at_uri) DO UPDATE SET cid=EXCLUDED.cid", 16 - &[&at_uri, &repo, &cid.to_string()], 16 + &[&at_uri, &repo, &cid.to_bytes()], 17 17 ).await 18 18 } 19 19
+1 -1
migrations/2025-05-03-103435_records/up.sql
··· 1 1 create table records 2 2 ( 3 3 at_uri text not null primary key, 4 - cid text not null, 4 + cid bytea not null, 5 5 6 6 did text not null, 7 7 indexed_at timestamp not null default now()
+1 -1
parakeet-db/src/schema.rs
··· 271 271 diesel::table! { 272 272 records (at_uri) { 273 273 at_uri -> Text, 274 - cid -> Text, 274 + cid -> Bytea, 275 275 did -> Text, 276 276 indexed_at -> Timestamp, 277 277 }