From 54a8a2956a557d8d1fd299c3b586f541336103ed Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Tue, 4 Aug 2020 16:59:38 +0800 Subject: [PATCH] separate backend management and IDS server database migration files --- .../AuthServerHostMigrationsDbContext.cs | 25 +++ ...uthServerHostMigrationsDbContextFactory.cs | 29 +++ ...Migration-IdentityServer-MySql.Designer.cs | 6 +- ...13010936_Migration-IdentityServer-MySql.cs | 2 +- ...200606012143_Upgrade-Abp-2.9.0.Designer.cs | 6 +- .../20200606012143_Upgrade-Abp-2.9.0.cs | 2 +- ...yServerMigrationsDbContextModelSnapshot.cs | 6 +- .../BackendAdminHostMigrationsDbContext.cs | 11 +- ...kendAdminHostMigrationsDbContextFactory.cs | 2 +- ..._Migration-Backend-Admin-MySql.Designer.cs | 175 ++++++++++++++++++ ...804085641_Migration-Backend-Admin-MySql.cs | 111 +++++++++++ ...minHostMigrationsDbContextModelSnapshot.cs | 173 +++++++++++++++++ 12 files changed, 528 insertions(+), 20 deletions(-) create mode 100644 aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/AuthServerHostMigrationsDbContext.cs create mode 100644 aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/AuthServerHostMigrationsDbContextFactory.cs rename aspnet-core/services/{admin/LINGYUN.BackendAdminApp.Host => account/AuthServer.Host}/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs (99%) rename aspnet-core/services/{admin/LINGYUN.BackendAdminApp.Host => account/AuthServer.Host}/Migrations/20200513010936_Migration-IdentityServer-MySql.cs (99%) rename aspnet-core/services/{admin/LINGYUN.BackendAdminApp.Host => account/AuthServer.Host}/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs (99%) rename aspnet-core/services/{admin/LINGYUN.BackendAdminApp.Host => account/AuthServer.Host}/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs (99%) rename aspnet-core/services/{admin/LINGYUN.BackendAdminApp.Host => account/AuthServer.Host}/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs (99%) create mode 100644 aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200804085641_Migration-Backend-Admin-MySql.Designer.cs create mode 100644 aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200804085641_Migration-Backend-Admin-MySql.cs create mode 100644 aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/BackendAdminHostMigrationsDbContextModelSnapshot.cs diff --git a/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/AuthServerHostMigrationsDbContext.cs b/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/AuthServerHostMigrationsDbContext.cs new file mode 100644 index 000000000..8e847e254 --- /dev/null +++ b/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/AuthServerHostMigrationsDbContext.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Identity.EntityFrameworkCore; +using Volo.Abp.IdentityServer.EntityFrameworkCore; + +namespace AuthServer.EntityFrameworkCore +{ + public class AuthServerHostMigrationsDbContext : AbpDbContext + { + public AuthServerHostMigrationsDbContext(DbContextOptions options) + : base(options) + { + + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.UseMySQL(); + modelBuilder.ConfigureIdentity(); + modelBuilder.ConfigureIdentityServer(); + } + } +} diff --git a/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/AuthServerHostMigrationsDbContextFactory.cs b/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/AuthServerHostMigrationsDbContextFactory.cs new file mode 100644 index 000000000..4cdfd2a73 --- /dev/null +++ b/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/AuthServerHostMigrationsDbContextFactory.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; +using Microsoft.Extensions.Configuration; +using System.IO; + +namespace AuthServer.EntityFrameworkCore +{ + public class AuthServerHostMigrationsDbContextFactory : IDesignTimeDbContextFactory + { + public AuthServerHostMigrationsDbContext CreateDbContext(string[] args) + { + var configuration = BuildConfiguration(); + + var builder = new DbContextOptionsBuilder() + .UseMySql(configuration.GetConnectionString("Default")); + + return new AuthServerHostMigrationsDbContext(builder.Options); + } + + private static IConfigurationRoot BuildConfiguration() + { + var builder = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.Development.json", optional: false); + + return builder.Build(); + } + } +} diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs b/aspnet-core/services/account/AuthServer.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs similarity index 99% rename from aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs rename to aspnet-core/services/account/AuthServer.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs index f536b10eb..0929a57fc 100644 --- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs +++ b/aspnet-core/services/account/AuthServer.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs @@ -1,13 +1,13 @@ // -using LINGYUN.BackendAdmin.EntityFrameworkCore; +using AuthServer.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using System; -namespace LINGYUN.BackendAdmin.Migrations +namespace AuthServer.Migrations { - [DbContext(typeof(BackendAdminHostMigrationsDbContext))] + [DbContext(typeof(AuthServerHostMigrationsDbContext))] [Migration("20200513010936_Migration-IdentityServer-MySql")] partial class MigrationIdentityServerMySql { diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs b/aspnet-core/services/account/AuthServer.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs similarity index 99% rename from aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs rename to aspnet-core/services/account/AuthServer.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs index 019c84d44..88f4b49d2 100644 --- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs +++ b/aspnet-core/services/account/AuthServer.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs @@ -1,7 +1,7 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -namespace LINGYUN.BackendAdmin.Migrations +namespace AuthServer.Migrations { public partial class MigrationIdentityServerMySql : Migration { diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs b/aspnet-core/services/account/AuthServer.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs similarity index 99% rename from aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs rename to aspnet-core/services/account/AuthServer.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs index 15cf5f348..789111884 100644 --- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs +++ b/aspnet-core/services/account/AuthServer.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs @@ -1,15 +1,15 @@ // using System; -using LINGYUN.BackendAdmin.EntityFrameworkCore; +using AuthServer.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Volo.Abp.EntityFrameworkCore; -namespace LINGYUN.BackendAdmin.Migrations +namespace AuthServer.Migrations { - [DbContext(typeof(BackendAdminHostMigrationsDbContext))] + [DbContext(typeof(AuthServerHostMigrationsDbContext))] [Migration("20200606012143_Upgrade-Abp-3.0.0")] partial class UpgradeAbp290 { diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs b/aspnet-core/services/account/AuthServer.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs similarity index 99% rename from aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs rename to aspnet-core/services/account/AuthServer.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs index c191065ff..4ca13f3e6 100644 --- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs +++ b/aspnet-core/services/account/AuthServer.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs @@ -1,7 +1,7 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -namespace LINGYUN.BackendAdmin.Migrations +namespace AuthServer.Migrations { public partial class UpgradeAbp290 : Migration { diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/account/AuthServer.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs similarity index 99% rename from aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs rename to aspnet-core/services/account/AuthServer.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs index 9f5eb42a1..515bdd87f 100644 --- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/account/AuthServer.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs @@ -1,14 +1,14 @@ // using System; -using LINGYUN.BackendAdmin.EntityFrameworkCore; +using AuthServer.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Volo.Abp.EntityFrameworkCore; -namespace LINGYUN.BackendAdmin.Migrations +namespace AuthServer.Migrations { - [DbContext(typeof(BackendAdminHostMigrationsDbContext))] + [DbContext(typeof(AuthServerHostMigrationsDbContext))] partial class IdentityServerMigrationsDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContext.cs b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContext.cs index 752ae063b..892dd7d79 100644 --- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContext.cs +++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContext.cs @@ -1,7 +1,5 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.Identity.EntityFrameworkCore; -using Volo.Abp.IdentityServer.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.TenantManagement.EntityFrameworkCore; @@ -20,12 +18,9 @@ namespace LINGYUN.BackendAdmin.EntityFrameworkCore { base.OnModelCreating(modelBuilder); - modelBuilder.UseMySQL(); - modelBuilder.ConfigureIdentity(); - modelBuilder.ConfigureIdentityServer(); - //modelBuilder.ConfigureTenantManagement(); - //modelBuilder.ConfigureSettingManagement(); - //modelBuilder.ConfigurePermissionManagement(); + modelBuilder.ConfigureTenantManagement(); + modelBuilder.ConfigureSettingManagement(); + modelBuilder.ConfigurePermissionManagement(); } } } diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContextFactory.cs b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContextFactory.cs index d342b5fa0..501c113eb 100644 --- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContextFactory.cs +++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContextFactory.cs @@ -12,7 +12,7 @@ namespace LINGYUN.BackendAdmin.EntityFrameworkCore var configuration = BuildConfiguration(); var builder = new DbContextOptionsBuilder() - .UseMySql(configuration.GetConnectionString("AbpIdentityServer")); + .UseMySql(configuration.GetConnectionString("Default")); return new BackendAdminHostMigrationsDbContext(builder.Options); } diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200804085641_Migration-Backend-Admin-MySql.Designer.cs b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200804085641_Migration-Backend-Admin-MySql.Designer.cs new file mode 100644 index 000000000..5e082a8df --- /dev/null +++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200804085641_Migration-Backend-Admin-MySql.Designer.cs @@ -0,0 +1,175 @@ +// +using System; +using LINGYUN.BackendAdmin.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.BackendAdmin.Migrations +{ + [DbContext(typeof(BackendAdminHostMigrationsDbContext))] + [Migration("20200804085641_Migration-Backend-Admin-MySql")] + partial class MigrationBackendAdminMySql + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200804085641_Migration-Backend-Admin-MySql.cs b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200804085641_Migration-Backend-Admin-MySql.cs new file mode 100644 index 000000000..e8afce6ef --- /dev/null +++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200804085641_Migration-Backend-Admin-MySql.cs @@ -0,0 +1,111 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.BackendAdmin.Migrations +{ + public partial class MigrationBackendAdminMySql : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AbpPermissionGrants", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 128, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: false), + ProviderKey = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpSettings", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(maxLength: 2048, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: true), + ProviderKey = table.Column(maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSettings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpTenants", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Name = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpTenantConnectionStrings", + columns: table => new + { + TenantId = table.Column(nullable: false), + Name = table.Column(maxLength: 64, nullable: false), + Value = table.Column(maxLength: 1024, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); + table.ForeignKey( + name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", + column: x => x.TenantId, + principalTable: "AbpTenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + table: "AbpPermissionGrants", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSettings_Name_ProviderName_ProviderKey", + table: "AbpSettings", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpTenants_Name", + table: "AbpTenants", + column: "Name"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpPermissionGrants"); + + migrationBuilder.DropTable( + name: "AbpSettings"); + + migrationBuilder.DropTable( + name: "AbpTenantConnectionStrings"); + + migrationBuilder.DropTable( + name: "AbpTenants"); + } + } +} diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/BackendAdminHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/BackendAdminHostMigrationsDbContextModelSnapshot.cs new file mode 100644 index 000000000..280e1aaee --- /dev/null +++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/BackendAdminHostMigrationsDbContextModelSnapshot.cs @@ -0,0 +1,173 @@ +// +using System; +using LINGYUN.BackendAdmin.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.BackendAdmin.Migrations +{ + [DbContext(typeof(BackendAdminHostMigrationsDbContext))] + partial class BackendAdminHostMigrationsDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +}