diff options
author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-03-01 11:42:47 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-03-07 21:59:39 +0100 |
commit | c2c5572e22d8e03b111859f3cf143181edd8c20f (patch) | |
tree | 6b0bf9a3f129c66983c6f720d6765d4a62fc3346 /db | |
parent | dc31aff3da6a2d576e0bd99249911c9373e56d98 (diff) | |
download | gitlab-ce-c2c5572e22d8e03b111859f3cf143181edd8c20f.tar.gz |
adds swp and swo to gitignore and improves migration for project main_language
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20160229193553_add_main_language_to_repository.rb | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/db/migrate/20160229193553_add_main_language_to_repository.rb b/db/migrate/20160229193553_add_main_language_to_repository.rb index da24abd2f04..b5446c6a447 100644 --- a/db/migrate/20160229193553_add_main_language_to_repository.rb +++ b/db/migrate/20160229193553_add_main_language_to_repository.rb @@ -1,21 +1,5 @@ class AddMainLanguageToRepository < ActiveRecord::Migration - require 'rugged' - require 'linguist' - - def up - add_column :projects, :main_language, :string, default: nil - - Project.all.each do |project| - unless project.repository.empty? - language = Linguist::Repository.new( - project.repository.rugged, - project.repository.rugged.head.target_id).language - project.update_attributes(main_language: language) - end - end - end - - def down - remove_column :projects, :main_language + def change + add_column :projects, :main_language, :string end end |