I wrote a Plugin, which creates a table on activation. On previous WP Versions, it worked fine.
Now it doesn't. This is my function:
function on_activation(){
global $wpdb;
$table_name = $wpdb->prefix."tc_competition_data_all_countries_and_fields";
$sql = "CREATE TABLE $table_name (
mail VARCHAR(55),
id VARCHAR(255) NOT NULL,
time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
name VARCHAR(255) NOT NULL,
stra VARCHAR(255) NOT NULL,
ort VARCHAR(255) NOT NULL,
uid VARCHAR(255) NOT NULL,
msg VARCHAR(500) NOT NULL,
meta1 VARCHAR(500) NOT NULL,
meta2 VARCHAR(500) NOT NULL,
UNIQUE KEY id (id)
);";
#dbDelta( $sql );
$c = dbDelta( $sql );
}
It gets fied with this hook:
register_activation_hook( __FILE__, array( 'tc_comp_form', 'on_activation' ) );
When I do a vardump in for $c
, it returns, that the table has been created, but it does not exists.
What could be the issue?
Many Thanks!
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
prior to calling dbdelta($sql), but I'm figuring that was omitted in the question by accident? mysql v10.1.10-MariaDB