0

I want to create a table in my wordpress database with a column that is an index. But I can't seem to make it work with this code:

 $table_name_t2mtokens = $wpdb->prefix . "t2mtokens";
    $charset_collate_is = $wpdb->get_charset_collate();
 $createTableTokens =
    "CREATE TABLE $table_name_t2mtokens (
        ID INT NOT NULL AUTO_INCREMENT,
        token TEXT NOT NULL,
        refresh_token TEXT NOT NULL,
        PRIMARY KEY (ID),
        INDEX token (token)
    )$charset_collate_is;";

 maybe_create_table($table_name_t2mtokens, $createTableTokens );

Can anyone suggest me a working method to do so?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.