NutzCN Logo
精华 nutwlk配置了多对多关系没有自动建表
发布于 2733天前 作者 新手学nutz 2183 次浏览 复制 上一个帖子 下一个帖子
标签:

sys_user 中加入
@ManyMany(from = "userId", relation = "sys_user_community", target = Community.class, to = "communityId")
protected List communitys;

setup也正常运行
private void initSysData(NutConfig config, Dao dao) {
Daos.createTablesInPackage(dao, "com.smartlife.modules", false);
}

9 回复

主表已存在?中间表没生成?

加一句

Daos.migration(dao, "com.smartlife.modules", true, false);

@wendal

Cannot drop index 'FKD0E84E506379FF33': needed in a foreign key constraint

@qq_ae9ab3fa 啥数据库,什么版本

那就

Daos.migration(dao, "com.smartlife.modules", true, false, false); // 添加字段true, 删除字段false, 检查索引false

@wendal mysql5.6,关联表的id被用作其他一些表的外键,会影响创建中间表吗

添加回复
请先登陆
回到顶部