Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d5e91856
Commit
d5e91856
authored
Sep 04, 2018
by
Olivier Gonzalez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make MySQL patch for binary indexes compatible with composite indexes
parent
91003c6e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
config/initializers/mysql_set_length_for_binary_indexes.rb
config/initializers/mysql_set_length_for_binary_indexes.rb
+4
-2
No files found.
config/initializers/mysql_set_length_for_binary_indexes.rb
View file @
d5e91856
...
...
@@ -7,11 +7,12 @@
# the old Rails 4 schema layout is still used
module
MysqlSetLengthForBinaryIndex
def
add_index
(
table_name
,
column_names
,
options
=
{})
options
[
:length
]
||=
{}
Array
(
column_names
).
each
do
|
column_name
|
column
=
ActiveRecord
::
Base
.
connection
.
columns
(
table_name
).
find
{
|
c
|
c
.
name
==
column_name
}
if
column
&
.
type
==
:binary
options
[
:length
]
=
20
options
[
:length
]
[
column_name
]
=
20
end
end
...
...
@@ -27,11 +28,12 @@ if Gitlab.rails5?
module
MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema
# This method is used in Rails 5 schema loading as t.index
def
index
(
column_names
,
options
=
{})
options
[
:length
]
||=
{}
Array
(
column_names
).
each
do
|
column_name
|
column
=
columns
.
find
{
|
c
|
c
.
name
==
column_name
}
if
column
&
.
type
==
:binary
options
[
:length
]
=
20
options
[
:length
]
[
column_name
]
=
20
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment