Skip to content

Improve database primary key setting #10882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TCOTC opened this issue Apr 4, 2024 · 32 comments
Closed

Improve database primary key setting #10882

TCOTC opened this issue Apr 4, 2024 · 32 comments
Assignees
Milestone

Comments

@TCOTC
Copy link
Contributor

TCOTC commented Apr 4, 2024

数据库主键支持隐藏、编辑名称

In what scenarios do you need this feature?

有时候用数据库是当高级表格来用的,会出现没有哪一列适合当主键的情况,所以主键就空着了。

但主键又不能隐藏,放在那里看着就很奇怪。

image

还有在菜单里不能给主键编辑名称:

image

Describe the optimal solution

数据库主键支持隐藏、编辑名称

Describe the candidate solution

No response

Other information

No response

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 4, 2024

比如这种用法就不需要主键:

image

image

https://ld246.com/article/1712247952388

@88250 88250 changed the title 数据库主键支持隐藏、编辑名称 Improve database primary key setting Apr 6, 2024
@88250 88250 added this to the 3.0.8 milestone Apr 6, 2024
@hdg8087
Copy link

hdg8087 commented Apr 6, 2024

能不能让主键也有各种数据类型?

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

能不能让主键也有各种数据类型?

跟隐藏主键之后用其他列的效果是一样的

@Vanessa219 Vanessa219 removed their assignment Apr 6, 2024
@Vanessa219 Vanessa219 removed this from the 3.0.8 milestone Apr 6, 2024
@Vanessa219
Copy link
Member

其他产品不可以隐藏,如果需要隐藏的话还需要再考虑一下是不是会有其他问题。

主键这一列是没有编辑的,在列菜单上也是没有的。

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

如果需要隐藏的话还需要再考虑一下是不是会有其他问题。

@88250 隐藏主键列会有什么问题吗?

我觉得只限制主键不能删除就够了

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

其他产品不可以隐藏

其他产品的数据库中的每个条目都被视为单独的 page(页面),因此 Title(标题) 属性作为打开 page 的入口是不能隐藏的。

而思源笔记的数据库条目在逻辑上有差异,整个数据库就是一个叶子块,没有更小的单位了,因此不必与其他产品保持一致

image

image

image

image

@88250 88250 removed the Enhancement label Apr 6, 2024
@88250
Copy link
Member

88250 commented Apr 6, 2024

作为入口的话,绑定块和非绑定块同时出现时,隐藏主键会有问题。

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

作为入口的话,绑定块和非绑定块同时出现时

不太理解,这是什么意思?

@88250
Copy link
Member

88250 commented Apr 6, 2024

拖入一个块到数据库后,主键要作为打开的入口,和 Notion 类似,如果隐藏了的话就无法区别这个行是绑定到块还是未绑定到块了:

image

第一行是绑定块的。

@88250
Copy link
Member

88250 commented Apr 6, 2024

这个如果实在需要,我建议还是考虑通过插件或者其他扩展方式定制,原生最好还是不要支持,否则设计上可能会有冲突。

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

如果隐藏了的话就无法区别这个行是绑定到块还是未绑定到块了

我觉得没有必要关心这个问题,毕竟有时候主键都用不上根本不需要区分,而且应该由用户决定自己是否需要「区别这个行是绑定到块还是未绑定到块」

@88250
Copy link
Member

88250 commented Apr 6, 2024

那我们假设有一种情况,全部都是绑定块,这时候隐藏会有问题,块的入口无法找到,也就是前面你所提到的 Notion 为什么没有这个设定。

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

那我们假设有一种情况,全部都是绑定块,这时候隐藏会有问题,块的入口无法找到,也就是前面你所提到的 Notion 为什么没有这个设定。

如果用户想隐藏主键列,说明用户不需要看到这个块的入口,如果用户突然需要看到块的入口了,那用户就会再重新显示主键列

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

其他产品的数据库中的每个条目都被视为单独的 page(页面),因此 Title(标题) 属性作为打开 page 的入口是不能隐藏的。

其他产品点开页面是可以直接编辑属性(字段)、编辑文档内容的,跟思源完全不一样:

image

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

思源的「主键」列,根据实际作用应该叫「引用」列。

其他产品的「标题」列之所以叫「标题」,是因为那就是一个单独页面(文档)的标题,即使不填写内容,那也是一个标题为空的页面(文档),其数据库中的属性是这个页面(文档)的属性。

@88250
Copy link
Member

88250 commented Apr 6, 2024

如果用户想隐藏主键列,说明用户不需要看到这个块的入口,如果用户突然需要看到块的入口了,那用户就会再重新显示主键列

这个不足以支撑论点,否则 Notion 也完全可以支持隐藏主键。

其他产品点开页面是可以直接编辑属性(字段)、编辑文档内容的,跟思源完全不一样:

思源对于绑定到文档块的行也可以实现,之前考虑到所有块类型的一致性所以没有做,但不能因此而作为支持隐藏的论据,另外,社区可能也有插件会支持通过主键打开,隐藏主键的话会带来问题。

思源的「主键」列,根据实际作用应该叫「引用」列。

只看文档块的话就和其他产品非常类似了,基于这种使用情况考虑,不能隐藏稳妥些。

@88250
Copy link
Member

88250 commented Apr 6, 2024

综上,考虑就是如果为了视觉而引入潜在的风险的话,我觉得不值得,所以现在最好不开这个口,如果实在需要,还是靠自定义满足。

也许以后某个时间点可以考虑,但现在不适合,风险较高。

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

我不太明白会有什么风险?我感觉主键列跟其他类型的列没什么不同(除了主键列只能有一列)

在视觉上隐藏应该不会影响到实际数据才对

@88250
Copy link
Member

88250 commented Apr 6, 2024

我再总结一下,隐藏主键目前能够预见的潜在问题:

  • 用户会找不到块打开的入口
  • 会影响后续某功能的引入,因为依赖的入口被隐藏了

最后,结合目前的开发情况,我们最好保守一些,以后如果有机会再考虑是否能隐藏主键。

我关闭这个讨论了,谢谢。

@88250 88250 closed this as completed Apr 6, 2024
@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 6, 2024

@88250 那就再讨论一下 issue 的第二个需求:在属性菜单中,数据库主键支持编辑名称

其他属性都可以在属性菜单里一次性添加完并编辑好名称,只有主键名称需要到名称上右键打开菜单然后编辑,这个体验有点割裂

@88250
Copy link
Member

88250 commented Apr 7, 2024

主键这一列是没有编辑的,在列菜单上也是没有的。

@Vanessa219 我觉得可以加一下主键的编辑,使其能够设置名称和换行,和 Notion 类似:

image

@Vanessa219 Vanessa219 self-assigned this Apr 7, 2024
@Vanessa219 Vanessa219 added this to the 3.0.8 milestone Apr 7, 2024
@mozhux
Copy link

mozhux commented Apr 7, 2024

额,其实我也觉得能隐藏挺好的,第一个问题是问题吗?用户选择隐藏主键列,是自己的操作,又不是默认隐藏。第二,隐藏了不是有其他方式可以调出来吗?比如列选择那有个眼镜,只是一个外观上的隐藏。

Vanessa219 added a commit that referenced this issue Apr 7, 2024
@88250
Copy link
Member

88250 commented Apr 7, 2024

你看只读模式这个开关,不也是用户自己打开了然后又问怎么编辑不了……所以对于主键这个关键入口最好还是谨慎一些,加了会带来潜在问题。

@mozhux
Copy link

mozhux commented Apr 7, 2024

你看只读模式这个开关,不也是用户自己打开了然后又问怎么编辑不了……所以对于主键这个关键入口最好还是谨慎一些,加了会带来潜在问题。

这个是因为只读的提示不明显。只有一个小小的锁,之前建议在标题那加上很明显的(只读)类似wps,或者office的一个黄条。提示到位,客户能感知到都没啥问题。

@88250
Copy link
Member

88250 commented Apr 7, 2024

数据库隐藏主键后没有地方提示的,或者说没有显而易见的地方可以提示。另外就是前面提到的第二个问题,主键入口隐藏以后可能会影响其他后续功能交互。所以现在来考虑这个不大可行,要考虑也是后期等功能交互稳定以后再看看。

Vanessa219 added a commit that referenced this issue Apr 7, 2024

Verified

This commit was signed with the committer’s verified signature.
@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 7, 2024

@Vanessa219 包括主键,属性菜单都加个换行:

image

@88250
Copy link
Member

88250 commented Apr 7, 2024

等新 dev 版本看看:

image

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 7, 2024

这里的菜单顺便也搞一下(主键重命名、换行):

image

@88250
Copy link
Member

88250 commented Apr 7, 2024

@Vanessa219

@Vanessa219
Copy link
Member

Vanessa219 commented Apr 7, 2024

这个点击就可以了,是点不开么?

@88250
Copy link
Member

88250 commented Apr 7, 2024

哦哦,我以为不能点:

image

@TCOTC
Copy link
Contributor Author

TCOTC commented Aug 13, 2024

隐藏主键的需求:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants