Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

unique index for default_settings table #1068

boazhachlili opened this Issue Jan 9, 2012 · 1 comment


None yet
2 participants

While working on module I ran into the following SQL error during the install script's execution:
'Error Number: 1062 Duplicate entry 'thumb_width' for key 'PRIMARY' INSERT INTOdefault_settings(slug,title,description,default,value,type,options,is_required,is_gui,module) VALUES ('thumb_width', 'Thumbnails', 'thumbnail size', '150', '150', 'text', '', 1, 1, 'my_module')

The settings table has an index named "unique - slug" which includes the slug column only. This means that two modules can't have a settings entry with the same slug.

How about adding the module column to this index?
Will that break other functionality of the system?


jerel commented Jan 13, 2012

They have to be unique because Settings::get('setting_slug'); would get multiple settings if there were duplicates. Just append your module name to the beginning of the setting slug when you are creating one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment