Browse Source

Fix sql server table name customize bug. #632

#632
master
cBear 4 years ago
committed by GitHub
parent
commit
ee6de6aa75
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs

+ 7
- 7
src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs View File

@@ -25,12 +25,12 @@ namespace DotNetCore.CAP.SqlServer


public virtual string GetPublishedTableName() public virtual string GetPublishedTableName()
{ {
return $"[{_options.Value.Schema}].[Published]";
return $"{_options.Value.Schema}.Published";
} }


public virtual string GetReceivedTableName() public virtual string GetReceivedTableName()
{ {
return $"[{_options.Value.Schema}].[Received]";
return $"{_options.Value.Schema}.Received";
} }


public async Task InitializeAsync(CancellationToken cancellationToken) public async Task InitializeAsync(CancellationToken cancellationToken)
@@ -57,7 +57,7 @@ END;


IF OBJECT_ID(N'{GetReceivedTableName()}',N'U') IS NULL IF OBJECT_ID(N'{GetReceivedTableName()}',N'U') IS NULL
BEGIN BEGIN
CREATE TABLE [{schema}].[Received](
CREATE TABLE {GetReceivedTableName()}(
[Id] [bigint] NOT NULL, [Id] [bigint] NOT NULL,
[Version] [nvarchar](20) NOT NULL, [Version] [nvarchar](20) NOT NULL,
[Name] [nvarchar](200) NOT NULL, [Name] [nvarchar](200) NOT NULL,
@@ -67,7 +67,7 @@ CREATE TABLE [{schema}].[Received](
[Added] [datetime2](7) NOT NULL, [Added] [datetime2](7) NOT NULL,
[ExpiresAt] [datetime2](7) NULL, [ExpiresAt] [datetime2](7) NULL,
[StatusName] [nvarchar](50) NOT NULL, [StatusName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_{schema}.Received] PRIMARY KEY CLUSTERED
CONSTRAINT [PK_{GetReceivedTableName()}] PRIMARY KEY CLUSTERED
( (
[Id] ASC [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] )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 IF OBJECT_ID(N'{GetPublishedTableName()}',N'U') IS NULL
BEGIN BEGIN
CREATE TABLE [{schema}].[Published](
CREATE TABLE {GetPublishedTableName()}(
[Id] [bigint] NOT NULL, [Id] [bigint] NOT NULL,
[Version] [nvarchar](20) NOT NULL, [Version] [nvarchar](20) NOT NULL,
[Name] [nvarchar](200) NOT NULL, [Name] [nvarchar](200) NOT NULL,
@@ -85,7 +85,7 @@ CREATE TABLE [{schema}].[Published](
[Added] [datetime2](7) NOT NULL, [Added] [datetime2](7) NOT NULL,
[ExpiresAt] [datetime2](7) NULL, [ExpiresAt] [datetime2](7) NULL,
[StatusName] [nvarchar](50) NOT NULL, [StatusName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_{schema}.Published] PRIMARY KEY CLUSTERED
CONSTRAINT [PK_{GetPublishedTableName()}] PRIMARY KEY CLUSTERED
( (
[Id] ASC [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] )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; return batchSql;
} }
} }
}
}

Loading…
Cancel
Save