Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save conschneider/c7b5ca8cf76a94b2df88f2c30756046b to your computer and use it in GitHub Desktop.
Save conschneider/c7b5ca8cf76a94b2df88f2c30756046b to your computer and use it in GitHub Desktop.
Please note the wp_ prefix and change accordingly if needed! Also check the table names so you don't drop data of tables already there!
/*
* Please note the wp_ prefix and change accordingly if needed!
* Also check the table names so you don't drop data of tables already there!
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for wp_wc_reserved_stock
-- ----------------------------
DROP TABLE IF EXISTS `wp_wc_reserved_stock`;
CREATE TABLE `wp_wc_reserved_stock` (
`order_id` bigint(20) NOT NULL,
`product_id` bigint(20) NOT NULL,
`stock_quantity` double NOT NULL DEFAULT '0',
`timestamp` datetime NOT NULL DEFAULT '0000-01-01 00:00:00',
`expires` datetime NOT NULL DEFAULT '0000-01-01 00:00:00',
PRIMARY KEY (`order_id`,`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- ----------------------------
-- Records of wp_wc_reserved_stock
-- ----------------------------
BEGIN;
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
@charlienewman
Copy link

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Thanks both, I also changed collate to utf8mb4_unicode_ci to be consistent with my DB and it worked a treat :)

@conschneider
Copy link
Author

Thanks both, I also changed collate to utf8mb4_unicode_ci to be consistent with my DB and it worked a treat :)

👍 :).

@rKill3r
Copy link

rKill3r commented Oct 30, 2020

It worked !
Thanks !

@Katrin62-sys
Copy link

Where can I do this? In which file should I change the line?

@conschneider
Copy link
Author

Where can I do this?

This is a SQL query, which you need to run in a database client (i.e. phpMyAdmin)

In which file should I change the line?

I am referring to the table name in line 13.

wp_wc_reserved_stock >> wp_ is the prefix and can differ in installations.

@Katrin62-sys
Copy link

I can't do anything! The error remained. I'm doing something wrong. Please write more details.

@marifrahman
Copy link

I have got the table generated - however still seeing the message :
WooCommerce wp_wc_reserved_stock table creation failed. Does the wp user have CREATE privileges on the wordpress_somedb database?

@conschneider
Copy link
Author

I have got the table generated - however still seeing the message : WooCommerce wp_wc_reserved_stock table creation failed. Does the wp user have CREATE privileges on the wordpress_somedb database?

To my knowledge this happens because these values do not match your environment ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

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