Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AUTO_INCREMENT sequence to show create statements #140

Open
jeroenpf opened this issue Jul 29, 2024 · 0 comments
Open

Add AUTO_INCREMENT sequence to show create statements #140

jeroenpf opened this issue Jul 29, 2024 · 0 comments

Comments

@jeroenpf
Copy link
Contributor

When running the show create table query, the returned create statement does not contain the sequence number for the auto-increment column. It would be good to add this. It can be obtained from the sqlite_sequence table.

Here is an example of a create statement that has the current value for the auto increment column:

CREATE TABLE `wp_options` (
    `option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
     `option_name` varchar(191) NOT NULL DEFAULT '',
     `option_value` longtext NOT NULL,
     `autoload` varchar(20) NOT NULL DEFAULT 'yes',
      PRIMARY KEY (`option_id`),
      UNIQUE KEY `option_name` (`option_name`),
      KEY `autoload` (`autoload`)
) ENGINE=InnoDB AUTO_INCREMENT=313 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

And here is one that the plugin returns:

DROP TABLE IF EXISTS `wp_options`;
CREATE TABLE `wp_options` (
	`option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
	`option_name` varchar(191) NOT NULL DEFAULT '',
	`option_value` longtext NOT NULL DEFAULT '',
	`autoload` varchar(20) NOT NULL DEFAULT 'yes',
	PRIMARY KEY (`option_id`),
	KEY `autoload` (`autoload`),
	UNIQUE KEY `option_name` (`option_name`)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant