msjit / testcasedb

TestCaseDB - Web based test case management
MIT License
40 stars 18 forks source link

A Question Regarding Setup File #25

Closed harshith30 closed 10 years ago

harshith30 commented 10 years ago

Hi, In the file setup ( ~/testcasedb/script/setup ) , when we run this file under production environment

harshith@harshith-Inspiron-3520:~/testcasedb$ script/setup -p

the following code triggers

system "bundle"

if options[:production] == false puts "Creating all databases" system "bundle exec rake db:create:all" system "bundle exec rake db:migrate" system "bundle exec rake install:base" else puts "Migrating production database" system "RAILS_ENV=production bundle exec rake db:migrate" puts "Installing base function" system "RAILS_ENV=production bundle exec rake install:base" end

According to my understanding both the tasks ( db:migrate and install:base ) should execute, and migration should take place .


But what i observe when i run the file are as follows

harshith@harshith-Inspiron-3520:~/testcasedb$ script/setup -p Generated config/app_config.yml Updated secret key Migrating production database Installing base function

The puts command works perfectly .

Now when i check the database for the tables i don't see them.

harshith@harshith-Inspiron-3520:~$ mysql -u harshith -p tcdb_production Enter password:

mysql> show tables; Empty set (0.00 sec)


Only if i run the db:migrate separately the migration takes place

harshith@harshith-Inspiron-3520:~/testcasedb$ RAILS_ENV=production bundle exec rake db:migrate --trace * Invoke db:migrate (first_time) * Invoke environment (first_time) * Execute environment * Invoke db:load_config (first_time) * Execute db:load_config * Execute db:migrate . . * Invoke db:_dump (first_time) * Execute db:_dump * Invoke db:schema:dump (first_time) * Invoke environment * Invoke db:load_config * Execute db:schema:dump


After which i need to run install:base separately so that the default user gets created

harshith@harshith-Inspiron-3520:~/testcasedb$ RAILS_ENV=production bundle exec rake install:base --trace * Invoke install:base (first_time) * Invoke environment (first_time) * Execute environment * Execute install:base Install is complete.


I would like to know why  i have to use  the following commands 

RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake install:base

again for the application to run successfully , when its already been used in the script /setup file.

Thanks Harshith

kirantpatil commented 10 years ago

Is that system function exits without executing those two lines from the setup file ?

May be check the exit status of the system functions.

Since it is a ruby code you can very well use ruby debug tools to trace the root cause of it.

joffems commented 10 years ago

A fix for this issue was deployed in commit https://github.com/msjit/testcasedb/commit/03b066cb7d4927b02826abac83efe31c93a8fc74