clyfe/acts_as_nested_interval — pull request #7 by grzlus (2013-08-08 22:15:43+00:00)
Title: 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.