acts_as_nested_interval
acts_as_nested_interval copied to clipboard
Fix problem with migration on empty database
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.