Procházet zdrojové kódy

Fix sql server table name customize bug. #632

#632
master
cBear před 4 roky
committed by GitHub
rodič
revize
ee6de6aa75
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
1 změnil soubory, kde provedl 7 přidání a 7 odebrání
  1. +7
    -7
      src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs

+ 7
- 7
src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs Zobrazit soubor

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

Načítá se…
Zrušit
Uložit