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
c94b0a46
Commit
c94b0a46
authored
Aug 14, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert changes to mysql initializer
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
2bb221f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
config/initializers/mysql_set_length_for_binary_indexes.rb
config/initializers/mysql_set_length_for_binary_indexes.rb
+5
-5
No files found.
config/initializers/mysql_set_length_for_binary_
and_text_
indexes.rb
→
config/initializers/mysql_set_length_for_binary_indexes.rb
View file @
c94b0a46
# This patches ActiveRecord so indexes for binary
and text
columns created
# This patches ActiveRecord so indexes for binary columns created
# using the MySQL adapter apply a length of 20. Otherwise MySQL can't create an
# index on binary
and text
columns.
# index on binary columns.
module
MysqlSetLengthForBinary
AndText
Index
module
MysqlSetLengthForBinaryIndex
def
add_index
(
table_name
,
column_names
,
options
=
{})
Array
(
column_names
).
each
do
|
column_name
|
column
=
ActiveRecord
::
Base
.
connection
.
columns
(
table_name
).
find
{
|
c
|
c
.
name
==
column_name
}
if
column
&
.
type
==
:binary
||
column
&
.
type
==
:text
if
column
&
.
type
==
:binary
options
[
:length
]
=
20
end
end
...
...
@@ -17,5 +17,5 @@ module MysqlSetLengthForBinaryAndTextIndex
end
if
defined?
(
ActiveRecord
::
ConnectionAdapters
::
Mysql2Adapter
)
ActiveRecord
::
ConnectionAdapters
::
Mysql2Adapter
.
send
(
:prepend
,
MysqlSetLengthForBinary
AndText
Index
)
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