diff --git a/src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs b/src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs index f617af7..2b6636c 100644 --- a/src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs +++ b/src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs @@ -25,12 +25,12 @@ namespace DotNetCore.CAP.SqlServer public virtual string GetPublishedTableName() { - return $"[{_options.Value.Schema}].[Published]"; + return $"{_options.Value.Schema}.Published"; } public virtual string GetReceivedTableName() { - return $"[{_options.Value.Schema}].[Received]"; + return $"{_options.Value.Schema}.Received"; } public async Task InitializeAsync(CancellationToken cancellationToken) @@ -57,7 +57,7 @@ END; IF OBJECT_ID(N'{GetReceivedTableName()}',N'U') IS NULL BEGIN -CREATE TABLE [{schema}].[Received]( +CREATE TABLE {GetReceivedTableName()}( [Id] [bigint] NOT NULL, [Version] [nvarchar](20) NOT NULL, [Name] [nvarchar](200) NOT NULL, @@ -67,7 +67,7 @@ CREATE TABLE [{schema}].[Received]( [Added] [datetime2](7) NOT NULL, [ExpiresAt] [datetime2](7) NULL, [StatusName] [nvarchar](50) NOT NULL, - CONSTRAINT [PK_{schema}.Received] PRIMARY KEY CLUSTERED + CONSTRAINT [PK_{GetReceivedTableName()}] PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] @@ -76,7 +76,7 @@ END; IF OBJECT_ID(N'{GetPublishedTableName()}',N'U') IS NULL BEGIN -CREATE TABLE [{schema}].[Published]( +CREATE TABLE {GetPublishedTableName()}( [Id] [bigint] NOT NULL, [Version] [nvarchar](20) NOT NULL, [Name] [nvarchar](200) NOT NULL, @@ -85,7 +85,7 @@ CREATE TABLE [{schema}].[Published]( [Added] [datetime2](7) NOT NULL, [ExpiresAt] [datetime2](7) NULL, [StatusName] [nvarchar](50) NOT NULL, - CONSTRAINT [PK_{schema}.Published] PRIMARY KEY CLUSTERED + CONSTRAINT [PK_{GetPublishedTableName()}] PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] @@ -94,4 +94,4 @@ END;"; return batchSql; } } -} \ No newline at end of file +}