BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c4c44c6a
Commit
c4c44c6a
authored
Jul 20, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
length constrain on the index, not on the column
we actually don't need a limit on the column itself for MySQL to work. we need to set a length on the index.
parent
57ccff8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
20170222111732_create_gpg_keys.rb
db/migrate/20170222111732_create_gpg_keys.rb
+3
-3
20170613154149_create_gpg_signatures.rb
db/migrate/20170613154149_create_gpg_signatures.rb
+4
-4
limits_to_mysql.rb
db/migrate/limits_to_mysql.rb
+13
-4
No files found.
db/migrate/20170222111732_create_gpg_keys.rb
View file @
c4c44c6a
...
...
@@ -7,12 +7,12 @@ class CreateGpgKeys < ActiveRecord::Migration
t
.
references
:user
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
binary
:primary_keyid
,
limit:
Gitlab
::
Database
.
mysql?
?
20
:
nil
t
.
binary
:fingerprint
,
limit:
Gitlab
::
Database
.
mysql?
?
20
:
nil
t
.
binary
:primary_keyid
t
.
binary
:fingerprint
t
.
text
:key
t
.
index
:primary_keyid
t
.
index
:primary_keyid
,
length:
Gitlab
::
Database
.
mysql?
?
20
:
nil
end
end
end
db/migrate/20170613154149_create_gpg_signatures.rb
View file @
c4c44c6a
...
...
@@ -10,14 +10,14 @@ class CreateGpgSignatures < ActiveRecord::Migration
t
.
boolean
:valid_signature
t
.
binary
:commit_sha
,
limit:
Gitlab
::
Database
.
mysql?
?
20
:
nil
t
.
binary
:gpg_key_primary_keyid
,
limit:
Gitlab
::
Database
.
mysql?
?
20
:
nil
t
.
binary
:commit_sha
t
.
binary
:gpg_key_primary_keyid
t
.
text
:gpg_key_user_name
t
.
text
:gpg_key_user_email
t
.
index
:commit_sha
t
.
index
:gpg_key_primary_keyid
t
.
index
:commit_sha
,
length:
Gitlab
::
Database
.
mysql?
?
20
:
nil
t
.
index
:gpg_key_primary_keyid
,
length:
Gitlab
::
Database
.
mysql?
?
20
:
nil
end
end
end
db/migrate/limits_to_mysql.rb
View file @
c4c44c6a
# rubocop:disable all
require
Rails
.
root
.
join
(
'lib/gitlab/database/migration_helpers.rb'
)
class
LimitsToMysql
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
def
up
return
unless
ActiveRecord
::
Base
.
configurations
[
Rails
.
env
][
'adapter'
]
=~
/^mysql/
...
...
@@ -8,9 +12,14 @@ class LimitsToMysql < ActiveRecord::Migration
change_column
:snippets
,
:content
,
:text
,
limit:
2147483647
change_column
:notes
,
:st_diff
,
:text
,
limit:
2147483647
change_column
:events
,
:data
,
:text
,
limit:
2147483647
change_column
:gpg_keys
,
:primary_keyid
,
:binary
,
limit:
20
change_column
:gpg_keys
,
:fingerprint
,
:binary
,
limit:
20
change_column
:gpg_signatures
,
:commit_sha
,
:binary
,
limit:
20
change_column
:gpg_signatures
,
:gpg_key_primary_keyid
,
:binary
,
limit:
20
[
[
:gpg_keys
,
:primary_keyid
],
[
:gpg_signatures
,
:commit_sha
],
[
:gpg_signatures
,
:gpg_key_primary_keyid
]
].
each
do
|
table_name
,
column_name
|
remove_index
table_name
,
column_name
if
index_exists?
(
table_name
,
column_name
)
add_concurrent_index
table_name
,
column_name
,
length:
20
end
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