use of org.nutz.dao.entity.LinkField in project nutz by nutzam.
the class AbstractJdbcExpert method dropRelation.
public void dropRelation(Dao dao, Entity<?> en) {
final List<Sql> sqls = new ArrayList<Sql>(5);
for (LinkField lf : en.visitManyMany(null, null, null)) {
ManyManyLinkField mm = (ManyManyLinkField) lf;
if (!dao.exists(mm.getRelationName()))
continue;
sqls.add(Sqls.create("DROP TABLE " + mm.getRelationName()));
}
dao.execute(sqls.toArray(new Sql[sqls.size()]));
}
Aggregations