Fixed the failing case of migrations with an empty layers table.