when i try to create below table in my sql i got an error stating that
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
CREATE TABLE fields_meta_data
(id varchar(255) NOT NULL ,
name varchar(255) NULL ,
vname varchar(255) NULL ,
comments varchar(255) NULL ,
help varchar(255) NULL ,
custom_module varchar(255) NULL ,
type varchar(255) NULL ,
len int(11) NULL ,
required bool DEFAULT '0' NULL ,
default_value varchar(255) NULL ,
date_modified datetime NULL ,
deleted bool DEFAULT '0' NULL ,
audited bool DEFAULT '0' NULL ,
massupdate bool DEFAULT '0' NULL ,
duplicate_merge smallint DEFAULT '0' NULL ,
reportable bool DEFAULT '1' NULL ,
importable varchar(255) NULL ,
ext1 varchar(255) NULL ,
ext2 varchar(255) NULL ,
ext3 varchar(255) NULL ,
ext4 text NULL ,
PRIMARY KEY (id),
KEY idx_meta_id_del (id, deleted),
KEY idx_meta_cm_del (custom_module, deleted)
)
Why do you need to use such wide fields? Even for
idyou have usedVARCHAR(255).You are trying to create keys/indexes which are just too wide.
If you simply reduce your appetite and use reasonable field defintions, like integer for
id, and other fields narrower than 255, you should get it working in no time.