Fix a bug that database that has reference column can't be removed

We need to remove index columns and reference columns before removing
indexed tables/columns and referenced tables. If we don't remove them
first, remove checks that block inconsistency relationship fails
remove operations.