get_charset_collate(); // dbDelta needs two spaces after PRIMARY KEY and one field per line. dbDelta( "CREATE TABLE {$table} ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, product_id bigint(20) unsigned NOT NULL, parent_id bigint(20) unsigned NOT NULL DEFAULT 0, currency char(3) NOT NULL, price decimal(19,4) NOT NULL, regular_price decimal(19,4) DEFAULT NULL, is_reduced tinyint(1) NOT NULL DEFAULT 0, valid_from datetime NOT NULL, valid_to datetime DEFAULT NULL, source varchar(20) NOT NULL, user_id bigint(20) unsigned DEFAULT NULL, PRIMARY KEY (id), KEY product_time (product_id,currency,valid_from), KEY parent_id (parent_id), KEY valid_to (valid_to) ) {$charset};" ); update_option( self::OPTION_DB_VERSION, self::DB_VERSION, false ); } }