瀏覽代碼

Fix sql server table name customize bug. #632

#632
master
cBear 4 年之前
committed by GitHub
父節點
當前提交
ee6de6aa75
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. +7
    -7
      src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs

+ 7
- 7
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;
}
}
}
}

Loading…
取消
儲存