Commit d3ca12a1433ca518c3a71b2e768bc07666242d18
Exists in
master
and in
4 other branches
Merge pull request #3911 from babatakao/migrate_note_linecode
Migrate notes.line_code format.
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,13 @@ |
1 | +desc "GITLAB | Migrate Note LineCode" | |
2 | +task migrate_note_linecode: :environment do | |
3 | + Note.inline.each do |note| | |
4 | + index = note.diff_file_index | |
5 | + if index =~ /^\d{1,10}$/ # is number. not hash. | |
6 | + hash = Digest::SHA1.hexdigest(note.noteable.diffs[index.to_i].new_path) | |
7 | + new_line_code = note.line_code.sub(index, hash) | |
8 | + note.update_column :line_code, new_line_code | |
9 | + print '.' | |
10 | + end | |
11 | + end | |
12 | +end | |
13 | + | ... | ... |