carlomanf / wp-super-network

Share content between wordpress sites and create offspring networks.
https://wordpress.org/plugins/wp-super-network/
3 stars 0 forks source link

Shared auto-increment does not work with wp-sqlite-db #16

Open carlomanf opened 1 year ago

carlomanf commented 1 year ago

I was testing the plugin with the https://github.com/aaemnnosttv/wp-sqlite-db drop-in and found that the shared auto-increment does not work. This is because sqlite has an entirely different syntax for managing auto-increment to mysql.

Equivalent code for mysql:

SELECT `auto_increment` FROM `information_schema`.`tables` WHERE `table_schema` = 'dbname' AND `table_name` = 'wp_posts';
ALTER TABLE `wp_posts` AUTO_INCREMENT = 100;

Equivalent code for sqlite:

SELECT `seq` FROM `sqlite_sequence` WHERE `name` = 'wp_posts';
UPDATE `sqlite_sequence` SET `seq` = 100 WHERE `name` = 'wp_posts';
carlomanf commented 1 year ago

Upon inspecting the drop-in code, it looks like it rewrites some of the syntax differences itself and perhaps it should handle this too. Given that sqlite support is in flux right now, having been moved into the Performance Lab plugin and potentially later into core, it might be wise to wait for a while before deciding how to proceed.