acts_as_nested_interval icon indicating copy to clipboard operation
acts_as_nested_interval copied to clipboard

Fix problem with migration on empty database

Open grzlus opened this issue 12 years ago • 0 comments

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.

grzlus avatar Aug 08 '13 22:08 grzlus