TypeORM数据库模型,其中许多实体具有共享实体

时间:2020-02-29 13:49:26

标签: javascript typescript database-design typeorm

我需要在alertDialog=dialogBuilder.create(); alertDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); alertDialog.setOnShowListener(new DialogInterface.OnShowListener(){ @Override public void onShow(DialogInterface dialog) { background.setAlpha(0f);background.setVisibility(View.VISIBLE);background.animate().alpha(1f).setDuration(dur); } }); alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener(){ @Override public void onDismiss(DialogInterface dialog){ background.animate().alpha(0f).withEndAction(runnable_background_gone); } }); 中建立以下数据库模型:

enter image description here

我有很多模块,每个模块都附加了一些文件。这些文件在一个my_list_of_dicts = [{ 'id': 3, 'name': 'John' },{ 'id': 5, 'name': 'Peter' },{ 'id': 2, 'name': 'Peter' },{ 'id': 6, 'name': 'Mariah' },{ 'id': 7, 'name': 'John' },{ 'id': 1, 'name': 'Louis' } ] df = pd.DataFrame(my_list_of_dicts) df[df.name.isin(df[df.name.duplicated()]['name'])].to_json(orient='records') 表中定义。

TypeORM documentation saying

如果没有@ ManyToOne,@ OneToMany将不存在

这意味着,我将在File实体上以X列结尾,其中X是我的模块数,但是实体将始终只填充其中的一个。上图的文件实例示例:

TypeORM

可以这样做吗,所以当我得到File实体时,对父模块的引用只有一个(或零个)?

希望这是可以理解的。

0 个答案:

没有答案