-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Description
When we dump an SQLite database table that had keys set on text fields with specific lengths set, it produces an SQL dump that can't be inserted into a MySQL database.
The following table is imported to SQLite:
CREATE TABLE `wp_wc_orders_meta` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`order_id` bigint(20) unsigned DEFAULT NULL,
`meta_key` varchar(255) DEFAULT NULL,
`meta_value` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `meta_key_value` (`meta_key`(100),`meta_value`(82)),
KEY `order_id_meta_key_meta_value` (`order_id`,`meta_key`(100),`meta_value`(82))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
After exporting, key length properties are forgotten, and such a table can't be created on MySQL server anymore due to too long key:
CREATE TABLE `wp_wc_orders_meta` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`order_id` bigint(20) unsigned DEFAULT NULL,
`meta_key` varchar(255) DEFAULT NULL,
`meta_value` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `order_id_meta_key_meta_value` (`order_id`, `meta_key`, `meta_value`),
KEY `meta_key_value` (`meta_key`, `meta_value`)
);
Done is:
- Produced create table query can be imported to MySQL
Metadata
Metadata
Assignees
Labels
No labels