WordPress is not creating table in database after activating plugin,

I struggled with this a long time! Can anyone help me? My plugin is not creating a database table once activated. The following code is in the main plugin file.

function woocq_activate() {

    global $wpdb;

    $table_name = $wpdb-prefix . 'woocq';

    $sql = CREATE TABLE $table_name (
        id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
        name VARCHAR NOT NULL,
        message TEXT NOT NULL,
        question_id INT NOT NULL,
        product_id INT DEFAULT NULL,
        timestamp BIGINT NOT NULL,
        PRIMARY KEY  (id)
    );;

    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta( $sql );
    
}
register_activation_hook( __FILE__, 'woocq_activate' );

Thank you in advance!

Topic database Wordpress sql

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.