From: Ian Jackson Date: Wed, 19 Aug 2009 22:49:50 +0000 (+0100) Subject: Some notes regarding database corruption fix X-Git-Tag: 3.2^0 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=commitdiff_plain;h=b68be7297b05abe0cea44e69f4c6a9b30b1efb68 Some notes regarding database corruption fix --- diff --git a/yarrg/devel-notes b/yarrg/devel-notes new file mode 100644 index 0000000..27335dd --- /dev/null +++ b/yarrg/devel-notes @@ -0,0 +1,15 @@ +To remedy bug fixed in 01c14767c024ac56686dbbfcd88d9f3a0b4b1574, +did this: + +sqlite> begin; +sqlite> insert or ignore into stalls select null, buy.islandid, stalls.stallname from buy, stalls using (stallid); +sqlite> insert or ignore into stalls select null, sell.islandid, stalls.stallname from sell, stalls using (stallid); +sqlite> update buy set stallid = (select stallid from stalls where stalls.islandid == buy.islandid and stalls.stallname == (select stallname from stalls as bad where buy.stallid == bad.stallid)); +sqlite> update sell set stallid = (select stallid from stalls where stalls.islandid == sell.islandid and stalls.stallname == (select stallname from stalls as bad where sell.stallid == bad.stallid)); +sqlite> commit; + +And to check that it worked: + +sqlite> select * from buy offers, stalls using (stallid) where offers.islandid != stalls.islandid group by offers.islandid; +sqlite> select * from sell offers, stalls using (stallid) where offers.islandid != stalls.islandid group by offers.islandid; +sqlite>