The foreign keys existed on my dev box. I did a db:push followed a few days later by a db:pull. The db:pull threw errors so I dropped all the tables and did the db:pull again. At this point all my foreign keys were gone. Since, to my knowledge there is no good way to check the database to see if the keys exist on the production site (outside of writing some custom rails code to check it) I must assume that they do not exist since pulling the other direction resulted in them being gone.
Rails apps not employing foreign keys is just stupid, at least for any serious business app. Heroku uses Postgresql which means that they support foreign keys, they just don't currently support a good way of creating them in the database. Here's another issue that I have with the whole Heroku database thing. My app can have 1 database, but not 2. This means that in order to run any intensive query (end of quarter reports, etc) I have to hit my live database instead of a replicated database which paralyzes the site while it runs. Not to mention that the dyno gets killed before it finishes anyway. This wouldn't be as big of a deal if I had a way to get a decent dump that could be loaded into another server at the end of the month/quarter/year, etc to run the queries against, but technically the db:pull isn't giving me a true copy of my database. Since I can't access the database from outside the app it is also impossible for me to set up a replicated server on say an EC2 instance to use to crunch the numbers. Which leads back to my original question about the target audience for Heroku, which I assume to be the personal blogger. -Chris On Tue, Mar 23, 2010 at 7:45 PM, Jamie Lawrence <[email protected]> wrote: > I guessing that the foreign keys are being used on Heroku but that > db:push/db:pull simply doesn't support them. Unless you're thinking of > rounding tripping the db, is it not sufficient to have those > constraints on the production site only? > > My understanding is also that (for better or worse) Rails apps don't > usually employ foreign key constraints. > > Jamie > > On Mar 23, 6:16 am, Chris <[email protected]> wrote: >> I just did a heroku db:pull and was VERY bummed to find that all my >> foreign key constraints were lost. Luckily I haven't launched the >> site yet. Referential data integrity is a major concern, and >> obviously my foreign keys are not being implemented on the heroku >> database. >> >> Question: >> What is the recommended way for dealing with foreign key constraints >> in Heroku if they get lost doing a db:push? >> >> Side Note: The database interaction is currently the #1 issue why I'm >> considering NOT using Heroku. I can deal with the read only >> filesystem, but what's the point in using Postgresql if you aren't >> going to preserve foreign key constraints? For the little user blog >> it probably doesn't matter much, but for any of us that are >> considering spending a bunch of money on dynos and dedicated databases >> this is a major shortcoming. >> >> Features that I would consider a must for any realistic business site: >> 1) The ability to TRULY dump the database. (pg_dump) Preferably to >> S3. And of course the reverse (importing the database). >> 2) Access to the database through the console (psql). I realize that >> I can access it through the models, this isn't what I want, I want to >> be able to login to the console and issue custom sql queries. >> >> My $0.02 >> >> So out of curiosity, as a business, who is Heroku's target audience? >> >> -Chris > > -- > You received this message because you are subscribed to the Google Groups > "Heroku" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/heroku?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.
