Prechádzať zdrojové kódy

2020/05/29 Jessica
Actions : Modify UploadFile schema

Jessica.Tseng 4 rokov pred
rodič
commit
9081625c87

+ 7 - 0
EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj

@@ -182,6 +182,10 @@
     <Compile Include="MainDBContextMigrations\202005250837509_Modify_UpdateFirmwareLogic.Designer.cs">
       <DependentUpon>202005250837509_Modify_UpdateFirmwareLogic.cs</DependentUpon>
     </Compile>
+    <Compile Include="MainDBContextMigrations\202005290620325_Modified_UploadFileId.cs" />
+    <Compile Include="MainDBContextMigrations\202005290620325_Modified_UploadFileId.Designer.cs">
+      <DependentUpon>202005290620325_Modified_UploadFileId.cs</DependentUpon>
+    </Compile>
     <Compile Include="MainDBContextMigrations\Configuration.cs" />
     <Compile Include="MeterValueDBContext.cs" />
     <Compile Include="MeterValueDBContextMigrations\201907150814558_Init.cs" />
@@ -324,6 +328,9 @@
     <EmbeddedResource Include="MainDBContextMigrations\202005250837509_Modify_UpdateFirmwareLogic.resx">
       <DependentUpon>202005250837509_Modify_UpdateFirmwareLogic.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="MainDBContextMigrations\202005290620325_Modified_UploadFileId.resx">
+      <DependentUpon>202005290620325_Modified_UploadFileId.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="MeterValueDBContextMigrations\201907150814558_Init.resx">
       <DependentUpon>201907150814558_Init.cs</DependentUpon>
     </EmbeddedResource>

+ 29 - 0
EVCB_OCPP.Domain/MainDBContextMigrations/202005290620325_Modified_UploadFileId.Designer.cs

@@ -0,0 +1,29 @@
+// <auto-generated />
+namespace EVCB_OCPP.Domain.MainDBContextMigrations
+{
+    using System.CodeDom.Compiler;
+    using System.Data.Entity.Migrations;
+    using System.Data.Entity.Migrations.Infrastructure;
+    using System.Resources;
+    
+    [GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
+    public sealed partial class Modified_UploadFileId : IMigrationMetadata
+    {
+        private readonly ResourceManager Resources = new ResourceManager(typeof(Modified_UploadFileId));
+        
+        string IMigrationMetadata.Id
+        {
+            get { return "202005290620325_Modified_UploadFileId"; }
+        }
+        
+        string IMigrationMetadata.Source
+        {
+            get { return null; }
+        }
+        
+        string IMigrationMetadata.Target
+        {
+            get { return Resources.GetString("Target"); }
+        }
+    }
+}

+ 36 - 0
EVCB_OCPP.Domain/MainDBContextMigrations/202005290620325_Modified_UploadFileId.cs

@@ -0,0 +1,36 @@
+namespace EVCB_OCPP.Domain.MainDBContextMigrations
+{
+    using System;
+    using System.Data.Entity.Migrations;
+    
+    public partial class Modified_UploadFileId : DbMigration
+    {
+        public override void Up()
+        {
+            DropForeignKey("dbo.MachineVersionFile", "UploadFileId", "dbo.UploadFile");
+            DropIndex("dbo.MachineVersionFile", new[] { "UploadFileId" });
+            DropPrimaryKey("dbo.UploadFile");
+            AlterColumn("dbo.MachineVersionFile", "UploadFileId", c => c.String(nullable: false, maxLength: 36));
+            AlterColumn("dbo.UploadFile", "Id", c => c.String(nullable: false, maxLength: 36));
+            AlterColumn("dbo.UploadFile", "VendorId", c => c.String(nullable: false, maxLength: 50));
+            AlterColumn("dbo.UploadFile", "ModelName", c => c.String(nullable: false, maxLength: 50));
+            AddPrimaryKey("dbo.UploadFile", "Id");
+            CreateIndex("dbo.MachineVersionFile", "UploadFileId");
+            AddForeignKey("dbo.MachineVersionFile", "UploadFileId", "dbo.UploadFile", "Id", cascadeDelete: true);
+        }
+        
+        public override void Down()
+        {
+            DropForeignKey("dbo.MachineVersionFile", "UploadFileId", "dbo.UploadFile");
+            DropIndex("dbo.MachineVersionFile", new[] { "UploadFileId" });
+            DropPrimaryKey("dbo.UploadFile");
+            AlterColumn("dbo.UploadFile", "ModelName", c => c.String(maxLength: 50));
+            AlterColumn("dbo.UploadFile", "VendorId", c => c.String(maxLength: 50));
+            AlterColumn("dbo.UploadFile", "Id", c => c.Guid(nullable: false));
+            AlterColumn("dbo.MachineVersionFile", "UploadFileId", c => c.Guid(nullable: false));
+            AddPrimaryKey("dbo.UploadFile", "Id");
+            CreateIndex("dbo.MachineVersionFile", "UploadFileId");
+            AddForeignKey("dbo.MachineVersionFile", "UploadFileId", "dbo.UploadFile", "Id", cascadeDelete: true);
+        }
+    }
+}

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 120 - 0
EVCB_OCPP.Domain/MainDBContextMigrations/202005290620325_Modified_UploadFileId.resx


+ 1 - 1
EVCB_OCPP.Domain/Models/Database/MachineVersionFile.cs

@@ -28,7 +28,7 @@
         public Guid MachineId { get; set; }
 
         [Required]
-        public Guid UploadFileId { get; set; }
+        public string UploadFileId { get; set; }
 
         /// <summary>
         /// 下載日期

+ 9 - 8
EVCB_OCPP.Domain/Models/Database/UploadFile.cs

@@ -13,12 +13,12 @@
     {
         public UploadFile()
         {
-            Id = Guid.NewGuid();
+            Id = Guid.NewGuid().ToString();
         }
 
         //[Index(IsClustered = false)]
-        [Key]
-        public Guid Id { get; set; }
+        [StringLength(36)]
+        public string Id { get; set; }
 
         /// <summary>
         /// 檔名
@@ -31,8 +31,7 @@
         /// 原始檔名
         /// </summary>
         [Required]
-        [StringLength(500)]
-       
+        [StringLength(500)]       
         public string OriginName { get; set; }
 
        
@@ -41,8 +40,7 @@
         /// <summary>
         /// 檔案類型
         /// </summary>
-        [StringLength(200)]
-     
+        [StringLength(200)]     
         public string FileType { get; set; }
 
         /// <summary>
@@ -90,6 +88,7 @@
         /// VendorId
         /// </summary>
         [StringLength(50)]
+        [Required]
         public string VendorId { get; set; }
 
 
@@ -97,11 +96,13 @@
         /// ModelName
         /// </summary>
         [StringLength(50)]
+        [Required]
         public string ModelName { get; set; }
 
         /// <summary>
         /// ModuleId
-        /// </summary>      
+        /// </summary>  
+        [Required]
         public int ModuleId { get; set; }
 
 

+ 1 - 1
EVCB_OCPP.Domain/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
 
-[assembly: AssemblyInformationalVersion("b2bb0b6")]
+[assembly: AssemblyInformationalVersion("3ff61e2")]

+ 1 - 1
EVCB_OCPP.MailService/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
 
-[assembly: AssemblyInformationalVersion("b2bb0b6")]
+[assembly: AssemblyInformationalVersion("3ff61e2")]

+ 1 - 1
EVCB_OCPP.Packet/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
 
-[assembly: AssemblyInformationalVersion("b2bb0b6")]
+[assembly: AssemblyInformationalVersion("3ff61e2")]

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov