Class: WordPress::Schema

Inherits:
Base
  • Object
show all
Defined in:
lib/wordpress/schema.rb

Instance Method Summary collapse

Methods inherited from Base

#get_post_meta, #get_the_terms, #initialize, #insert, #inspect, #set_post_meta, #set_post_terms, #update, #update_or_insert

Constructor Details

This class inherits a constructor from WordPress::Base

Instance Method Details

#initialize!Object

Initialize the database. Will drop your current database!


6
7
8
9
10
# File 'lib/wordpress/schema.rb', line 6

def initialize!
  drop!
  create_db!
  load!
end

#load!Object


12
13
14
15
16
17
# File 'lib/wordpress/schema.rb', line 12

def load!
  @conn.query_options[:flags] = Mysql2::Client::MULTI_STATEMENTS

  schema = File.open(File.join(File.dirname(__FILE__), '..', '..', 'wordpress-3.5.1.sql')).read
  @conn.query(schema)
end