diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-07 02:34:58 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-07 02:34:58 +0000 |
commit | 29e39e55c3d4b5c6c34c6faec84b0dcd5a3efffa (patch) | |
tree | d6b3ca53d05fa47db768c8d0508fe51c81b0f6ac /db/migrate | |
parent | ba44a57f101a87ebb9155485d5bde1287f7892cf (diff) | |
parent | 24c348f0d1270fe27268aa23e034473651b0cdf9 (diff) | |
download | gitlab-ce-29e39e55c3d4b5c6c34c6faec84b0dcd5a3efffa.tar.gz |
Merge branch 'mk-add-old-attachments-to-uploads-table' into 'master'
Add old files to uploads table
See merge request gitlab-org/gitlab-ce!15270
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb b/db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb new file mode 100644 index 00000000000..1fbe505f804 --- /dev/null +++ b/db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb @@ -0,0 +1,25 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class SetUploadsPathSizeForMysql < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def up + # We need at least 297 at the moment. For more detail on that number, see: + # https://gitlab.com/gitlab-org/gitlab-ce/issues/40168#what-is-the-expected-correct-behavior + # + # Rails + PostgreSQL `string` is equivalent to a `text` field, but + # Rails + MySQL `string` is `varchar(255)` by default. Also, note that we + # have an upper limit because with a unique index, MySQL has a max key + # length of 3072 bytes which seems to correspond to `varchar(1024)`. + change_column :uploads, :path, :string, limit: 511 + end + + def down + # It was unspecified, which is varchar(255) by default in Rails for MySQL. + change_column :uploads, :path, :string + end +end |