Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database setup #7

Closed
harman052 opened this issue May 24, 2013 · 5 comments
Closed

Database setup #7

harman052 opened this issue May 24, 2013 · 5 comments

Comments

@harman052
Copy link

I was trying to install Bookyt by following your INSTALL file. After database initialize, I didn't find any step to create tables in database. I found db/schema.rb file but I don't know how to use it with MySQL.

Developers are requested to look into the issue ASAP.

@huerlisi
Copy link
Owner

Hi there

Did the 'bundle exec rake db:setup' command work? If yes, the database is initialized and tables are created.

If not, here's some background: 'rake db:setup' does create the mysql databases according to 'database.yml' you created out of 'database.yml.example'. It should ask you for the root password for your mysql server to create the databases. This function is provided by Rails and we just use that for Bookyt. It does not always work if there's more than one database is configured in database.yml (like production, test, development) with the same username.

So here's a recipe that should probably get you a working DB setup if you used a more or less verbatim copy of database.yml.example:

  • Drop the databases that got created: mysqladmin -u root -p drop bookyt_production; mysqladmin -u root -p drop bookyt_development
  • Change database.yml: remove the section for 'production', change the username value for test to bookyt_test, set some passwords
  • Run bundle exec rake db:setup and enter your DB root password when you're asked (you'll be asked twice).

It that fails, please post the output of the last step here, preferable using a gist.

Cheers
Simon

@harman052
Copy link
Author

Please check the following gist to look into the problem.
https://gist.github.com/harman052/5648734

Harman

@harman052 harman052 reopened this May 25, 2013
@huerlisi
Copy link
Owner

(Did comment on the gist long time ago, but I'll re-post here as I'm not sure it reached you, @harman052)

You need to keep both a test and a development section. They should both have a different user name and database name to get db:create (which is called by db:setup) working properly.

The reason there are no tables in the test db is that it failed to do the db:create properly. db:setup actually calls the following tasks: db:create (create databases), db:schema:load (to build the tables), and db:seed (to add some seed data from db/seeds.rb. So when db:create fails (because there is no development section), the other tasks are not run.

@huerlisi
Copy link
Owner

@harman052 okay to close? Or do you need some support?

@harman052
Copy link
Author

On Wed, Jun 26, 2013 at 12:44 AM, Simon Hürlimann
notifications@github.comwrote:

@harman052 https://github.com/harman052 okay to close? Or do you need
some support?

Thanks for your assistance. But actually I am busy with my work so is
unable to act upon your recent emails. You can close but I will only be

able to check it after September.

Harmanpreet Singh
Blog: http://singhharman.wordpress.com/

mur-wtag pushed a commit to wtag/bookyt that referenced this issue Jan 19, 2017
…nt-plan-in-accounts

AG-709 Define a default account plan in accounts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants