msjit / testcasedb

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

default user admin is not created #20

Closed kirantpatil closed 10 years ago

kirantpatil commented 10 years ago

Steps to reproduce:

  1. Clone the testcasedb
  2. Create the database "production"
  3. execute ./scripts/setup -p
  4. migrate the database
  5. go to database and check the users table

    Database table output:


template1=# \c tcdb_production You are now connected to database "tcdb_production" as user "postgres".

tcdb_production=# select * from users; id | username | email | first_name | last_name | crypted_password | password_salt | persistence_token | last_login_at | current_login_ip | last_login_ip | created_at | updated_at | role | active | time_zone | failed_login_count | single_access_token | last_request_at ----+----------+-------+------------+-----------+------------------+---------------+-------------------+---------------+------------------+---------------+------------+------------+------+--------+-----------+--------------------+---------------------+----------------- (0 rows)

tcdb_production=# select * from authentications; id | user_id | provider | uid | created_at | updated_at ----+---------+----------+-----+------------+------------ (0 rows)

joffems commented 10 years ago

I will double check the install process to see why a user isn't created.

Can you also answer the following: Did you point the application at an empty database? If there are existing settings, the system won't create a new db for security reasons.

kirantpatil commented 10 years ago

Yes, before the step 2, I dropped the database using "bundle exec db:drop RAILS_ENV='production'"'

joffems commented 10 years ago

This is related to issue 19. The fix for issue 19 should fix this too.

kirantpatil commented 10 years ago

I proceeded with the same steps with git pull (latest fix) and still admin user is not added to database.

I did do one step manually as below to get admin user in to database.

kiran@jaihanuman:~/testcasedb$ bundle exec rake install:base RAILS_ENV='production' Install is complete.

Database output

id | username | email | first_name | last_name | crypted_password | password_salt | persistence_token | last_login_at | current_login_ip | last_login_ip | created_at | updated_at | role | active | time_zone | failed_login_count | single_access_token | last_request_at ----+----------+---------------------+------------+-----------+----------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------------------------------------------------------------------------------------+---------------+------------------+---------------+---------------------------+---------------------------+------+--------+----------------------------+--------------------+---------------------+----------------- 1 | admin | test@testcasedb.com | Admin | User | 524dffad07c5172ac3965a33034c2f584c9819e0175ee2fc6f9a215dff58304e60c6c0337586c62b80636b201e11eafe2e440173c3109214af4bd8af28b5eec9 | dOJYujlvhh0PGwkBGN2 | 679a5497baac9418bae9f00a03cf370f7e8c4be2d81d78f5fa2a0bdc4885bf84af22bfe16afb8a7bf94d0ee36beded9efda5e86d8b5cf5e7415b0158c34f7a17 | | | | 2014-07-03 17:37:12.94287 | 2014-07-03 17:37:12.94287 | 10 | t | Eastern Time (US & Canada) | | w5ybwkZWXBpMfxoCT | (1 row)

joffems commented 10 years ago

I have updated the install script for production. I had to move the RAILS_ENV variable after the commands to make everything work.

This should work for future fresh installs.