WordPress create database not working

dbDelta() is very picky, below I’ve checked the requirements for dbDelta() in your code. As you can see below your code fails two of the requirements which most likely prevents dbDelta() from creating the tables.

  • You must put each field on its own line in your SQL statement. CHECK
  • You must have two spaces between the words PRIMARY KEY and the definition of your primary key. CHECK
  • You must use the key word KEY rather than its synonym INDEX and you must include at least one KEY. N/A
  • KEY must be followed by a SINGLE SPACE then the key name then a space then open parenthesis with the field name then a closed parenthesis. N/A
  • You must not use any apostrophes or backticks around field names. CHECK
  • Field types must be all lowercase. FAIL
  • SQL keywords, like CREATE TABLE and UPDATE, must be uppercase. CHECK
  • You must specify the length of all fields that accept a length parameter. int(11), for example. FAIL

Also

From the documentation:

The dbDelta function examines the current table structure, compares it
to the desired table structure, and either adds or modifies the table
as necessary

Therefor your initial check if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { is redundant as dbDelta() does that for you.