module ZCreateDb

Public Class Methods

run(db_config=nil) click to toggle source
# 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