temporal-database

Seed data with old dates in Temporal Table - SQL Server

末鹿安然 提交于 2019-11-27 18:29:16
问题 I need to seed data for my local development purpose in the following Temporal Table, the start date should be old. The given Table Schema is CREATE TABLE [dbo].[Contact]( [ContactID] [uniqueidentifier] NOT NULL, [ContactNumber] [nvarchar](50) NOT NULL, [SequenceID] [int] IDENTITY(1,1) NOT NULL, [SysStartTime] [datetime2](0) GENERATED ALWAYS AS ROW START NOT NULL, [SysEndTime] [datetime2](0) GENERATED ALWAYS AS ROW END NOT NULL, CONSTRAINT [PK_Contact] PRIMARY KEY NONCLUSTERED ( [ContactID]

Historical / auditable database

柔情痞子 提交于 2019-11-27 17:45:28
This question is related to the schema that can be found in one of my other questions here. Basically in my database I store users, locations, sensors amongst other things. All of these things are editable in the system by users, and deletable. However - when an item is edited or deleted I need to store the old data; I need to be able to see what the data was before the change. There are also non-editable items in the database, such as "readings". They are more of a log really. Readings are logged against sensors, because its the reading for a particular sensor. If I generate a report of

Entity Framework not working with temporal table

…衆ロ難τιáo~ 提交于 2019-11-27 14:44:11
I'm using database first entity framework 6. After changing some of the tables in my schema to be temporal tables, I started getting the following error when attempting to insert new data: Cannot insert an explicit value into a GENERATED ALWAYS column in table '<MyDatabase>.dbo.<MyTableName>. Use INSERT with a column list to exclude the GENERATED ALWAYS column, or insert a DEFAULT into GENERATED ALWAYS column. It looks like EF is trying to update the values of the PERIOD columns which are managed by the system. Removing the columns from the EDMX file seems to correct the problem, but this is

Why do we need a temporal database?

那年仲夏 提交于 2019-11-27 10:47:39
I was reading about temporal databases and it seems they have built in time aspects. I wonder why would we need such a model? How different is it from a normal RDBMS? Can't we have a normal database i.e. RDBMS and say have a trigger which associates a time stamp with each transaction that happens? May be there would be a performance hit. But I'm still skeptical on temporal databases having a strong case in the market. Does any of the present databases support such a feature? A temporal database efficiently stores a time series of data, typically by having some fixed timescale (such as seconds

Entity Framework not working with temporal table

房东的猫 提交于 2019-11-27 04:05:33
问题 I'm using database first entity framework 6. After changing some of the tables in my schema to be temporal tables, I started getting the following error when attempting to insert new data: Cannot insert an explicit value into a GENERATED ALWAYS column in table '<MyDatabase>.dbo.<MyTableName>. Use INSERT with a column list to exclude the GENERATED ALWAYS column, or insert a DEFAULT into GENERATED ALWAYS column. It looks like EF is trying to update the values of the PERIOD columns which are

Historical / auditable database

断了今生、忘了曾经 提交于 2019-11-26 22:35:21
问题 This question is related to the schema that can be found in one of my other questions here. Basically in my database I store users, locations, sensors amongst other things. All of these things are editable in the system by users, and deletable. However - when an item is edited or deleted I need to store the old data; I need to be able to see what the data was before the change. There are also non-editable items in the database, such as "readings". They are more of a log really. Readings are

Why do we need a temporal database?

孤街浪徒 提交于 2019-11-26 15:19:22
问题 I was reading about temporal databases and it seems they have built in time aspects. I wonder why would we need such a model? How different is it from a normal RDBMS? Can't we have a normal database i.e. RDBMS and say have a trigger which associates a time stamp with each transaction that happens? May be there would be a performance hit. But I'm still skeptical on temporal databases having a strong case in the market. Does any of the present databases support such a feature? 回答1: A temporal

How to re-save the entity as another row in Doctrine 2

≡放荡痞女 提交于 2019-11-26 08:03:55
问题 Let\'s say I have entity $e . Is there any generic way to store it as another row, which would have the same entity data but another primary key? Why I need this: I\'m implementing some sort of Temporal Database schema and instead of updating the row I just need to create another one. 回答1: Try cloning and add the following method to your entity public function __clone() { $this->id = null; } You may need to detach the entity before persisting it. I don't have my dev machine handy to test this