Add export_blocks view. Add iexport + audit table.
This commit is contained in:
parent
e1ec43def7
commit
75386c0235
5 changed files with 142 additions and 2 deletions
10
db-migration/migrations/20240312_export_blocks.sql
Normal file
10
db-migration/migrations/20240312_export_blocks.sql
Normal file
|
@ -0,0 +1,10 @@
|
|||
-- Create a block materialized view, don't populate right away.
|
||||
|
||||
create materialized view export_blocks
|
||||
as select repos.did as ":START_ID",
|
||||
records.content ->> 'subject' as ":END_ID"
|
||||
from repos join records on repos.id = records.repo
|
||||
where records.collection = 'app.bsky.graph.block'
|
||||
and records.content ->> 'subject' <> repos.did
|
||||
with no data;
|
||||
create index export_block_subject on export_blocks (":END_ID");
|
16
db-migration/migrations/20240312_export_log.sql
Normal file
16
db-migration/migrations/20240312_export_log.sql
Normal file
|
@ -0,0 +1,16 @@
|
|||
CREATE TABLE incremental_export_log (
|
||||
id SERIAL PRIMARY KEY,
|
||||
collection text NOT NULL,
|
||||
to_tsmp TIMESTAMP NOT NULL,
|
||||
started TIMESTAMP,
|
||||
finished TIMESTAMP,
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX incremental_export_log_idx on incremental_export_log ("collection", "to_tsmp");
|
||||
|
||||
-- manually insert your latest snapshot here
|
||||
-- insert into incremental_export_log (started, finished, to_tsmp, collection) values ('2024-02-27T05:53:30+00:00', '2024-02-27T07:23:30+00:00', '2024-02-27T05:53:30+00:00', 'app.bsky.graph.follow');
|
||||
-- insert into incremental_export_log (started, finished, to_tsmp, collection) values ('2024-02-27T05:53:30+00:00', '2024-02-27T07:23:30+00:00', '2024-02-27T05:53:30+00:00', 'app.bsky.feed.like');
|
||||
-- insert into incremental_export_log (started, finished, to_tsmp, collection) values ('2024-02-27T05:53:30+00:00', '2024-02-27T07:23:30+00:00', '2024-02-27T05:53:30+00:00', 'app.bsky.feed.post');
|
||||
-- insert into incremental_export_log (started, finished, to_tsmp, collection) values ('2024-02-27T05:53:30+00:00', '2024-02-27T07:23:30+00:00', '2024-02-27T05:53:30+00:00', 'did');
|
||||
-- insert into incremental_export_log (started, finished, to_tsmp, collection) values ('2024-02-27T05:53:30+00:00', '2024-02-27T07:23:30+00:00', '2024-02-27T05:53:30+00:00', 'handle');
|
Loading…
Add table
Add a link
Reference in a new issue