• Creating a table fails, even if I use Table Creator to generate the SQL as below:

    CREATE TABLE wp_kdfl_jh (
    ID bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT ‘ID’,
    name text NOT NULL,
    current_amount decimal(20,2) UNSIGNED NOT NULL DEFAULT ‘0.00’,
    max_amount decimal(20,2) UNSIGNED NOT NULL DEFAULT ‘0.00’,
    avg decimal(20,2) UNSIGNED NOT NULL DEFAULT ‘0.00’,
    value decimal(20,2) UNSIGNED NOT NULL DEFAULT ‘0.00’ COMMENT ‘percentage’,
    created datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’ COMMENT ‘Created Datetime’,
    updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘Updated Datetime’,
    PRIMARY KEY(ID) ,
    UNIQUE(name) )
    ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

Viewing 1 replies (of 1 total)
  • Plugin Author ka2

    (@ka2)

    Thank you for your inquiry.

    You should specify character length as unique key if you add unique key to text type column. Please try to modify sql to as follows:

    
    CREATE TABLE wp_kdfl_jh (
      ID bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
      name text NOT NULL,
      current_amount decimal(20,2) unsigned NOT NULL DEFAULT '0.00',
      max_amount decimal(20,2) unsigned NOT NULL DEFAULT '0.00',
      avg decimal(20,2) unsigned NOT NULL DEFAULT '0.00',
      value decimal(20,2) unsigned NOT NULL DEFAULT '0.00' COMMENT 'percentage',
      created datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Created Datetime',
      updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Updated Datetime',
      PRIMARY KEY (ID),
      UNIQUE KEY name (name(255))
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    

    Please try again.
    Thank you,

Viewing 1 replies (of 1 total)
  • The topic ‘creating table fails’ is closed to new replies.