数据库表的草稿版本 [英] Draft version of database table

查看:327
本文介绍了数据库表的草稿版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有报表的数据库。此表表示报表数据,并具有约束。
现在应用程序被消防员使用,他们可能需要跑掉并发出一些火。
因此,在填充此表的数据的过程中,它们可能需要运行。
我们做的是当会话运行时,我们将数据保存到草稿表,其中我们只是序列化对象图,没有约束(因为我们不知道是否一切都处于有效状态)。
当消防员后来想要拉回数据,我们只需再次拔出草稿。

I have a database with a report table. This table represents report data, and has constraints. Now the application is used by firemen, and they might have to run off and put out some fires. So in the middle of filling out data for this table, they might have to run off. What we do is when the session run out we save the data to a draft table, where we simply serialize the object graph, no constraints (since we can't know if everything is in a valid state). And when the fireman later wants to pull data back out we simply pull out the draft again.

这很好!
然而,消防员现在想要能够搜索表和草图表。
所以这里我想把所有的数据(包括草稿)存储在一个表中,我搜索,所以我不必巩固从两个表的搜索。

This works fine! However the firemen now wants to be able to search the table and the draft table. So here I would like to maybe store all the data (including the draft) into one table, that I search, so I don't have to consolidate the search from two tables..

草稿是否有某种数据库模式?
我想要的是一个用于存储数据的模式,无约束(草图模式)和约束(最终模式)。

Is there some kind of database pattern for drafts? What I want is a patternfor storing data without constraints (in draft mode) and with constraints (in final mode).

推荐答案

使用简单的解决方案:创建一个视图,它只是两个表的联合(应该是相当直接,因为他们假设他们都有(几乎)相同的结构),然后运行搜索作为源如果他们想要包括两个。

Go with the simple solution: create a View which is just a union of the two tables (which should be fairly straight forward as they I assume they both have (almost) identical structures) and then run searches on that as the source if they want to include both.

我不会实际合并完整和草稿数据在任何时候:错误和意外使用未经验证的数据的可能性似乎巨大。

I wouldn't actually merge the complete and draft data at any point: the potential for error and accidental use of unvalidated data seems huge.

您目前不会在英国的IRS工作。如果没有,听起来像DK已经去了类似(原则上)解决这个问题(我曾经在英国消防和救援服务工作)。

You wouldn't be working on an interface for the IRS in the UK at the moment, would you? If not, sounds like DK have gone for a similar (in principle) solution to this problem (I used to work for a UK Fire and Rescue Service).

这篇关于数据库表的草稿版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆