Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
8a493ab9
Commit
8a493ab9
authored
4 years ago
by
colemanw
Browse files
Options
Downloads
Patches
Plain Diff
SavedSearch: add UI_name index to upgrade script
parent
f1aa7cc1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Core/BAO/SchemaHandler.php
+4
-2
4 additions, 2 deletions
CRM/Core/BAO/SchemaHandler.php
CRM/Upgrade/Incremental/Base.php
+5
-4
5 additions, 4 deletions
CRM/Upgrade/Incremental/Base.php
CRM/Upgrade/Incremental/php/FiveThirtyTwo.php
+1
-0
1 addition, 0 deletions
CRM/Upgrade/Incremental/php/FiveThirtyTwo.php
with
10 additions
and
6 deletions
CRM/Core/BAO/SchemaHandler.php
+
4
−
2
View file @
8a493ab9
...
...
@@ -432,6 +432,8 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )";
}
}
$indexType
=
$createIndexPrefix
===
'UI'
?
'UNIQUE'
:
''
;
// the index doesn't exist, so create it
// if we're multilingual and the field is internationalised, do it for every locale
// @todo remove is_array check & add multilingual support for combined indexes and add a test.
...
...
@@ -439,11 +441,11 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )";
// entity_id + entity_table which are not multilingual.
if
(
!
is_array
(
$field
)
&&
!
CRM_Utils_System
::
isNull
(
$locales
)
and
isset
(
$columns
[
$table
][
$fieldName
]))
{
foreach
(
$locales
as
$locale
)
{
$queries
[]
=
"CREATE INDEX
{
$createIndexPrefix
}
_
{
$fieldName
}{
$lengthName
}
_
{
$locale
}
ON
{
$table
}
(
{
$fieldName
}
_
{
$locale
}{
$lengthSize
}
)"
;
$queries
[]
=
"CREATE
$indexType
INDEX
{
$createIndexPrefix
}
_
{
$fieldName
}{
$lengthName
}
_
{
$locale
}
ON
{
$table
}
(
{
$fieldName
}
_
{
$locale
}{
$lengthSize
}
)"
;
}
}
else
{
$queries
[]
=
"CREATE INDEX
{
$createIndexPrefix
}
_
{
$fieldName
}{
$lengthName
}
ON
{
$table
}
("
.
implode
(
','
,
(
array
)
$field
)
.
"
{
$lengthSize
}
)"
;
$queries
[]
=
"CREATE
$indexType
INDEX
{
$createIndexPrefix
}
_
{
$fieldName
}{
$lengthName
}
ON
{
$table
}
("
.
implode
(
','
,
(
array
)
$field
)
.
"
{
$lengthSize
}
)"
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
CRM/Upgrade/Incremental/Base.php
+
5
−
4
View file @
8a493ab9
...
...
@@ -244,12 +244,13 @@ class CRM_Upgrade_Incremental_Base {
*
* @param CRM_Queue_TaskContext $ctx
* @param string $table
* @param string|array $column
* @param string|array $columns
* @param string $prefix
* @return bool
*/
public
static
function
addIndex
(
$ctx
,
$table
,
$column
)
{
$tables
=
[
$table
=>
(
array
)
$column
];
CRM_Core_BAO_SchemaHandler
::
createIndexes
(
$tables
);
public
static
function
addIndex
(
$ctx
,
$table
,
$column
s
,
$prefix
=
'index'
)
{
$tables
=
[
$table
=>
(
array
)
$column
s
];
CRM_Core_BAO_SchemaHandler
::
createIndexes
(
$tables
,
$prefix
);
return
TRUE
;
}
...
...
This diff is collapsed.
Click to expand it.
CRM/Upgrade/Incremental/php/FiveThirtyTwo.php
+
1
−
0
View file @
8a493ab9
...
...
@@ -56,6 +56,7 @@ class CRM_Upgrade_Incremental_php_FiveThirtyTwo extends CRM_Upgrade_Incremental_
$this
->
addTask
(
ts
(
'Upgrade DB to %1: SQL'
,
[
1
=>
$rev
]),
'runSql'
,
$rev
);
$this
->
addTask
(
'Add column civicrm_saved_search.name'
,
'addColumn'
,
'civicrm_saved_search'
,
'name'
,
"varchar(255) DEFAULT NULL COMMENT 'Unique name of saved search'"
);
$this
->
addTask
(
'Add column civicrm_saved_search.label'
,
'addColumn'
,
'civicrm_saved_search'
,
'label'
,
"varchar(255) DEFAULT NULL COMMENT 'Administrative label for search'"
);
$this
->
addTask
(
'Add index civicrm_saved_search.UI_name'
,
'addIndex'
,
'civicrm_saved_search'
,
'name'
,
'UI'
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment