webdevRefinery Forum: Heroku help - webdevRefinery Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

User is offline ShanePerreault 

  • Sleep Burns My Eyes
  • Group: Members
  • Posts: 1075
  • Joined: 19-March 10
  • LocationChicago, USA
  • Expertise:PHP,Java,Javascript,Ruby on Rails,SQL

Posted 18 September 2011 - 06:37 PM (#1)

Heroku help


I'm having trouble using the 'pg' gem in my rails application. I want to use MySQL but am on the free plan right now? Anyone else ever had problems using the 'pg' gem and heroku? Assistance needed. Trying to launch CSS-labs pre-beta.

Languages: PHP | JS | Ruby | Rails | C# | Python | Java
0


User is offline TheEmpty 

  • I say words in sequences.
  • Group: Members
  • Posts: 5154
  • Joined: 02-October 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,SQL

Posted 18 September 2011 - 06:46 PM (#2)

ShanePerreault, on 18 September 2011 - 06:37 PM, said:

I'm having trouble using the 'pg' gem in my rails application. I want to use MySQL but am on the free plan right now? Anyone else ever had problems using the 'pg' gem and heroku? Assistance needed. Trying to launch CSS-labs pre-beta.

pg = PostgreSQL, what their DBs are. I have no idea if you can use MySQL, but what you can do is:
gem 'mysql', :group => [:development, :test]
gem 'pg', :group => [:production]

but you'll want to run your test suite against it for PG SQL errors, etc. so best to switch, it is much faster with AR anyways.
Reserved.
0


User is offline ShanePerreault 

  • Sleep Burns My Eyes
  • Group: Members
  • Posts: 1075
  • Joined: 19-March 10
  • LocationChicago, USA
  • Expertise:PHP,Java,Javascript,Ruby on Rails,SQL

Posted 18 September 2011 - 07:34 PM (#3)

ThatRailsGuy, on 18 September 2011 - 06:46 PM, said:

pg = PostgreSQL, what their DBs are. I have no idea if you can use MySQL, but what you can do is:
gem 'mysql', :group => [:development, :test]
gem 'pg', :group => [:production]

but you'll want to run your test suite against it for PG SQL errors, etc. so best to switch, it is much faster with AR anyways.

I understand it's a PostgreSQL database, and I'm using ActiveRecord. I just can't figure how to a) get my db info from heroku b) run the migrations and c) connect.

Languages: PHP | JS | Ruby | Rails | C# | Python | Java
0


User is offline TheEmpty 

  • I say words in sequences.
  • Group: Members
  • Posts: 5154
  • Joined: 02-October 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,SQL

Posted 18 September 2011 - 07:49 PM (#4)

ShanePerreault, on 18 September 2011 - 07:34 PM, said:

I understand it's a PostgreSQL database, and I'm using ActiveRecord. I just can't figure how to a) get my db info from heroku b) run the migrations and c) connect.

heroku rake db:migrate
heroku rake db:pull

http://blog.heroku.c...nd_from_heroku/
Reserved.
0


User is offline gushort 

  • Group: Members
  • Posts: 452
  • Joined: 05-January 11
  • LocationToronto

Posted 18 September 2011 - 08:54 PM (#5)

You would probably be using the pg gem only for production, and the mysql one locally for development, so be sure to put the sql gem in a development/test group and the pg one into a production group:


group :development, :test do
  gem 'mysql2', '<= 0.2.9'
end

group :production do
  gem pg
end


As for connecting to your db in Heroku, you can't access a Heroku shared db's data remotely. Not easily anyway.

If it is just populating your db with initial records that you're concerned about, then you would probably just use the db/seeds.rb file for that.
0


User is offline gushort 

  • Group: Members
  • Posts: 452
  • Joined: 05-January 11
  • LocationToronto

Posted 18 September 2011 - 09:59 PM (#6)

You may also want to have a look at Taps for pushing and pulling data from your Heroku db.
0


User is offline ShanePerreault 

  • Sleep Burns My Eyes
  • Group: Members
  • Posts: 1075
  • Joined: 19-March 10
  • LocationChicago, USA
  • Expertise:PHP,Java,Javascript,Ruby on Rails,SQL

Posted 19 September 2011 - 06:07 AM (#7)

gushort, on 18 September 2011 - 08:54 PM, said:

You would probably be using the pg gem only for production, and the mysql one locally for development, so be sure to put the sql gem in a development/test group and the pg one into a production group:


group :development, :test do
  gem 'mysql2', '<= 0.2.9'
end

group :production do
  gem pg
end


As for connecting to your db in Heroku, you can't access a Heroku shared db's data remotely. Not easily anyway.

If it is just populating your db with initial records that you're concerned about, then you would probably just use the db/seeds.rb file for that.

I'm mainly talking about populating my database.yml file.

Languages: PHP | JS | Ruby | Rails | C# | Python | Java
0


User is offline TheEmpty 

  • I say words in sequences.
  • Group: Members
  • Posts: 5154
  • Joined: 02-October 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,SQL

Posted 19 September 2011 - 11:40 AM (#8)

gushort, on 18 September 2011 - 08:54 PM, said:

You would probably be using the pg gem only for production, and the mysql one locally for development, so be sure to put the sql gem in a development/test group and the pg one into a production group:


group :development, :test do
  gem 'mysql2', '<= 0.2.9'
end

group :production do
  gem pg
end


As for connecting to your db in Heroku, you can't access a Heroku shared db's data remotely. Not easily anyway.

If it is just populating your db with initial records that you're concerned about, then you would probably just use the db/seeds.rb file for that.

Don't use different dbs, NEVER! PG has different JOINs, etc. so if you won't get those errors in production, use it in development and testing so you get those errors earlier in the stage.
Reserved.
0


User is offline gushort 

  • Group: Members
  • Posts: 452
  • Joined: 05-January 11
  • LocationToronto

Posted 07 October 2011 - 11:46 AM (#9)

ThatRailsGuy, on 19 September 2011 - 11:40 AM, said:

Don't use different dbs, NEVER! PG has different JOINs, etc. so if you won't get those errors in production, use it in development and testing so you get those errors earlier in the stage.


Thanks for the "heads up". I've been using MySQL, as it is what seemed to be the standard, but Heroku uses PG, so I've been installing PG onto my system (what a pain - even with Homebrew), and intend to stick with that.
0


User is offline Mo3 

  • Brogrammer
  • Group: Moderators
  • Posts: 1950
  • Joined: 21-July 10
  • LocationStuttgart, Germany
  • Expertise:PHP,Java,Javascript,Python,Ruby on Rails,Node.js

Posted 07 October 2011 - 01:21 PM (#10)

gushort, on 07 October 2011 - 11:46 AM, said:

Thanks for the "heads up". I've been using MySQL, as it is what seemed to be the standard, but Heroku uses PG, so I've been installing PG onto my system (what a pain - even with Homebrew), and intend to stick with that.


You don't have to install PG, Rails will automatically use SQLite if you don't have it.

Quote

A person who thinks all the time has nothing to think about except thoughts. So he loses touch with reality, and lives in a world of illusion called the past. Things are not explained by the past, they are explained by what happens right now. That creates the past, and it begins here. That's the birth of responsibility.
0


User is offline TheEmpty 

  • I say words in sequences.
  • Group: Members
  • Posts: 5154
  • Joined: 02-October 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,SQL

Posted 07 October 2011 - 05:51 PM (#11)

Homebrew makes that stuff really easy :o though it has been a long time since I've used it.

Mo3, on 07 October 2011 - 01:21 PM, said:

You don't have to install PG, Rails will automatically use SQLite if you don't have it.

1) It's not automatic
2) please see convo
Reserved.
0


User is offline gushort 

  • Group: Members
  • Posts: 452
  • Joined: 05-January 11
  • LocationToronto

Posted 07 October 2011 - 06:19 PM (#12)

Mo3, on 07 October 2011 - 01:21 PM, said:

You don't have to install PG, Rails will automatically use SQLite if you don't have it.


I wanted to install it anyway, so I could easily access data in my Heroku backups.
0


User is offline Daniel15 

  • dan.cx
  • Group: Moderators
  • Posts: 3415
  • Joined: 17-April 10
  • LocationMelbourne, Australia
  • Expertise:HTML,CSS,PHP,Java,Javascript,Node.js,SQL

Posted 07 October 2011 - 09:31 PM (#13)

Quote

You would probably be using the pg gem only for production, and the mysql one locally for development,

If you knew that your live server would be using PostgreSQL, why would you be using MySQL for development? Surely it'd be a lot easier to use PostgreSQL for both? :)

Quote

Thanks for the "heads up". I've been using MySQL, as it is what seemed to be the standard, but Heroku uses PG, so I've been installing PG onto my system (what a pain - even with Homebrew), and intend to stick with that.

MySQL and PostgreSQL are both very commonly used. I'd say that PostgreSQL is better as it's more powerful, but it is harder to set up. Its support for stored procedures is significantly better than that of MySQL, for one. Stored procs are very important for large systems.
Daniel15! :D
Posted Image

Repeat after me: jQuery is not JavaScript. It is not the answer to every JavaScript-related question. When you have to write some JavaScript, do not instantly react with "Oh, I'll do that with jQuery!"

Spoiler
0


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Enter your sign in name and password


Sign in options
  Or sign in with these services