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

Already on GitHub? Sign in to your account

Migration problems deploying to Heroku #320

Closed
volkanunsal opened this Issue Dec 8, 2010 · 10 comments

Comments

Projects
None yet
3 participants

I am seeing lots of migration issues in deploying a new 0.9.8.6 app to Heroku. To replicate, generate a new app and in your Gemfile leave only Refinery, blog and i18n. (Note: inquiries is left out.) Bundle install this. Now deploy to a new Heroku app.

This is the error message you will come across:

uninitialized constant Inquiry

Rest is here: https://gist.github.com/733518

I tried removing anything that had "Inquiries" from the migration files, but that ended up surfacing other errors.

Owner

parndt commented Dec 8, 2010

You can't disable the inquiries engine at version 0.9.8.6 before migrating which is why you're getting migration problems.

Now I'm getting this error after adding back Inquries

An error has occurred, this and all later migrations canceled:

PGError: ERROR: current transaction is aborted, commands ignored until end of transaction block
: SELECT COUNT(*)
FROM pg_tables
WHERE tablename = 'roles'

Owner

parndt commented Dec 8, 2010

Try starting again as it's a new app?

Hmm..no, still the same error. I generated a new app just to test if it would work.

Here is my Gemfile:

https://gist.github.com/733977

This is the full error log:

https://gist.github.com/734014

Contributor

wjbuys commented Dec 11, 2010

It looks like Postgres needs to have the roles_users relation available before creating the roles table that references it:

PK and serial sequence (1.8ms)   SELECT attr.attname, seq.relname
 FROM pg_class seq,
 pg_attribute attr,
 pg_depend dep,
 pg_namespace name,
 pg_constraint cons
 WHERE seq.oid = dep.objid
 AND seq.relkind = 'S'
 AND attr.attrelid = dep.refobjid
 AND attr.attnum = dep.refobjsubid
 AND attr.attrelid = cons.conrelid
 AND attr.attnum = cons.conkey[1]
 AND cons.contype = 'p'
 AND dep.refobjid = '"roles_users"'::regclass
PGError: ERROR:  relation "roles_users" does not exist
LINE 14:             AND dep.refobjid      = '"roles_users"'::regclas...
                                             ^
:           SELECT attr.attname, seq.relname
          FROM pg_class      seq,
               pg_attribute  attr,
               pg_depend     dep,
               pg_namespace  name,
               pg_constraint cons
          WHERE seq.oid           = dep.objid
            AND seq.relkind       = 'S'
            AND attr.attrelid     = dep.refobjid
            AND attr.attnum       = dep.refobjsubid
            AND attr.attrelid     = cons.conrelid
            AND attr.attnum       = cons.conkey[1]
            AND cons.contype      = 'p'
            AND dep.refobjid      = '"roles_users"'::regclass

I've been able to work around this by moving the RolesUsers migration to just before the Roles migration. As soon as I can figure out how refinery's migrations get converted to the final format, I'll send a pull request.

Owner

parndt commented Dec 11, 2010

I've merged this and will be pushing 0.9.8.7 in a couple of days, first I want to address any other issues that may be present (i.e. images not being insertable just after being uploaded https://github.com/resolve/refinerycms/issues#issue/312) - patches make this process faster!

I wonder if someone could tell me what to do if I need to deploy before the 0.9.8.7 is released? I really need to deploy on Wednesday.

Owner

parndt commented Dec 14, 2010

I'll release 0.9.8.7 today

Owner

parndt commented Dec 15, 2010

Document new version 0.9.8.7 - Closed by ade7bec

unixcharles pushed a commit to unixcharles/refinerycms that referenced this issue Jun 1, 2011

m1k3 pushed a commit to m1k3/refinerycms that referenced this issue Mar 8, 2012

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment