Sha256: 02982c49dc7f37ff1e001eab3d6812caabdf9fba76886c57d4949698d8b86e68
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require "wpb/version" require "wpb/user" require "wpb/setting" require "wpb/pagepost" require "wpb/page" require "wpb/post" require "wpb/comment" require "active_record" ## # The wrapper for the wpb gem module WPB class AddTypeToWpPosts < ActiveRecord::Migration def self.up suppress_messages do unless column_exists? :wp_posts, :type add_column :wp_posts, :type, :string PagePost.reset_column_information else puts "\tWordPress Database Already Initialized" end end end def self.down remove_column :wp_posts, :type end end class App def self.connect config = { :adapter => "mysql", # :socket => "/tmp/mysql.sock", :host => "localhost", :username => "root", :password => "root", :database => "wordpress" } ActiveRecord::Base.establish_connection(config) end def self.run self.connect PagePost.all.each do |p| p.type = p.post_type.capitalize if p.post_type != "post" && p.post_type != "page" p.type = "Post" end p.save end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wpb-0.0.6 | lib/wpb.rb |
wpb-0.0.6.pre | lib/wpb.rb |