-- Crawling history of software origin visits by Software Heritage. Each -- visit see its history change through new origin visit status updates create table origin_visit_status ( origin bigint not null, visit bigint not null, date timestamptz not null, status origin_visit_state not null, metadata jsonb, snapshot sha1_git ); comment on column origin_visit_status.origin is 'Origin concerned by the visit update'; comment on column origin_visit_status.visit is 'Visit concerned by the visit update'; comment on column origin_visit_status.date is 'Visit update timestamp'; comment on column origin_visit_status.status is 'Visit status (ongoing, failed, full)'; comment on column origin_visit_status.metadata is 'Optional origin visit metadata'; comment on column origin_visit_status.snapshot is 'Optional, possibly partial, snapshot of the origin visit.'; alter table origin_visit_status owner to swhstorage; grant select on all tables in schema public to guest; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 0 <= origin and origin < 1000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 1000000 <= origin and origin < 2000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 2000000 <= origin and origin < 3000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 3000000 <= origin and origin < 4000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 4000000 <= origin and origin < 5000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 5000000 <= origin and origin < 6000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 6000000 <= origin and origin < 7000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 7000000 <= origin and origin < 8000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 8000000 <= origin and origin < 9000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 9000000 <= origin and origin < 10000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 10000000 <= origin and origin < 11000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 11000000 <= origin and origin < 12000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 12000000 <= origin and origin < 13000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 13000000 <= origin and origin < 14000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 14000000 <= origin and origin < 15000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 15000000 <= origin and origin < 16000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 16000000 <= origin and origin < 17000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 17000000 <= origin and origin < 18000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 18000000 <= origin and origin < 19000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 19000000 <= origin and origin < 20000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 20000000 <= origin and origin < 21000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 21000000 <= origin and origin < 22000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 22000000 <= origin and origin < 23000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 23000000 <= origin and origin < 24000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 24000000 <= origin and origin < 25000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 25000000 <= origin and origin < 26000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 26000000 <= origin and origin < 27000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 27000000 <= origin and origin < 28000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 28000000 <= origin and origin < 29000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 29000000 <= origin and origin < 30000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 30000000 <= origin and origin < 31000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 31000000 <= origin and origin < 32000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 32000000 <= origin and origin < 33000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 33000000 <= origin and origin < 34000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 34000000 <= origin and origin < 35000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 35000000 <= origin and origin < 36000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 36000000 <= origin and origin < 37000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 37000000 <= origin and origin < 38000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 38000000 <= origin and origin < 39000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 39000000 <= origin and origin < 40000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 40000000 <= origin and origin < 41000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 41000000 <= origin and origin < 42000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 42000000 <= origin and origin < 43000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 43000000 <= origin and origin < 44000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 44000000 <= origin and origin < 45000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 45000000 <= origin and origin < 46000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 46000000 <= origin and origin < 47000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 47000000 <= origin and origin < 48000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 48000000 <= origin and origin < 49000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 49000000 <= origin and origin < 50000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 50000000 <= origin and origin < 51000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 51000000 <= origin and origin < 52000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 52000000 <= origin and origin < 53000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 53000000 <= origin and origin < 54000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 54000000 <= origin and origin < 55000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 55000000 <= origin and origin < 56000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 56000000 <= origin and origin < 57000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 57000000 <= origin and origin < 58000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 58000000 <= origin and origin < 59000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 59000000 <= origin and origin < 60000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 60000000 <= origin and origin < 61000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 61000000 <= origin and origin < 62000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 62000000 <= origin and origin < 63000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 63000000 <= origin and origin < 64000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 64000000 <= origin and origin < 65000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 65000000 <= origin and origin < 66000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 66000000 <= origin and origin < 67000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 67000000 <= origin and origin < 68000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 68000000 <= origin and origin < 69000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 69000000 <= origin and origin < 70000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 70000000 <= origin and origin < 71000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 71000000 <= origin and origin < 72000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 72000000 <= origin and origin < 73000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 73000000 <= origin and origin < 74000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 74000000 <= origin and origin < 75000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 75000000 <= origin and origin < 76000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 76000000 <= origin and origin < 77000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 77000000 <= origin and origin < 78000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 78000000 <= origin and origin < 79000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 79000000 <= origin and origin < 80000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 80000000 <= origin and origin < 81000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 81000000 <= origin and origin < 82000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 82000000 <= origin and origin < 83000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 83000000 <= origin and origin < 84000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 84000000 <= origin and origin < 85000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 85000000 <= origin and origin < 86000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 86000000 <= origin and origin < 87000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 87000000 <= origin and origin < 88000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 88000000 <= origin and origin < 89000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 89000000 <= origin and origin < 90000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 90000000 <= origin and origin < 91000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 91000000 <= origin and origin < 92000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 92000000 <= origin and origin < 93000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 93000000 <= origin and origin < 94000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 94000000 <= origin and origin < 95000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 95000000 <= origin and origin < 96000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 96000000 <= origin and origin < 97000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 97000000 <= origin and origin < 98000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 98000000 <= origin and origin < 99000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 99000000 <= origin and origin < 100000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 100000000 <= origin and origin < 101000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 101000000 <= origin and origin < 102000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 102000000 <= origin and origin < 103000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 103000000 <= origin and origin < 104000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 104000000 <= origin and origin < 105000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 105000000 <= origin and origin < 106000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 106000000 <= origin and origin < 107000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 107000000 <= origin and origin < 108000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 108000000 <= origin and origin < 109000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 109000000 <= origin and origin < 110000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 110000000 <= origin and origin < 111000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 111000000 <= origin and origin < 112000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 112000000 <= origin and origin < 113000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 113000000 <= origin and origin < 114000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 114000000 <= origin and origin < 115000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 115000000 <= origin and origin < 116000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 116000000 <= origin and origin < 117000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 117000000 <= origin and origin < 118000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 118000000 <= origin and origin < 119000000; insert into origin_visit_status(origin, visit, date, status, metadata, snapshot) select origin, visit, date, status, metadata, snapshot from origin_visit where 119000000 <= origin and origin < 120000000; -- on belvedere create unique index origin_visit_status_pkey on origin_visit_status(origin, visit, date); alter table origin_visit_status add primary key using index origin_visit_status_pkey; alter table origin_visit_status add constraint origin_visit_status_origin_visit_fkey foreign key (origin, visit) references origin_visit(origin, visit) not valid; alter table origin_visit_status validate constraint origin_visit_status_origin_visit_fkey;