Skip to content
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

enable_nullable能否扩展, 支持特定类型列允许null, 而其余类型列不允许 #435

Closed
Fanduzi opened this issue Mar 3, 2022 · 2 comments
Labels
wontfix This will not be worked on

Comments

@Fanduzi
Copy link

Fanduzi commented Mar 3, 2022

描述您想要的功能:
类似添加一个参数 nullable_col_type_list: [datetime]

为什么需要这个功能呢.
有一些业务场景, 如用户订单表, 需要一个订单完成时间, 或者付款时间列. 这个列往往是datetime类型. 在用户下单后, 订单完成时间或付款时间就应该是null, 无论从业务逻辑还是从语义上null都是合理的.
如果enable_nullable=false. 则所有列都不允许null. 需要not null default. 对于datetime类型列. 只能设置一个"magic number", 如1970-01-01. 写过代码的人都知道, magic number不是一个好的设计.
但是如果enable_nullable=true, 则其他类型的列, 如varchar, 也可以null了.

我们目前的情况是, 只有datetime类型列希望可以允许null, 而其他类型列都不允许null. 目前goinception貌似无法实现吧. 作者能否支持一下, 不胜感激

描述您考虑过的解决/替代方案:

可参考文档,资料,引用等:

@hanchuanchuan
Copy link
Owner

可参考 PR #319#418 来实现,欢迎提交PR。

@stale
Copy link

stale bot commented Apr 16, 2022

由于此问题没有最近的活动,因此已被自动标记为陈旧。如果没有进一步的活动,会作为不活跃issue关闭。感谢你对本项目的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 16, 2022
@stale stale bot closed this as completed Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants