Feature #12598 » woo-custom-nav-primary-key.php
1 |
<?php
|
---|---|
2 |
|
3 |
global $wpdb; |
4 |
|
5 |
$tables = $wpdb->get_col( "SHOW TABLES LIKE '%woo_custom_nav%'" ); |
6 |
foreach ( $tables as $table ) { |
7 |
if ( $wpdb->get_row( "SHOW INDEX FROM {$table} WHERE Key_name = 'PRIMARY'" ) ) { |
8 |
continue; |
9 |
}
|
10 |
$wpdb->query( "ALTER TABLE {$table} ADD PRIMARY KEY (id)" ); |
11 |
WP_CLI::log( $table ); |
12 |
}
|