<?php

global $wpdb;

$tables = $wpdb->get_col( "SHOW TABLES LIKE '%dls_sus%'" );
foreach ( $tables as $table ) {
	if ( $wpdb->get_row( "SHOW INDEX FROM {$table} WHERE Key_name = 'PRIMARY'" ) ) {
		WP_CLI::log( "$table already has primary key" );
		continue;
	}
	$wpdb->query( "ALTER TABLE {$table} ADD PRIMARY KEY (id)" );
	WP_CLI::log( $table );
}
