From b68be7297b05abe0cea44e69f4c6a9b30b1efb68 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 19 Aug 2009 23:49:50 +0100 Subject: [PATCH] Some notes regarding database corruption fix --- yarrg/devel-notes | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 yarrg/devel-notes 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> -- 2.30.2