@echo off

if "%1"=="" goto :usage
if "%2"=="" goto :usage
if "%3"=="" goto :usage
if "%4"=="" goto :usage
if "%5"=="" goto :usage

@echo Install Schema
sqlplus /nolog @Schema\InstallMIP %1 %2 %3 %4 %5


@echo Install Modules
sqlplus %3/%4@%5 @Modules\Modules.sql


@echo Install Seed
cd Data\Seed
call InstallSeed %3/%4@%5
cd ..\..
@echo Seed Complete

if "%6"=="" goto :done

if "%6"=="demo" goto :demo
if "%6"=="test" goto :test

:demo
@echo Demo
cd Data\Demo
call InstallData %3/%4@%5
cd ..\..
@echo Demo Complete

goto :done

:test
@echo Install Test data
cd Data\test
call InstallData %3/%4@%5
@echo Installed Test data
@echo Installing Test application in APEX...
ruby apex_auto_install.rb
cd ..\..

@echo Test Complete

goto :done

:usage

echo usage 		InstallMIP sys_name sys_password app_name app_password db_connect_string demo/test

:done
