diff --git a/README.md b/README.md index 3198a3d..c582b3e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ For further details, visit the [ZXDB forum section](https://spectrumcomputing.co Simply download the latest database content, then load it into MySQL/MariaDB: -* `ZXDB_mysql.sql` - The latest complete ZXDB database script for MySQL/MariaDB. That's all you really need! +* `ZXDB_mysql.sql.zip` - The latest complete ZXDB database script for MySQL/MariaDB. That's all you really need! Optionally you can execute one of the provided scripts to convert file `ZXDB_mysql.sql` above to a different RDBMS: @@ -21,18 +21,14 @@ Optionally you can execute one of the provided scripts to convert file `ZXDB_mys * `scripts/ZXDB_to_generic.groovy` - Groovy script to convert ZXDB into a (more) generic SQL -The ZXDB distribution already includes all links to [RZX Archive](http://www.rzxarchive.co.uk/), but these links can also be updated independently. There's a separate script to import these links into ZXDB: - -* `scripts/ZXDB_import_rzx.sql` - Script to import [RZX Archive](http://www.rzxarchive.co.uk/) links from file [RZXArchiveZXDB.txt](https://spectrumcomputing.co.uk/RZXArchiveZXDB.txt) - -The ZXDB distribution already includes all links to [Speccy Screenshot Maps](http://maps.speccy.cz/), but these links can also be updated independently. There's another separate script to import these links into ZXDB: - -* `scripts/ZXDB_import_mapy.sql` - Script to import [Speccy Screenshot Maps](http://maps.speccy.cz/) links from file [mapy.txt](https://maps.speccy.cz/mapy.txt) - There's also an optional script to create auxiliary tables, that can be used to help database searches. Ideally these tables must be repopulated whenever ZXDB content changes, or defined as materialized views in a RDBMS that supports it: * `scripts/ZXDB_help_search.sql` - Script to create auxiliary tables prefixed with `search_by_` +The ZXDB distribution already includes links and references to integrated sites like [Speccy Screenshot Maps](http://maps.speccy.cz/) and [ZX-Spectrum Reviews (ZXSR)](http://zxspectrumreviews.co.uk/), but this information can also be updated independently. There are separate scripts to reimport them into ZXDB: + +* `scripts/*-ZXDB_import_*.sql` - Scripts to reimport information from integrated sites (additional details are explained in each file) + Finally there's a script for health checking, that validates ZXDB consistency rules that cannot be enforced by check constraints: * `scripts/ZXDB_health_check.sql` - Script to identify data inconsistencies in ZXDB diff --git a/ZXDB_mysql.sql.zip b/ZXDB_mysql.sql.zip index 758424b..b4badd1 100644 Binary files a/ZXDB_mysql.sql.zip and b/ZXDB_mysql.sql.zip differ diff --git a/scripts/07-ZXDB_import_demozoo.sql b/scripts/01-ZXDB_import_demozoo.sql similarity index 95% rename from scripts/07-ZXDB_import_demozoo.sql rename to scripts/01-ZXDB_import_demozoo.sql index 36b14c5..7297f66 100644 --- a/scripts/07-ZXDB_import_demozoo.sql +++ b/scripts/01-ZXDB_import_demozoo.sql @@ -1,5 +1,5 @@ -- [ZXDB] Import into ZXDB some data from Demozoo. --- The latest Demozoo database dump is available at https://demozoo.org/pages/faq/ +-- The latest Demozoo database dump is available for download at https://demozoo.org/pages/faq/ -- by Einar Saukas USE zxdb; @@ -32,7 +32,7 @@ order by name; -- Categories from Demozoo not in ZXDB select concat('(''',category,'''),') as 'insert into categories(text) values' from ( -select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(c.name,'CAFePARTY 2019 Invitations','Invitation'),' Tiny Intro (256b)',' 256b Intro'),' Intro 256B',' 256b Intro'),' Intro 4KB',' 4K Intro'),'640k ','640K '),' Byte ','b '),'Kb ','K '),'kb ','K '),'1k','1K'),'4k','4K'),'8-bit - ','8Bit '),'8-bit ','8Bit '),'8bit','8Bit'),' plattform ',' Platform '),' intro',' Intro'),'Oldskool demo','Oldskool Demo'),'(normal results)',''),'(alternative results)','') as category +select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(c.name,'CAFePARTY 2019 Invitations','Invitation'),' Tiny Intro (256b)',' 256b Intro'),' Intro 256B',' 256b Intro'),' Intro 4KB',' 4K Intro'),'640k ','640K '),' Byte ','b '),'Kb ','K '),'kb ','K '),'1k','1K'),'4k','4K'),'8-bit - ','8Bit '),'8-bit ','8Bit '),'8bit','8Bit'),' plattform ',' Platform '),' intro',' Intro'),' demo',' Demo'),'(normal results)',''),'(alternative results)','') as category from zxdb.entries e inner join zxdb.webrefs w on w.entry_id = e.id and w.website_id = 48 inner join public.productions_production p on p.id = replace(replace(w.link,'https://demozoo.org/productions/',''),'/','') @@ -53,7 +53,7 @@ inner join public.parties_competitionplacing n on p.id = n.production_id inner join public.parties_competition c on n.competition_id = c.id inner join public.parties_party y on c.party_id = y.id inner join zxdb.tags t on t.name = y.name -inner join zxdb.categories g on g.text = replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(c.name,'CAFePARTY 2019 Invitations','Invitation'),' Tiny Intro (256b)',' 256b Intro'),' Intro 256B',' 256b Intro'),' Intro 4KB',' 4K Intro'),'640k ','640K '),' Byte ','b '),'Kb ','K '),'kb ','K '),'1k','1K'),'4k','4K'),'8-bit - ','8Bit '),'8-bit ','8Bit '),'8bit','8Bit'),' plattform ',' Platform '),' intro',' Intro'),'Oldskool demo','Oldskool Demo'),'(normal results)',''),'(alternative results)','') +inner join zxdb.categories g on g.text = replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(c.name,'CAFePARTY 2019 Invitations','Invitation'),' Tiny Intro (256b)',' 256b Intro'),' Intro 256B',' 256b Intro'),' Intro 4KB',' 4K Intro'),'640k ','640K '),' Byte ','b '),'Kb ','K '),'kb ','K '),'1k','1K'),'4k','4K'),'8-bit - ','8Bit '),'8-bit ','8Bit '),'8bit','8Bit'),' plattform ',' Platform '),' intro',' Intro'),' demo',' Demo'),'(normal results)',''),'(alternative results)','') left join zxdb.members m on m.tag_id = t.id and m.entry_id = e.id and m.category_id = g.id where m.tag_id is null and t.id not in (30046) union all diff --git a/scripts/01-ZXDB_import_mapy.sql b/scripts/03-ZXDB_import_mapy.sql similarity index 100% rename from scripts/01-ZXDB_import_mapy.sql rename to scripts/03-ZXDB_import_mapy.sql diff --git a/scripts/03-ZXDB_import_mirror.sql b/scripts/05-ZXDB_import_mirror.sql similarity index 100% rename from scripts/03-ZXDB_import_mirror.sql rename to scripts/05-ZXDB_import_mirror.sql diff --git a/scripts/08-ZXDB_import_nvg.sql b/scripts/06-ZXDB_import_nvg.sql similarity index 100% rename from scripts/08-ZXDB_import_nvg.sql rename to scripts/06-ZXDB_import_nvg.sql diff --git a/scripts/05-ZXDB_import_lemon64.sql b/scripts/07-ZXDB_import_lemon64.sql similarity index 100% rename from scripts/05-ZXDB_import_lemon64.sql rename to scripts/07-ZXDB_import_lemon64.sql diff --git a/scripts/06-ZXDB_import_amiga.sql b/scripts/08-ZXDB_import_amiga.sql similarity index 100% rename from scripts/06-ZXDB_import_amiga.sql rename to scripts/08-ZXDB_import_amiga.sql diff --git a/scripts/ZXDB_health_check.sql b/scripts/ZXDB_health_check.sql index 99e3f64..d56540a 100644 --- a/scripts/ZXDB_health_check.sql +++ b/scripts/ZXDB_health_check.sql @@ -146,7 +146,7 @@ select * from ( select e.id,e.title,t.text,'game editor for unidentified game' from entries e inner join genretypes t on e.genretype_id = t.id where e.genretype_id = 53 and e.id not in (select entry_id from relations where relationtype_id = 'e') union all select e.id,e.title,r.link,'mismatching web link' from entries e inner join webrefs r on r.entry_id = e.id inner join websites w on r.website_id = w.id where not ( -r.link like concat(w.link,'%') or (r.website_id=10 and r.link like 'https://%.wikipedia.org/wiki/%') or (r.website_id in (16,19,36,37) and r.link like 'https://youtu.be/%') or (r.website_id in (16,19) and r.link like 'https://www.youtube.com/%') or (r.website_id=31 and r.link like 'https://%.itch.io/%')) +r.link like concat(w.link,'%') or (r.website_id=10 and r.link like 'https://%.wikipedia.org/wiki/%') or (r.website_id in (16,19,36,37) and r.link like 'https://youtu.be/%') or (r.website_id in (16,19,47) and r.link like 'https://www.youtube.com/%') or (r.website_id=31 and r.link like 'https://%.itch.io/%')) union all select e.id,e.title,concat(coalesce(r.release_year,'-'),'/',coalesce(r.release_month,'-'),'/',coalesce(r.release_day,'-'),' vs ',coalesce(i.date_year,'-'),'/',coalesce(i.date_month,'-'),'/',coalesce(i.date_day,'-')),'conflicting original publication date between tape and magazine' from entries e inner join releases r on r.entry_id = e.id and r.release_seq = 0 inner join issues i on i.id = e.issue_id where e.genretype_id <> 81 and e.id not in (select entry_id from contents where is_original=1) and e.id not in (select entry_id from booktypeins where is_original=1) and e.id not in (select entry_id from magrefs where is_original=1) and (coalesce(r.release_year,-1) <> coalesce(i.date_year,-1) or coalesce(r.release_month,-1) <> coalesce(i.date_month,-1) or coalesce(r.release_day,-1) <> coalesce(i.date_day,-1)) union all @@ -213,8 +213,6 @@ select * from ( select null,null,file_link,'file to be identified and moved to table "downloads"' from files where label_id is null and issue_id is null and tool_id is null and (file_link like '/pub/sinclair/books-pics/%' or file_link like '/pub/sinclair/games-%' or file_link like '/pub/sinclair/hardware-%' or file_link like '/pub/sinclair/slt/%' or file_link like '/pub/sinclair/technical-%' or file_link like '/pub/sinclair/zx81/%') union all select null,null,m.name,'label and magazine with same name' from magazines m inner join labels b on m.name = b.name where b.name not in ('48K','Gamestar','Kiddisoft','Maximum') - union all - select e.id,e.title,group_concat(b.name order by p.publisher_seq separator ' / '),'scene demo without Demozoo link' from entries e inner join publishers p on p.entry_id = e.id and p.release_seq = 0 inner join labels b on p.label_id = b.id where e.genretype_id = 79 and e.id not in (select entry_id from webrefs where website_id = 48) group by e.id ) as warnings order by entry_id, details;