Wednesday, April 12, 2017

index using four columns

I have a search query where a row is obtained using four columns.A row is only unique when these four column is used in a query.In my migration file i used the column as index like the following :

$table->index(['adform_clientID','adform_campaignID','fb_clientID','fb_campaignID']);

But whenever i run the migration i get the following error:

SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'campaign_merge_adform_clientid_adform_camp
  aignid_fb_clientid_fb_campaignid_index' is too long (SQL: alter table `campaign_merge` add index `campaign_merge_ad
  form_clientid_adform_campaignid_fb_clientid_fb_campaignid_index`(`adform_clientID`, `adform_campaignID`, `fb_client
  ID`, `fb_campaignID`))

how to overcome this type error ?



via AL-zami

Advertisement