Module: ZCreateDb

Defined in:
lib/jungle_path/app/ztools/zcreatedb.rb

Class Method Summary collapse

Class Method Details

.run(db_config = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/jungle_path/app/ztools/zcreatedb.rb', line 7

def self.run db_config=nil
	db_config = jungle.db unless db_config
	puts "db_config port/name/user_name/password: #{db_config.port}/#{db_config.name}/#{db_config.user_name}/#{db_config.password}."
	JunglePath::Gen::DB.reset!(db_config)
	JunglePath::Gen::Schema.create(Schema::Base.models_dependent_order, db_config)

	this_path = File.expand_path(File.dirname(__FILE__))
	migrations_path = File.join(this_path, 'db', 'migrations')
	JunglePath::Gen::Schema.set_version_to_latest(Schema::SchemaInfo, db_config, migrations_path)
end