Browse Source

SQLServer db init

ZhengKaiFa
wanggang 2 years ago
parent
commit
04b6b7c614
  1. 2
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj
  2. 930
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.AuthDbContext.sql
  3. 1159
      be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.BasedataDbContext.sql
  4. 6037
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql
  5. 16
      be/Modules/Shared/src/Win_in.Sfs.Shared.Host/ModuleBase.cs
  6. 20
      build/src/docker/publish/settings/appsettings.Development.json

2
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj

@ -14,7 +14,7 @@
<PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Win_in.Sfs.Auth-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.323.1733</Version>
<Version>1.2023.323.1845</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>

930
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.AuthDbContext.sql

@ -0,0 +1,930 @@
CREATE TABLE [AbpAuditLogs] (
[Id] uniqueidentifier NOT NULL,
[ApplicationName] nvarchar(96) NULL,
[UserId] uniqueidentifier NULL,
[UserName] nvarchar(256) NULL,
[TenantId] uniqueidentifier NULL,
[TenantName] nvarchar(64) NULL,
[ImpersonatorUserId] uniqueidentifier NULL,
[ImpersonatorUserName] nvarchar(256) NULL,
[ImpersonatorTenantId] uniqueidentifier NULL,
[ImpersonatorTenantName] nvarchar(64) NULL,
[ExecutionTime] datetime2 NOT NULL,
[ExecutionDuration] int NOT NULL,
[ClientIpAddress] nvarchar(64) NULL,
[ClientName] nvarchar(128) NULL,
[ClientId] nvarchar(64) NULL,
[CorrelationId] nvarchar(64) NULL,
[BrowserInfo] nvarchar(512) NULL,
[HttpMethod] nvarchar(16) NULL,
[Url] nvarchar(256) NULL,
[Exceptions] nvarchar(max) NULL,
[Comments] nvarchar(256) NULL,
[HttpStatusCode] int NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
CONSTRAINT [PK_AbpAuditLogs] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpBackgroundJobs] (
[Id] uniqueidentifier NOT NULL,
[JobName] nvarchar(128) NOT NULL,
[JobArgs] nvarchar(max) NOT NULL,
[TryCount] smallint NOT NULL DEFAULT CAST(0 AS smallint),
[CreationTime] datetime2 NOT NULL,
[NextTryTime] datetime2 NOT NULL,
[LastTryTime] datetime2 NULL,
[IsAbandoned] bit NOT NULL DEFAULT CAST(0 AS bit),
[Priority] tinyint NOT NULL DEFAULT CAST(15 AS tinyint),
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
CONSTRAINT [PK_AbpBackgroundJobs] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpClaimTypes] (
[Id] uniqueidentifier NOT NULL,
[Name] nvarchar(256) NOT NULL,
[Required] bit NOT NULL,
[IsStatic] bit NOT NULL,
[Regex] nvarchar(512) NULL,
[RegexDescription] nvarchar(128) NULL,
[Description] nvarchar(256) NULL,
[ValueType] int NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
CONSTRAINT [PK_AbpClaimTypes] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpFeatureValues] (
[Id] uniqueidentifier NOT NULL,
[Name] nvarchar(128) NOT NULL,
[Value] nvarchar(128) NOT NULL,
[ProviderName] nvarchar(64) NULL,
[ProviderKey] nvarchar(64) NULL,
CONSTRAINT [PK_AbpFeatureValues] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpLinkUsers] (
[Id] uniqueidentifier NOT NULL,
[SourceUserId] uniqueidentifier NOT NULL,
[SourceTenantId] uniqueidentifier NULL,
[TargetUserId] uniqueidentifier NOT NULL,
[TargetTenantId] uniqueidentifier NULL,
CONSTRAINT [PK_AbpLinkUsers] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpOrganizationUnits] (
[Id] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[ParentId] uniqueidentifier NULL,
[Code] nvarchar(95) NOT NULL,
[DisplayName] nvarchar(128) NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT CAST(0 AS bit),
[DeleterId] uniqueidentifier NULL,
[DeletionTime] datetime2 NULL,
CONSTRAINT [PK_AbpOrganizationUnits] PRIMARY KEY ([Id]),
CONSTRAINT [FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId] FOREIGN KEY ([ParentId]) REFERENCES [AbpOrganizationUnits] ([Id])
);
GO
CREATE TABLE [AbpPermissionGrants] (
[Id] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[Name] nvarchar(128) NOT NULL,
[ProviderName] nvarchar(64) NOT NULL,
[ProviderKey] nvarchar(64) NOT NULL,
CONSTRAINT [PK_AbpPermissionGrants] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpRoles] (
[Id] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[Name] nvarchar(256) NOT NULL,
[NormalizedName] nvarchar(256) NOT NULL,
[IsDefault] bit NOT NULL,
[IsStatic] bit NOT NULL,
[IsPublic] bit NOT NULL,
[Description] nvarchar(64) NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
CONSTRAINT [PK_AbpRoles] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpSecurityLogs] (
[Id] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[ApplicationName] nvarchar(96) NULL,
[Identity] nvarchar(96) NULL,
[Action] nvarchar(96) NULL,
[UserId] uniqueidentifier NULL,
[UserName] nvarchar(256) NULL,
[TenantName] nvarchar(64) NULL,
[ClientId] nvarchar(64) NULL,
[CorrelationId] nvarchar(64) NULL,
[ClientIpAddress] nvarchar(64) NULL,
[BrowserInfo] nvarchar(512) NULL,
[CreationTime] datetime2 NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
CONSTRAINT [PK_AbpSecurityLogs] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpSettings] (
[Id] uniqueidentifier NOT NULL,
[Name] nvarchar(128) NOT NULL,
[Value] nvarchar(2048) NOT NULL,
[ProviderName] nvarchar(64) NULL,
[ProviderKey] nvarchar(64) NULL,
CONSTRAINT [PK_AbpSettings] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpTenants] (
[Id] uniqueidentifier NOT NULL,
[Name] nvarchar(64) NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT CAST(0 AS bit),
[DeleterId] uniqueidentifier NULL,
[DeletionTime] datetime2 NULL,
CONSTRAINT [PK_AbpTenants] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [AbpUsers] (
[Id] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[UserName] nvarchar(256) NOT NULL,
[NormalizedUserName] nvarchar(256) NOT NULL,
[Name] nvarchar(64) NULL,
[Surname] nvarchar(64) NULL,
[Email] nvarchar(256) NOT NULL,
[NormalizedEmail] nvarchar(256) NOT NULL,
[EmailConfirmed] bit NOT NULL DEFAULT CAST(0 AS bit),
[PasswordHash] nvarchar(256) NULL,
[SecurityStamp] nvarchar(256) NOT NULL,
[IsExternal] bit NOT NULL DEFAULT CAST(0 AS bit),
[PhoneNumber] nvarchar(16) NULL,
[PhoneNumberConfirmed] bit NOT NULL DEFAULT CAST(0 AS bit),
[IsActive] bit NOT NULL,
[TwoFactorEnabled] bit NOT NULL DEFAULT CAST(0 AS bit),
[LockoutEnd] datetimeoffset NULL,
[LockoutEnabled] bit NOT NULL DEFAULT CAST(0 AS bit),
[AccessFailedCount] int NOT NULL DEFAULT 0,
[DepartmentCode] nvarchar(64) NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT CAST(0 AS bit),
[DeleterId] uniqueidentifier NULL,
[DeletionTime] datetime2 NULL,
CONSTRAINT [PK_AbpUsers] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [Auth_Department] (
[Id] uniqueidentifier NOT NULL,
[Code] nvarchar(64) NOT NULL,
[Name] nvarchar(64) NULL,
[Description] nvarchar(1024) NULL,
[IsActive] bit NOT NULL DEFAULT CAST(1 AS bit),
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[TenantId] uniqueidentifier NULL,
[Remark] nvarchar(3072) NULL,
CONSTRAINT [PK_Auth_Department] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [Auth_Menu] (
[Id] uniqueidentifier NOT NULL,
[Code] nvarchar(64) NOT NULL,
[Name] nvarchar(64) NOT NULL,
[Description] nvarchar(1024) NULL,
[Icon] nvarchar(64) NULL,
[Route] nvarchar(64) NULL,
[Status] nvarchar(64) NOT NULL DEFAULT N'Enable',
[Sort] int NOT NULL,
[Portal] nvarchar(64) NOT NULL,
[ParentCode] nvarchar(64) NULL,
[Permission] nvarchar(64) NULL,
[Component] nvarchar(64) NULL,
[GroupName] nvarchar(1024) NULL,
[GroupSort] int NOT NULL,
[CountUrl] nvarchar(max) NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[TenantId] uniqueidentifier NULL,
[Remark] nvarchar(3072) NULL,
CONSTRAINT [PK_Auth_Menu] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [Auth_UserMenu] (
[Id] uniqueidentifier NOT NULL,
[UserId] uniqueidentifier NOT NULL,
[MenuCode] nvarchar(64) NOT NULL,
[Portal] nvarchar(64) NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[TenantId] uniqueidentifier NULL,
[Remark] nvarchar(3072) NULL,
CONSTRAINT [PK_Auth_UserMenu] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [Auth_UserWorkGroup] (
[Id] uniqueidentifier NOT NULL,
[UserId] uniqueidentifier NOT NULL,
[WorkGroupCode] nvarchar(64) NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[TenantId] uniqueidentifier NULL,
[Remark] nvarchar(3072) NULL,
CONSTRAINT [PK_Auth_UserWorkGroup] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [IdentityServerApiResources] (
[Id] uniqueidentifier NOT NULL,
[Name] nvarchar(200) NOT NULL,
[DisplayName] nvarchar(200) NULL,
[Description] nvarchar(1000) NULL,
[Enabled] bit NOT NULL,
[AllowedAccessTokenSigningAlgorithms] nvarchar(100) NULL,
[ShowInDiscoveryDocument] bit NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT CAST(0 AS bit),
[DeleterId] uniqueidentifier NULL,
[DeletionTime] datetime2 NULL,
CONSTRAINT [PK_IdentityServerApiResources] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [IdentityServerApiScopes] (
[Id] uniqueidentifier NOT NULL,
[Enabled] bit NOT NULL,
[Name] nvarchar(200) NOT NULL,
[DisplayName] nvarchar(200) NULL,
[Description] nvarchar(1000) NULL,
[Required] bit NOT NULL,
[Emphasize] bit NOT NULL,
[ShowInDiscoveryDocument] bit NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT CAST(0 AS bit),
[DeleterId] uniqueidentifier NULL,
[DeletionTime] datetime2 NULL,
CONSTRAINT [PK_IdentityServerApiScopes] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [IdentityServerClients] (
[Id] uniqueidentifier NOT NULL,
[ClientId] nvarchar(200) NOT NULL,
[ClientName] nvarchar(200) NULL,
[Description] nvarchar(1000) NULL,
[ClientUri] nvarchar(2000) NULL,
[LogoUri] nvarchar(2000) NULL,
[Enabled] bit NOT NULL,
[ProtocolType] nvarchar(200) NOT NULL,
[RequireClientSecret] bit NOT NULL,
[RequireConsent] bit NOT NULL,
[AllowRememberConsent] bit NOT NULL,
[AlwaysIncludeUserClaimsInIdToken] bit NOT NULL,
[RequirePkce] bit NOT NULL,
[AllowPlainTextPkce] bit NOT NULL,
[RequireRequestObject] bit NOT NULL,
[AllowAccessTokensViaBrowser] bit NOT NULL,
[FrontChannelLogoutUri] nvarchar(2000) NULL,
[FrontChannelLogoutSessionRequired] bit NOT NULL,
[BackChannelLogoutUri] nvarchar(2000) NULL,
[BackChannelLogoutSessionRequired] bit NOT NULL,
[AllowOfflineAccess] bit NOT NULL,
[IdentityTokenLifetime] int NOT NULL,
[AllowedIdentityTokenSigningAlgorithms] nvarchar(100) NULL,
[AccessTokenLifetime] int NOT NULL,
[AuthorizationCodeLifetime] int NOT NULL,
[ConsentLifetime] int NULL,
[AbsoluteRefreshTokenLifetime] int NOT NULL,
[SlidingRefreshTokenLifetime] int NOT NULL,
[RefreshTokenUsage] int NOT NULL,
[UpdateAccessTokenClaimsOnRefresh] bit NOT NULL,
[RefreshTokenExpiration] int NOT NULL,
[AccessTokenType] int NOT NULL,
[EnableLocalLogin] bit NOT NULL,
[IncludeJwtId] bit NOT NULL,
[AlwaysSendClientClaims] bit NOT NULL,
[ClientClaimsPrefix] nvarchar(200) NULL,
[PairWiseSubjectSalt] nvarchar(200) NULL,
[UserSsoLifetime] int NULL,
[UserCodeType] nvarchar(100) NULL,
[DeviceCodeLifetime] int NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT CAST(0 AS bit),
[DeleterId] uniqueidentifier NULL,
[DeletionTime] datetime2 NULL,
CONSTRAINT [PK_IdentityServerClients] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [IdentityServerDeviceFlowCodes] (
[Id] uniqueidentifier NOT NULL,
[DeviceCode] nvarchar(200) NOT NULL,
[UserCode] nvarchar(200) NOT NULL,
[SubjectId] nvarchar(200) NULL,
[SessionId] nvarchar(100) NULL,
[ClientId] nvarchar(200) NOT NULL,
[Description] nvarchar(200) NULL,
[Expiration] datetime2 NOT NULL,
[Data] nvarchar(max) NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
CONSTRAINT [PK_IdentityServerDeviceFlowCodes] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [IdentityServerIdentityResources] (
[Id] uniqueidentifier NOT NULL,
[Name] nvarchar(200) NOT NULL,
[DisplayName] nvarchar(200) NULL,
[Description] nvarchar(1000) NULL,
[Enabled] bit NOT NULL,
[Required] bit NOT NULL,
[Emphasize] bit NOT NULL,
[ShowInDiscoveryDocument] bit NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT CAST(0 AS bit),
[DeleterId] uniqueidentifier NULL,
[DeletionTime] datetime2 NULL,
CONSTRAINT [PK_IdentityServerIdentityResources] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [IdentityServerPersistedGrants] (
[Key] nvarchar(200) NOT NULL,
[Type] nvarchar(50) NOT NULL,
[SubjectId] nvarchar(200) NULL,
[SessionId] nvarchar(100) NULL,
[ClientId] nvarchar(200) NOT NULL,
[Description] nvarchar(200) NULL,
[CreationTime] datetime2 NOT NULL,
[Expiration] datetime2 NULL,
[ConsumedTime] datetime2 NULL,
[Data] nvarchar(max) NOT NULL,
[Id] uniqueidentifier NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
CONSTRAINT [PK_IdentityServerPersistedGrants] PRIMARY KEY ([Key])
);
GO
CREATE TABLE [AbpAuditLogActions] (
[Id] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[AuditLogId] uniqueidentifier NOT NULL,
[ServiceName] nvarchar(256) NULL,
[MethodName] nvarchar(128) NULL,
[Parameters] nvarchar(2000) NULL,
[ExecutionTime] datetime2 NOT NULL,
[ExecutionDuration] int NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
CONSTRAINT [PK_AbpAuditLogActions] PRIMARY KEY ([Id]),
CONSTRAINT [FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId] FOREIGN KEY ([AuditLogId]) REFERENCES [AbpAuditLogs] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpEntityChanges] (
[Id] uniqueidentifier NOT NULL,
[AuditLogId] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[ChangeTime] datetime2 NOT NULL,
[ChangeType] tinyint NOT NULL,
[EntityTenantId] uniqueidentifier NULL,
[EntityId] nvarchar(128) NOT NULL,
[EntityTypeFullName] nvarchar(128) NOT NULL,
[ExtraProperties] nvarchar(max) NULL,
CONSTRAINT [PK_AbpEntityChanges] PRIMARY KEY ([Id]),
CONSTRAINT [FK_AbpEntityChanges_AbpAuditLogs_AuditLogId] FOREIGN KEY ([AuditLogId]) REFERENCES [AbpAuditLogs] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpOrganizationUnitRoles] (
[RoleId] uniqueidentifier NOT NULL,
[OrganizationUnitId] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
CONSTRAINT [PK_AbpOrganizationUnitRoles] PRIMARY KEY ([OrganizationUnitId], [RoleId]),
CONSTRAINT [FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId] FOREIGN KEY ([OrganizationUnitId]) REFERENCES [AbpOrganizationUnits] ([Id]) ON DELETE CASCADE,
CONSTRAINT [FK_AbpOrganizationUnitRoles_AbpRoles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [AbpRoles] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpRoleClaims] (
[Id] uniqueidentifier NOT NULL,
[RoleId] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[ClaimType] nvarchar(256) NOT NULL,
[ClaimValue] nvarchar(1024) NULL,
CONSTRAINT [PK_AbpRoleClaims] PRIMARY KEY ([Id]),
CONSTRAINT [FK_AbpRoleClaims_AbpRoles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [AbpRoles] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpTenantConnectionStrings] (
[TenantId] uniqueidentifier NOT NULL,
[Name] nvarchar(64) NOT NULL,
[Value] nvarchar(1024) NOT NULL,
CONSTRAINT [PK_AbpTenantConnectionStrings] PRIMARY KEY ([TenantId], [Name]),
CONSTRAINT [FK_AbpTenantConnectionStrings_AbpTenants_TenantId] FOREIGN KEY ([TenantId]) REFERENCES [AbpTenants] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpUserClaims] (
[Id] uniqueidentifier NOT NULL,
[UserId] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[ClaimType] nvarchar(256) NOT NULL,
[ClaimValue] nvarchar(1024) NULL,
CONSTRAINT [PK_AbpUserClaims] PRIMARY KEY ([Id]),
CONSTRAINT [FK_AbpUserClaims_AbpUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [AbpUsers] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpUserLogins] (
[UserId] uniqueidentifier NOT NULL,
[LoginProvider] nvarchar(64) NOT NULL,
[TenantId] uniqueidentifier NULL,
[ProviderKey] nvarchar(196) NOT NULL,
[ProviderDisplayName] nvarchar(128) NULL,
CONSTRAINT [PK_AbpUserLogins] PRIMARY KEY ([UserId], [LoginProvider]),
CONSTRAINT [FK_AbpUserLogins_AbpUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [AbpUsers] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpUserOrganizationUnits] (
[UserId] uniqueidentifier NOT NULL,
[OrganizationUnitId] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
CONSTRAINT [PK_AbpUserOrganizationUnits] PRIMARY KEY ([OrganizationUnitId], [UserId]),
CONSTRAINT [FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId] FOREIGN KEY ([OrganizationUnitId]) REFERENCES [AbpOrganizationUnits] ([Id]) ON DELETE CASCADE,
CONSTRAINT [FK_AbpUserOrganizationUnits_AbpUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [AbpUsers] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpUserRoles] (
[UserId] uniqueidentifier NOT NULL,
[RoleId] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
CONSTRAINT [PK_AbpUserRoles] PRIMARY KEY ([UserId], [RoleId]),
CONSTRAINT [FK_AbpUserRoles_AbpRoles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [AbpRoles] ([Id]) ON DELETE CASCADE,
CONSTRAINT [FK_AbpUserRoles_AbpUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [AbpUsers] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpUserTokens] (
[UserId] uniqueidentifier NOT NULL,
[LoginProvider] nvarchar(64) NOT NULL,
[Name] nvarchar(128) NOT NULL,
[TenantId] uniqueidentifier NULL,
[Value] nvarchar(max) NULL,
CONSTRAINT [PK_AbpUserTokens] PRIMARY KEY ([UserId], [LoginProvider], [Name]),
CONSTRAINT [FK_AbpUserTokens_AbpUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [AbpUsers] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerApiResourceClaims] (
[Type] nvarchar(200) NOT NULL,
[ApiResourceId] uniqueidentifier NOT NULL,
CONSTRAINT [PK_IdentityServerApiResourceClaims] PRIMARY KEY ([ApiResourceId], [Type]),
CONSTRAINT [FK_IdentityServerApiResourceClaims_IdentityServerApiResources_ApiResourceId] FOREIGN KEY ([ApiResourceId]) REFERENCES [IdentityServerApiResources] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerApiResourceProperties] (
[ApiResourceId] uniqueidentifier NOT NULL,
[Key] nvarchar(250) NOT NULL,
[Value] nvarchar(2000) NOT NULL,
CONSTRAINT [PK_IdentityServerApiResourceProperties] PRIMARY KEY ([ApiResourceId], [Key], [Value]),
CONSTRAINT [FK_IdentityServerApiResourceProperties_IdentityServerApiResources_ApiResourceId] FOREIGN KEY ([ApiResourceId]) REFERENCES [IdentityServerApiResources] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerApiResourceScopes] (
[ApiResourceId] uniqueidentifier NOT NULL,
[Scope] nvarchar(200) NOT NULL,
CONSTRAINT [PK_IdentityServerApiResourceScopes] PRIMARY KEY ([ApiResourceId], [Scope]),
CONSTRAINT [FK_IdentityServerApiResourceScopes_IdentityServerApiResources_ApiResourceId] FOREIGN KEY ([ApiResourceId]) REFERENCES [IdentityServerApiResources] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerApiResourceSecrets] (
[Type] nvarchar(250) NOT NULL,
[Value] nvarchar(4000) NOT NULL,
[ApiResourceId] uniqueidentifier NOT NULL,
[Description] nvarchar(1000) NULL,
[Expiration] datetime2 NULL,
CONSTRAINT [PK_IdentityServerApiResourceSecrets] PRIMARY KEY ([ApiResourceId], [Type], [Value]),
CONSTRAINT [FK_IdentityServerApiResourceSecrets_IdentityServerApiResources_ApiResourceId] FOREIGN KEY ([ApiResourceId]) REFERENCES [IdentityServerApiResources] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerApiScopeClaims] (
[Type] nvarchar(200) NOT NULL,
[ApiScopeId] uniqueidentifier NOT NULL,
CONSTRAINT [PK_IdentityServerApiScopeClaims] PRIMARY KEY ([ApiScopeId], [Type]),
CONSTRAINT [FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiScopeId] FOREIGN KEY ([ApiScopeId]) REFERENCES [IdentityServerApiScopes] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerApiScopeProperties] (
[ApiScopeId] uniqueidentifier NOT NULL,
[Key] nvarchar(250) NOT NULL,
[Value] nvarchar(2000) NOT NULL,
CONSTRAINT [PK_IdentityServerApiScopeProperties] PRIMARY KEY ([ApiScopeId], [Key], [Value]),
CONSTRAINT [FK_IdentityServerApiScopeProperties_IdentityServerApiScopes_ApiScopeId] FOREIGN KEY ([ApiScopeId]) REFERENCES [IdentityServerApiScopes] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientClaims] (
[ClientId] uniqueidentifier NOT NULL,
[Type] nvarchar(250) NOT NULL,
[Value] nvarchar(250) NOT NULL,
CONSTRAINT [PK_IdentityServerClientClaims] PRIMARY KEY ([ClientId], [Type], [Value]),
CONSTRAINT [FK_IdentityServerClientClaims_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientCorsOrigins] (
[ClientId] uniqueidentifier NOT NULL,
[Origin] nvarchar(150) NOT NULL,
CONSTRAINT [PK_IdentityServerClientCorsOrigins] PRIMARY KEY ([ClientId], [Origin]),
CONSTRAINT [FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientGrantTypes] (
[ClientId] uniqueidentifier NOT NULL,
[GrantType] nvarchar(250) NOT NULL,
CONSTRAINT [PK_IdentityServerClientGrantTypes] PRIMARY KEY ([ClientId], [GrantType]),
CONSTRAINT [FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientIdPRestrictions] (
[ClientId] uniqueidentifier NOT NULL,
[Provider] nvarchar(200) NOT NULL,
CONSTRAINT [PK_IdentityServerClientIdPRestrictions] PRIMARY KEY ([ClientId], [Provider]),
CONSTRAINT [FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientPostLogoutRedirectUris] (
[ClientId] uniqueidentifier NOT NULL,
[PostLogoutRedirectUri] nvarchar(2000) NOT NULL,
CONSTRAINT [PK_IdentityServerClientPostLogoutRedirectUris] PRIMARY KEY ([ClientId], [PostLogoutRedirectUri]),
CONSTRAINT [FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientProperties] (
[ClientId] uniqueidentifier NOT NULL,
[Key] nvarchar(250) NOT NULL,
[Value] nvarchar(2000) NOT NULL,
CONSTRAINT [PK_IdentityServerClientProperties] PRIMARY KEY ([ClientId], [Key], [Value]),
CONSTRAINT [FK_IdentityServerClientProperties_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientRedirectUris] (
[ClientId] uniqueidentifier NOT NULL,
[RedirectUri] nvarchar(2000) NOT NULL,
CONSTRAINT [PK_IdentityServerClientRedirectUris] PRIMARY KEY ([ClientId], [RedirectUri]),
CONSTRAINT [FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientScopes] (
[ClientId] uniqueidentifier NOT NULL,
[Scope] nvarchar(200) NOT NULL,
CONSTRAINT [PK_IdentityServerClientScopes] PRIMARY KEY ([ClientId], [Scope]),
CONSTRAINT [FK_IdentityServerClientScopes_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerClientSecrets] (
[Type] nvarchar(250) NOT NULL,
[Value] nvarchar(4000) NOT NULL,
[ClientId] uniqueidentifier NOT NULL,
[Description] nvarchar(2000) NULL,
[Expiration] datetime2 NULL,
CONSTRAINT [PK_IdentityServerClientSecrets] PRIMARY KEY ([ClientId], [Type], [Value]),
CONSTRAINT [FK_IdentityServerClientSecrets_IdentityServerClients_ClientId] FOREIGN KEY ([ClientId]) REFERENCES [IdentityServerClients] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerIdentityResourceClaims] (
[Type] nvarchar(200) NOT NULL,
[IdentityResourceId] uniqueidentifier NOT NULL,
CONSTRAINT [PK_IdentityServerIdentityResourceClaims] PRIMARY KEY ([IdentityResourceId], [Type]),
CONSTRAINT [FK_IdentityServerIdentityResourceClaims_IdentityServerIdentityResources_IdentityResourceId] FOREIGN KEY ([IdentityResourceId]) REFERENCES [IdentityServerIdentityResources] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [IdentityServerIdentityResourceProperties] (
[IdentityResourceId] uniqueidentifier NOT NULL,
[Key] nvarchar(250) NOT NULL,
[Value] nvarchar(2000) NOT NULL,
CONSTRAINT [PK_IdentityServerIdentityResourceProperties] PRIMARY KEY ([IdentityResourceId], [Key], [Value]),
CONSTRAINT [FK_IdentityServerIdentityResourceProperties_IdentityServerIdentityResources_IdentityResourceId] FOREIGN KEY ([IdentityResourceId]) REFERENCES [IdentityServerIdentityResources] ([Id]) ON DELETE CASCADE
);
GO
CREATE TABLE [AbpEntityPropertyChanges] (
[Id] uniqueidentifier NOT NULL,
[TenantId] uniqueidentifier NULL,
[EntityChangeId] uniqueidentifier NOT NULL,
[NewValue] nvarchar(512) NULL,
[OriginalValue] nvarchar(512) NULL,
[PropertyName] nvarchar(128) NOT NULL,
[PropertyTypeFullName] nvarchar(64) NOT NULL,
CONSTRAINT [PK_AbpEntityPropertyChanges] PRIMARY KEY ([Id]),
CONSTRAINT [FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId] FOREIGN KEY ([EntityChangeId]) REFERENCES [AbpEntityChanges] ([Id]) ON DELETE CASCADE
);
GO
CREATE INDEX [IX_AbpAuditLogActions_AuditLogId] ON [AbpAuditLogActions] ([AuditLogId]);
GO
CREATE INDEX [IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime] ON [AbpAuditLogActions] ([TenantId], [ServiceName], [MethodName], [ExecutionTime]);
GO
CREATE INDEX [IX_AbpAuditLogs_TenantId_ExecutionTime] ON [AbpAuditLogs] ([TenantId], [ExecutionTime]);
GO
CREATE INDEX [IX_AbpAuditLogs_TenantId_UserId_ExecutionTime] ON [AbpAuditLogs] ([TenantId], [UserId], [ExecutionTime]);
GO
CREATE INDEX [IX_AbpBackgroundJobs_IsAbandoned_NextTryTime] ON [AbpBackgroundJobs] ([IsAbandoned], [NextTryTime]);
GO
CREATE INDEX [IX_AbpEntityChanges_AuditLogId] ON [AbpEntityChanges] ([AuditLogId]);
GO
CREATE INDEX [IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId] ON [AbpEntityChanges] ([TenantId], [EntityTypeFullName], [EntityId]);
GO
CREATE INDEX [IX_AbpEntityPropertyChanges_EntityChangeId] ON [AbpEntityPropertyChanges] ([EntityChangeId]);
GO
CREATE UNIQUE INDEX [IX_AbpFeatureValues_Name_ProviderName_ProviderKey] ON [AbpFeatureValues] ([Name], [ProviderName], [ProviderKey]) WHERE [ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL;
GO
CREATE UNIQUE INDEX [IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId] ON [AbpLinkUsers] ([SourceUserId], [SourceTenantId], [TargetUserId], [TargetTenantId]) WHERE [SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL;
GO
CREATE INDEX [IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId] ON [AbpOrganizationUnitRoles] ([RoleId], [OrganizationUnitId]);
GO
CREATE INDEX [IX_AbpOrganizationUnits_Code] ON [AbpOrganizationUnits] ([Code]);
GO
CREATE INDEX [IX_AbpOrganizationUnits_ParentId] ON [AbpOrganizationUnits] ([ParentId]);
GO
CREATE UNIQUE INDEX [IX_AbpPermissionGrants_TenantId_Name_ProviderName_ProviderKey] ON [AbpPermissionGrants] ([TenantId], [Name], [ProviderName], [ProviderKey]) WHERE [TenantId] IS NOT NULL;
GO
CREATE INDEX [IX_AbpRoleClaims_RoleId] ON [AbpRoleClaims] ([RoleId]);
GO
CREATE INDEX [IX_AbpRoles_NormalizedName] ON [AbpRoles] ([NormalizedName]);
GO
CREATE INDEX [IX_AbpSecurityLogs_TenantId_Action] ON [AbpSecurityLogs] ([TenantId], [Action]);
GO
CREATE INDEX [IX_AbpSecurityLogs_TenantId_ApplicationName] ON [AbpSecurityLogs] ([TenantId], [ApplicationName]);
GO
CREATE INDEX [IX_AbpSecurityLogs_TenantId_Identity] ON [AbpSecurityLogs] ([TenantId], [Identity]);
GO
CREATE INDEX [IX_AbpSecurityLogs_TenantId_UserId] ON [AbpSecurityLogs] ([TenantId], [UserId]);
GO
CREATE UNIQUE INDEX [IX_AbpSettings_Name_ProviderName_ProviderKey] ON [AbpSettings] ([Name], [ProviderName], [ProviderKey]) WHERE [ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL;
GO
CREATE INDEX [IX_AbpTenants_Name] ON [AbpTenants] ([Name]);
GO
CREATE INDEX [IX_AbpUserClaims_UserId] ON [AbpUserClaims] ([UserId]);
GO
CREATE INDEX [IX_AbpUserLogins_LoginProvider_ProviderKey] ON [AbpUserLogins] ([LoginProvider], [ProviderKey]);
GO
CREATE INDEX [IX_AbpUserOrganizationUnits_UserId_OrganizationUnitId] ON [AbpUserOrganizationUnits] ([UserId], [OrganizationUnitId]);
GO
CREATE INDEX [IX_AbpUserRoles_RoleId_UserId] ON [AbpUserRoles] ([RoleId], [UserId]);
GO
CREATE INDEX [IX_AbpUsers_Email] ON [AbpUsers] ([Email]);
GO
CREATE INDEX [IX_AbpUsers_NormalizedEmail] ON [AbpUsers] ([NormalizedEmail]);
GO
CREATE INDEX [IX_AbpUsers_NormalizedUserName] ON [AbpUsers] ([NormalizedUserName]);
GO
CREATE INDEX [IX_AbpUsers_UserName] ON [AbpUsers] ([UserName]);
GO
CREATE UNIQUE INDEX [IX_Auth_Department_Code] ON [Auth_Department] ([Code]);
GO
CREATE UNIQUE INDEX [IX_Auth_Menu_Code] ON [Auth_Menu] ([Code]);
GO
CREATE UNIQUE INDEX [IX_Auth_UserMenu_UserId_MenuCode] ON [Auth_UserMenu] ([UserId], [MenuCode]);
GO
CREATE UNIQUE INDEX [IX_Auth_UserWorkGroup_WorkGroupCode_UserId] ON [Auth_UserWorkGroup] ([WorkGroupCode], [UserId]);
GO
CREATE INDEX [IX_IdentityServerClients_ClientId] ON [IdentityServerClients] ([ClientId]);
GO
CREATE UNIQUE INDEX [IX_IdentityServerDeviceFlowCodes_DeviceCode] ON [IdentityServerDeviceFlowCodes] ([DeviceCode]);
GO
CREATE INDEX [IX_IdentityServerDeviceFlowCodes_Expiration] ON [IdentityServerDeviceFlowCodes] ([Expiration]);
GO
CREATE INDEX [IX_IdentityServerDeviceFlowCodes_UserCode] ON [IdentityServerDeviceFlowCodes] ([UserCode]);
GO
CREATE INDEX [IX_IdentityServerPersistedGrants_Expiration] ON [IdentityServerPersistedGrants] ([Expiration]);
GO
CREATE INDEX [IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type] ON [IdentityServerPersistedGrants] ([SubjectId], [ClientId], [Type]);
GO
CREATE INDEX [IX_IdentityServerPersistedGrants_SubjectId_SessionId_Type] ON [IdentityServerPersistedGrants] ([SubjectId], [SessionId], [Type]);
GO

1159
be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.BasedataDbContext.sql

File diff suppressed because it is too large

6037
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql

File diff suppressed because it is too large

16
be/Modules/Shared/src/Win_in.Sfs.Shared.Host/ModuleBase.cs

@ -3,6 +3,7 @@ using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
@ -81,6 +82,7 @@ public abstract class ModuleBase<T> : AbpModule where T : AbpModule
// Console.WriteLine($"生产模式不执行数据库初始化");
// return;
//}
var contextName = typeof(TEfCoreDbContext).Name;
using var scope = context.ServiceProvider.CreateScope();
var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
@ -99,28 +101,28 @@ public abstract class ModuleBase<T> : AbpModule where T : AbpModule
if (!dbCreator.Exists())
{
dbCreator.Create();
var createSql = "CREATE TABLE `EFDbContext`(`Id` varchar(255) NOT NULL,`Hash` varchar(255) NOT NULL,PRIMARY KEY (`Id`));";
var createSql = "CREATE TABLE EFDbContext(Id varchar(255) NOT NULL,Hash varchar(255) NOT NULL,PRIMARY KEY (Id));";
dbContext.Database.ExecuteSqlRaw(createSql);
}
// 查询当前DbContext是否已经初始化
using var conn = dbContext.Database.GetDbConnection();
var cmd = conn.CreateCommand();
conn.Open();
cmd.CommandText = $"SELECT `Hash` FROM EFDbContext where `Id`='{contextName}'";
cmd.CommandText = $"SELECT Hash FROM EFDbContext where Id='{contextName}'";
var hash = cmd.ExecuteScalar();
conn.Close();
//conn.Close();
//conn.Dispose();
if (hash == null)
{
try
{
//dbContext.Database.BeginTransaction();
dbContext.Database.ExecuteSqlRaw(sql);
dbContext.Database.ExecuteSqlRaw(Regex.Replace(sql, ";\\s+GO\\s", " "));
context.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync()
.Wait();
dbContext.Database.ExecuteSqlRaw($"INSERT INTO `EFDbContext` VALUES ('{contextName}', '{md5}');");
dbContext.Database.ExecuteSqlRaw($"INSERT INTO EFDbContext VALUES ('{contextName}', '{md5}');");
//dbContext.Database.CommitTransaction();
Console.WriteLine($"{contextName} 初始化成功");
}
@ -139,6 +141,8 @@ public abstract class ModuleBase<T> : AbpModule where T : AbpModule
Console.WriteLine($"{contextName} 数据库结构{(hash.ToString() == md5 ? "" : "")}");
}
uow.CompleteAsync();
conn.Close();
conn.Dispose();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

20
build/src/docker/publish/settings/appsettings.Development.json

@ -73,6 +73,26 @@
"Message": "Server=localhost;Port=21196;Database=Wms;Uid=root;Pwd=aA123456!;",
"Store": "Server=localhost;Port=21196;Database=Wms;Uid=root;Pwd=aA123456!;"
},
// "ConnectionStrings": {
// "AbpAuditLogging": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "AbpBackgroundJobs": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "AbpBlobStoring": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "AbpFeatureManagement": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "AbpIdentity": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "AbpIdentityServer": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "AbpPermissionManagement": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "AbpSettingManagement": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "AbpTenantManagement": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "Auth": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "Basedata": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "DataExchange": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "FileStorage": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "Inventory": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "Job": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "Label": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "Message": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;",
// "Store": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=600;"
// },
"IdentityClients": {
"Default": {
"Authority": "http://dev.ccwin-in.com:59093",

Loading…
Cancel
Save