Adding collumn with mediumtext as type

CerealGuy

  • Posts: 343
Adding collumn with mediumtext as type
« on June 22nd, 2014, 10:29 PM »Last edited on June 22nd, 2014, 10:50 PM
I'm trying to create a collumn with mediumtext as type via plugin-info.xml.
First the plugin-info.xml:
Code: [Select]
<database>
<tables>
<table if-exists="update" name="{db_prefix}text">
<columns>
<column name="id" autoincrement="yes" type="mediumint" unsigned="yes" />
<column name="test" type="mediumtext" size="255" />
</columns>
<index type="primary">
<field>id</field>
<field>test</field>

</index>
</table>

</tables>
</database>

Error
Code: [Select]
BLOB/TEXT column 'test' used in key specification without a key length
Datei: /home/oqcchckd/public_html/wedge/core/app/Class-DBHelper.php
Zeile: 339

CREATE TABLE wedge_text
(
`id` mediumint(8) unsigned NOT NULL auto_increment,
`test` mediumtext NOT NULL,
PRIMARY KEY (id,test)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

First thought its a problem with the mysql server but tried it on a different host, same error. How do i define the key length and shouldn't be there default values and/or the size parameter used?

Thanks in advance

EDIT: Problem found :D For some reasons its not good to make it primary, related to mysql ^^ Perhaps it helps people with the same problem :D

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Adding collumn with mediumtext as type
« Reply #1, on June 22nd, 2014, 10:54 PM »
Does your text field need to be indexed?

Problem comes from index not specifying a size for the test field... And it can't index the entirety of the field. ;)

CerealGuy

  • Posts: 343