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

Indentation for temporal tables in OnModelCreating is a bit wonky #1267

Closed
CaiusJard opened this issue Feb 1, 2022 · 4 comments
Closed

Indentation for temporal tables in OnModelCreating is a bit wonky #1267

CaiusJard opened this issue Feb 1, 2022 · 4 comments
Labels
question Further information is requested

Comments

@CaiusJard
Copy link

CaiusJard commented Feb 1, 2022

image

Steps to reproduce

I just created a normal table, turned it temporal with an ALTER and then did an EFCPT rev engineer

Further technical details

EF Core version in use: EF Core 6

EF Core Power Tools version: current daily 2.5.902

Database engine: SQL Server 2017

Visual Studio version: 2022 17.0.5

@ErikEJ
Copy link
Owner

ErikEJ commented Feb 1, 2022

Possible EF Core issue @roji ?

@ErikEJ
Copy link
Owner

ErikEJ commented Feb 1, 2022

@CaiusJard Are you using DbContext splitting?

@CaiusJard
Copy link
Author

No splitting - here's what I have configured:

image
image
image
image

Here's the table create script:

/****** Object:  Table [dbo].[Containers]    Script Date: 2022-02-01 17:34:39 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Containers](
	[ContainerId] [int] IDENTITY(1,1) NOT NULL,
	[HierarchyId] [hierarchyid] NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[SysStartTime] [datetime2](7) GENERATED ALWAYS AS ROW START NOT NULL,
	[SysEndTime] [datetime2](7) GENERATED ALWAYS AS ROW END NOT NULL,
 CONSTRAINT [PK_Containers] PRIMARY KEY CLUSTERED 
(
	[ContainerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
	PERIOD FOR SYSTEM_TIME ([SysStartTime], [SysEndTime])
) ON [PRIMARY]
WITH
(
SYSTEM_VERSIONING = ON ( HISTORY_TABLE = [dbo].[MSSQL_TemporalHistoryFor_434100587] )
)
GO

ALTER TABLE [dbo].[Containers] ADD  CONSTRAINT [DF_SysStart]  DEFAULT (sysutcdatetime()) FOR [SysStartTime]
GO

ALTER TABLE [dbo].[Containers] ADD  CONSTRAINT [DF_SysEnd]  DEFAULT (CONVERT([datetime2],'9999-12-31 23:59:59.9999999')) FOR [SysEndTime]
GO

SQLS2017

I just went and took that script, changed all the names to have 2 on the end and made another table and rev'd it.. Indentation also comes through short on that one, so hopefully it will help you repro (sorry for omitting the detail earlier)

image

@ErikEJ
Copy link
Owner

ErikEJ commented Feb 1, 2022

It is an EF Core Bug and will be fixed in EF Core 7 🤥 dotnet/efcore#26349

@ErikEJ ErikEJ closed this as completed Feb 1, 2022
@ErikEJ ErikEJ added the question Further information is requested label Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants