Browse Source

ReMigrate for seed data

HOME 2 years ago
parent
commit
9075ba640e

+ 7 - 2
VCommonCoreExample/Migrations/20210718094943_CreateDatabase.Designer.cs

@@ -9,7 +9,7 @@ using VCommonCoreExample.EntityFrameworkCore;
 namespace VCommonCoreExample.Migrations
 {
     [DbContext(typeof(ExampleDbContext))]
-    [Migration("20210718094943_CreateDatabase")]
+    [Migration("20210724080721_CreateDatabase")]
     partial class CreateDatabase
     {
         protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -184,15 +184,19 @@ namespace VCommonCoreExample.Migrations
                         .HasColumnType("char(36)");
 
                     b.Property<string>("LoginName")
+                        .IsRequired()
                         .HasColumnType("varchar(255)");
 
                     b.Property<string>("Name")
+                        .IsRequired()
                         .HasColumnType("longtext");
 
                     b.Property<string>("Password")
+                        .IsRequired()
                         .HasColumnType("longtext");
 
                     b.Property<string>("Roles")
+                        .IsRequired()
                         .HasColumnType("longtext");
 
                     b.Property<Guid?>("TenantId")
@@ -218,7 +222,8 @@ namespace VCommonCoreExample.Migrations
                             IsStaticUser = true,
                             LoginName = "admin",
                             Name = "admin",
-                            Password = "AIk0zKJKWH+8N9+hHWFFZ5U26GVyNG0V+9vNUDmuX6P6XnWeQXhd3cTV0jcM/DIi8A=="
+                            Password = "AIk0zKJKWH+8N9+hHWFFZ5U26GVyNG0V+9vNUDmuX6P6XnWeQXhd3cTV0jcM/DIi8A==",
+                            Roles = "[]"
                         });
                 });
 

+ 5 - 5
VCommonCoreExample/Migrations/20210718094943_CreateDatabase.cs

@@ -116,13 +116,13 @@ namespace VCommonCoreExample.Migrations
                 {
                     Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                     TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
-                    Roles = table.Column<string>(type: "longtext", nullable: true)
+                    Roles = table.Column<string>(type: "longtext", nullable: false)
                         .Annotation("MySql:CharSet", "utf8mb4"),
-                    Name = table.Column<string>(type: "longtext", nullable: true)
+                    Name = table.Column<string>(type: "longtext", nullable: false)
                         .Annotation("MySql:CharSet", "utf8mb4"),
-                    LoginName = table.Column<string>(type: "varchar(255)", nullable: true)
+                    LoginName = table.Column<string>(type: "varchar(255)", nullable: false)
                         .Annotation("MySql:CharSet", "utf8mb4"),
-                    Password = table.Column<string>(type: "longtext", nullable: true)
+                    Password = table.Column<string>(type: "longtext", nullable: false)
                         .Annotation("MySql:CharSet", "utf8mb4"),
                     IsStaticUser = table.Column<bool>(type: "tinyint(1)", nullable: false),
                     IsEnable = table.Column<bool>(type: "tinyint(1)", nullable: false),
@@ -141,7 +141,7 @@ namespace VCommonCoreExample.Migrations
             migrationBuilder.InsertData(
                 table: "Users",
                 columns: new[] { "Id", "CreationTime", "CreationUserId", "IsAbolish", "IsEnable", "IsStaticUser", "LastModificationTime", "LastModificationUserId", "LoginName", "Name", "Password", "Roles", "TenantId" },
-                values: new object[] { new Guid("00000001-0002-0003-0405-060708090a0b"), new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new Guid("00000000-0000-0000-0000-000000000000"), false, true, true, null, null, "admin", "admin", "AIk0zKJKWH+8N9+hHWFFZ5U26GVyNG0V+9vNUDmuX6P6XnWeQXhd3cTV0jcM/DIi8A==", null, null });
+                values: new object[] { new Guid("00000001-0002-0003-0405-060708090a0b"), new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new Guid("00000000-0000-0000-0000-000000000000"), false, true, true, null, null, "admin", "admin", "AIk0zKJKWH+8N9+hHWFFZ5U26GVyNG0V+9vNUDmuX6P6XnWeQXhd3cTV0jcM/DIi8A==", "[]", null });
 
             migrationBuilder.CreateIndex(
                 name: "IX_Roles_TenantId",

+ 6 - 1
VCommonCoreExample/Migrations/ExampleDbContextModelSnapshot.cs

@@ -182,15 +182,19 @@ namespace VCommonCoreExample.Migrations
                         .HasColumnType("char(36)");
 
                     b.Property<string>("LoginName")
+                        .IsRequired()
                         .HasColumnType("varchar(255)");
 
                     b.Property<string>("Name")
+                        .IsRequired()
                         .HasColumnType("longtext");
 
                     b.Property<string>("Password")
+                        .IsRequired()
                         .HasColumnType("longtext");
 
                     b.Property<string>("Roles")
+                        .IsRequired()
                         .HasColumnType("longtext");
 
                     b.Property<Guid?>("TenantId")
@@ -216,7 +220,8 @@ namespace VCommonCoreExample.Migrations
                             IsStaticUser = true,
                             LoginName = "admin",
                             Name = "admin",
-                            Password = "AIk0zKJKWH+8N9+hHWFFZ5U26GVyNG0V+9vNUDmuX6P6XnWeQXhd3cTV0jcM/DIi8A=="
+                            Password = "AIk0zKJKWH+8N9+hHWFFZ5U26GVyNG0V+9vNUDmuX6P6XnWeQXhd3cTV0jcM/DIi8A==",
+                            Roles = "[]"
                         });
                 });