Commit 0ae892007dac045e58cab793806f778b90ce6c2e

Authored by Dmitriy Zaporozhets
1 parent 0415566b

Remove Wiki and db table since we use gollum now

app/contexts/search_context.rb
@@ -13,7 +13,7 @@ class SearchContext @@ -13,7 +13,7 @@ class SearchContext
13 result[:projects] = Project.where(id: project_ids).search(query).limit(10) 13 result[:projects] = Project.where(id: project_ids).search(query).limit(10)
14 result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10) 14 result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10)
15 result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10) 15 result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10)
16 - result[:wiki_pages] = Wiki.where(project_id: project_ids).search(query).limit(10) 16 + result[:wiki_pages] = []
17 result 17 result
18 end 18 end
19 19
app/models/project.rb
@@ -53,7 +53,6 @@ class Project < ActiveRecord::Base @@ -53,7 +53,6 @@ class Project < ActiveRecord::Base
53 has_many :snippets, dependent: :destroy 53 has_many :snippets, dependent: :destroy
54 has_many :deploy_keys, dependent: :destroy, class_name: "Key", foreign_key: "project_id" 54 has_many :deploy_keys, dependent: :destroy, class_name: "Key", foreign_key: "project_id"
55 has_many :hooks, dependent: :destroy, class_name: "ProjectHook" 55 has_many :hooks, dependent: :destroy, class_name: "ProjectHook"
56 - has_many :wikis, dependent: :destroy  
57 has_many :protected_branches, dependent: :destroy 56 has_many :protected_branches, dependent: :destroy
58 has_many :user_team_project_relationships, dependent: :destroy 57 has_many :user_team_project_relationships, dependent: :destroy
59 58
app/models/wiki.rb
@@ -1,55 +0,0 @@ @@ -1,55 +0,0 @@
1 -# == Schema Information  
2 -#  
3 -# Table name: wikis  
4 -#  
5 -# id :integer not null, primary key  
6 -# title :string(255)  
7 -# content :text  
8 -# project_id :integer  
9 -# created_at :datetime not null  
10 -# updated_at :datetime not null  
11 -# slug :string(255)  
12 -# user_id :integer  
13 -#  
14 -  
15 -class Wiki < ActiveRecord::Base  
16 - attr_accessible :title, :content, :slug  
17 -  
18 - belongs_to :project  
19 - belongs_to :user  
20 - has_many :notes, as: :noteable, dependent: :destroy  
21 -  
22 - validates :content, presence: true  
23 - validates :user, presence: true  
24 - validates :title, presence: true, length: 1..250  
25 -  
26 - before_update :set_slug  
27 -  
28 - scope :ordered, order("created_at DESC")  
29 -  
30 - def to_param  
31 - slug  
32 - end  
33 -  
34 - class << self  
35 - def search(query)  
36 - where("title like :query OR content like :query", query: "%#{query}%")  
37 - end  
38 - end  
39 -  
40 - protected  
41 -  
42 - def self.regenerate_from wiki  
43 - regenerated_field = [:slug, :content, :title]  
44 -  
45 - new_wiki = Wiki.new  
46 - regenerated_field.each do |field|  
47 - new_wiki.send("#{field}=", wiki.send(field))  
48 - end  
49 - new_wiki  
50 - end  
51 -  
52 - def set_slug  
53 - self.slug = self.title.parameterize  
54 - end  
55 -end  
db/migrate/20130410175022_remove_wiki_table.rb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +class RemoveWikiTable < ActiveRecord::Migration
  2 + def up
  3 + drop_table :wikis
  4 + end
  5 +
  6 + def down
  7 + raise ActiveRecord::IrreversibleMigration
  8 + end
  9 +end
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 # 11 #
12 # It's strongly recommended to check this file into your version control system. 12 # It's strongly recommended to check this file into your version control system.
13 13
14 -ActiveRecord::Schema.define(:version => 20130404164628) do 14 +ActiveRecord::Schema.define(:version => 20130410175022) do
15 15
16 create_table "events", :force => true do |t| 16 create_table "events", :force => true do |t|
17 t.string "target_type" 17 t.string "target_type"
@@ -300,17 +300,4 @@ ActiveRecord::Schema.define(:version =&gt; 20130404164628) do @@ -300,17 +300,4 @@ ActiveRecord::Schema.define(:version =&gt; 20130404164628) do
300 t.integer "service_id" 300 t.integer "service_id"
301 end 301 end
302 302
303 - create_table "wikis", :force => true do |t|  
304 - t.string "title"  
305 - t.text "content"  
306 - t.integer "project_id"  
307 - t.datetime "created_at", :null => false  
308 - t.datetime "updated_at", :null => false  
309 - t.string "slug"  
310 - t.integer "user_id"  
311 - end  
312 -  
313 - add_index "wikis", ["project_id"], :name => "index_wikis_on_project_id"  
314 - add_index "wikis", ["slug"], :name => "index_wikis_on_slug"  
315 -  
316 end 303 end
spec/models/wiki_spec.rb
@@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
1 -# == Schema Information  
2 -#  
3 -# Table name: wikis  
4 -#  
5 -# id :integer not null, primary key  
6 -# title :string(255)  
7 -# content :text  
8 -# project_id :integer  
9 -# created_at :datetime not null  
10 -# updated_at :datetime not null  
11 -# slug :string(255)  
12 -# user_id :integer  
13 -#  
14 -  
15 -require 'spec_helper'  
16 -  
17 -describe Wiki do  
18 - describe "Associations" do  
19 - it { should belong_to(:project) }  
20 - it { should belong_to(:user) }  
21 - it { should have_many(:notes).dependent(:destroy) }  
22 - end  
23 -  
24 - describe "Mass assignment" do  
25 - it { should_not allow_mass_assignment_of(:project_id) }  
26 - it { should_not allow_mass_assignment_of(:user_id) }  
27 - end  
28 -  
29 - describe "Validation" do  
30 - it { should validate_presence_of(:title) }  
31 - it { should ensure_length_of(:title).is_within(1..250) }  
32 - it { should validate_presence_of(:content) }  
33 - it { should validate_presence_of(:user) }  
34 - end  
35 -end