class SO2DB::CreateOptionals

Public Instance Methods

create_close_reasons() click to toggle source
# File lib/so2db/migrations.rb, line 265
def create_close_reasons
  create_table :close_reasons do |t|
    #t.primary_key :id
    t.string :name, :limit => 50
  end

  { 1 => "Exact duplicate",
    2 => "off-topic",
    3 => "subjective",
    4 => "not a real question",
    7 => "too localized",
    10 => "General reference",
    20 => "Noise or pointless"
  }.each do |k,v|
    c = Models::CloseReason.new
    c.id = k
    c.name = v
    c.save
  end
end
create_post_history_types() click to toggle source
# File lib/so2db/migrations.rb, line 221
def create_post_history_types
  create_table :post_history_types do |t|
    #t.primary_key :id
    t.string :name, :limit => 50
  end

  { 1  => "Initial Title", 
    2  => "Initial Body", 
    3  => "Initial Tags", 
    4  => "Edit Title", 
    5  => "Edit Body", 
    6  => "Edit Tags", 
    7  => "Rollback Title", 
    8  => "Rollback Body", 
    9  => "Rollback Tags", 
    10 => "Post Closed", 
    11 => "Post Reopened", 
    12 => "Post Deleted", 
    13 => "Post Undeleted", 
    14 => "Post Locked", 
    15 => "Post Unlocked", 
    16 => "Community Owned", 
    17 => "Post Migrated", 
    18 => "Question Merged", 
    19 => "Question Protected", 
    20 => "Question Unprotected", 
    22 => "Question Unmerged", 
    24 => "Suggested Edit Applied", 
    25 => "Post Tweeted", 
    31 => "Discussion moved to chat", 
    33 => "Post Notice Added", 
    34 => "Post Notice Removed", 
    35 => "Post Migrated Away", 
    36 => "Post Migrated Here", 
    37 => "Post Merge Source", 
    38 => "Post Merge Destination" 
  }.each do |k,v|
    p = Models::PostHistoryType.new
    p.id = k
    p.name = v
    p.save
  end
end
create_post_types() click to toggle source
# File lib/so2db/migrations.rb, line 199
def create_post_types
  create_table :post_types do |t|
    #t.primary_key :id
    t.string :type_name, :limit => 24
  end

  { 1 => "Question", 
    2 => "Answer",
    3 => "Wiki",
    4 => "TagWikiExcerpt",
    5 => "TagWiki",
    6 => "ModeratorNomination",
    7 => "WikiPlaceholder",
    8 => "PrivilegeWiki"
  }.each do |k,v|
    p = Models::PostType.new
    p.id = k
    p.type_name = v
    p.save
  end
end
create_vote_types() click to toggle source
# File lib/so2db/migrations.rb, line 286
def create_vote_types
  create_table :vote_types do |t|
    #t.primary_key :id
    t.string :name, :limit => 50
  end

  { 1 => "AcceptedByOriginator",
    2 =>"UpMod",
    3 => "DownMod",
    4 =>"Offensive",
    5 =>"Favorite",
    6 =>"Close",
    7 =>"Reopen",
    8 =>"BountyStart",
    9 =>"BountyClose",
    10 =>"Deletion",
    11 =>"Undeletion",
    12 =>"Spam",
    15 =>"ModeratorReview",
    16 =>"ApproveEditSuggestion"
  }.each do |k,v|
    vt = Models::VoteType.new
    vt.id = k
    vt.name = v
    vt.save
  end
end
up() click to toggle source
# File lib/so2db/migrations.rb, line 192
def up
  create_post_types
  create_post_history_types
  create_close_reasons
  create_vote_types
end