Skip to content

Instantly share code, notes, and snippets.

@JeroenDeDauw
Last active December 3, 2023 05:30
Show Gist options
  • Save JeroenDeDauw/c86a5ab7e2771301eb506b246f1af7a6 to your computer and use it in GitHub Desktop.
Save JeroenDeDauw/c86a5ab7e2771301eb506b246f1af7a6 to your computer and use it in GitHub Desktop.
-- By Jeroen De Dauw / https://Professional.Wiki
-- License: GPL-2.0-or-later
SELECT * FROM /*_*/wb_id_counters;
REPLACE INTO /*_*/wb_id_counters VALUE((SELECT COALESCE(MAX(CAST(SUBSTRING(`page_title`, 2) AS UNSIGNED)), 0) FROM `page` WHERE `page_namespace` = 120), 'wikibase-item');
REPLACE INTO /*_*/wb_id_counters VALUE((SELECT COALESCE(MAX(CAST(SUBSTRING(`page_title`, 2) AS UNSIGNED)), 0) FROM `page` WHERE `page_namespace` = 122), 'wikibase-property');
SELECT * FROM /*_*/wb_id_counters;
@songnguxyz
Copy link

Are you available for some troubleshooting?

We at WikiTide tries to ran the script but it fails and give us this:

MariaDB [lhmndatawikitide]> SELECT * FROM /*_*/wb_id_counters;
+-------------------+----------+
| id_type           | id_value |
+-------------------+----------+
| wikibase-item     |       14 |
| wikibase-property |       21 |
+-------------------+----------+
2 rows in set (0.000 sec)

MariaDB [lhmndatawikitide]> REPLACE INTO /*_*/wb_id_counters VALUE((SELECT COALESCE(MAX(CAST(SUBSTRING(`page_title`, 2) AS UNSIGNED)), 0) FROM `page` WHERE `page_namespace` = 860), 'wikibase-item');
ERROR 1366 (22007): Incorrect integer value: 'wikibase-item' for column `lhmndatawikitide`.`wb_id_counters`.`id_value` at row 157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment