perlsky is a Perl 5 implementation of an AT Protocol Personal Data Server.
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

Stop duplicating repo head columns

alice 45169baf 2b0ad297

+12 -8
+5 -8
lib/ATProto/PDS/Store/SQLite.pm
··· 1718 1718 my $now = $args{indexed_at} // time; 1719 1719 $self->dbh->do( 1720 1720 q{ 1721 - INSERT INTO repo_heads (did, commit_cid, rev, root_cid, indexed_at) 1722 - VALUES (?, ?, ?, ?, ?) 1721 + INSERT INTO repo_heads (did, indexed_at) 1722 + VALUES (?, ?) 1723 1723 ON CONFLICT(did) DO UPDATE SET 1724 - commit_cid = excluded.commit_cid, 1725 - rev = excluded.rev, 1726 - root_cid = excluded.root_cid, 1724 + commit_cid = NULL, 1725 + rev = NULL, 1726 + root_cid = NULL, 1727 1727 indexed_at = excluded.indexed_at 1728 1728 }, 1729 1729 undef, 1730 1730 $did, 1731 - $args{commit_cid}, 1732 - $args{rev}, 1733 - $args{root_cid}, 1734 1731 $now, 1735 1732 ); 1736 1733 $self->dbh->do(
+7
t/store-sqlite.t
··· 104 104 root_cid => 'bafyroot', 105 105 ); 106 106 is($store->get_repo_head($account->{did})->{rev}, '3k6h2w3px2', 'repo head metadata is stored'); 107 + my $repo_head_row = $store->dbh->selectrow_hashref( 108 + q{SELECT commit_cid, rev, root_cid FROM repo_heads WHERE did = ?}, 109 + undef, 110 + $account->{did}, 111 + ); 112 + ok(!defined $repo_head_row->{commit_cid} && !defined $repo_head_row->{rev} && !defined $repo_head_row->{root_cid}, 113 + 'repo_heads no longer stores duplicate commit metadata'); 107 114 108 115 $store->dbh->do(q{DELETE FROM repo_heads WHERE did = ?}, undef, $account->{did}); 109 116 is(