-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Don't auto-generate indexes for Text field types (fixes #7900) #7945
Conversation
model/DataObject.php
Outdated
if ( | ||
$this->hasOwnTableDatabaseField($column) | ||
&& !array_key_exists($column, $indexes) | ||
&& $fieldType !== 'Text' && !is_subclass_of($fieldType, 'Text') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer a less hard-coded approach here, where we can set a config list of blacklisted index types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure. Do you think DataObject
makes sense, or should it be a setting like DBField.auto_indexable
and then set private static $auto_indexable = false;
on Text
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oooh, I like the latter idea 👍
ba8e47f
to
ce3751d
Compare
Ping @dhensby |
model/DataObject.php
Outdated
@@ -3421,7 +3421,15 @@ public function databaseIndexes() { | |||
continue; | |||
} | |||
|
|||
if ($this->hasOwnTableDatabaseField($column) && !array_key_exists($column, $indexes)) { | |||
list($fieldType) = Object::parse_class_spec($this->db($column)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be SS_Object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
ce3751d
to
ebd3fb6
Compare
merge on green |
#7900