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

Fix problem with migration on empty database #7

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix problem with migration on empty database #7

wants to merge 4 commits into from

Conversation

grzlus
Copy link
Contributor

@grzlus grzlus commented Aug 8, 2013

When we run migration on empty database it probably fail with error something like that:

rake aborted!
PG::Error: BŁĄD:  relation "categories" doesn't exists
LINE 5:                WHERE a.attrelid = '"categories"'::regclass
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '"categories"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

I fix it by checking if main table is exists.

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

Successfully merging this pull request may close these issues.

1 participant