Explorar el Código

Fix sql server table name customize bug. #632

#632
master
cBear hace 4 años
committed by GitHub
padre
commit
ee6de6aa75
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 4AEE18F83AFDEB23
Se han modificado 1 ficheros con 7 adiciones y 7 borrados
  1. +7
    -7
      src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs

+ 7
- 7
src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs Ver fichero

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

Cargando…
Cancelar
Guardar