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
07dbd564
Commit
07dbd564
authored
Jul 25, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use Module#prepend instead of alias_method_chain
parent
ecbc11a8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
16 deletions
+12
-16
config/initializers/mysql_set_length_for_binary_indexes.rb
config/initializers/mysql_set_length_for_binary_indexes.rb
+12
-16
No files found.
config/initializers/mysql_set_length_for_binary_indexes.rb
View file @
07dbd564
...
@@ -2,12 +2,7 @@
...
@@ -2,12 +2,7 @@
# MySQL adapter apply a length of 20. Otherwise MySQL can't create an index on
# MySQL adapter apply a length of 20. Otherwise MySQL can't create an index on
# binary columns.
# binary columns.
if
defined?
(
ActiveRecord
::
ConnectionAdapters
::
Mysql2Adapter
)
module
MysqlSetLengthForBinaryIndex
module
ActiveRecord
module
ConnectionAdapters
class
Mysql2Adapter
<
AbstractMysqlAdapter
alias_method
:__gitlab_add_index2
,
:add_index
def
add_index
(
table_name
,
column_names
,
options
=
{})
def
add_index
(
table_name
,
column_names
,
options
=
{})
Array
(
column_names
).
each
do
|
column_name
|
Array
(
column_names
).
each
do
|
column_name
|
column
=
ActiveRecord
::
Base
.
connection
.
columns
(
table_name
).
find
{
|
c
|
c
.
name
==
column_name
}
column
=
ActiveRecord
::
Base
.
connection
.
columns
(
table_name
).
find
{
|
c
|
c
.
name
==
column_name
}
...
@@ -17,9 +12,10 @@ if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
...
@@ -17,9 +12,10 @@ if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
end
end
end
end
__gitlab_add_index2
(
table_name
,
column_names
,
options
)
super
(
table_name
,
column_names
,
options
)
end
end
end
end
end
end
end
if
defined?
(
ActiveRecord
::
ConnectionAdapters
::
Mysql2Adapter
)
ActiveRecord
::
ConnectionAdapters
::
Mysql2Adapter
.
send
(
:prepend
,
MysqlSetLengthForBinaryIndex
)
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