mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Use license table in machine photos.
This commit is contained in:
5404
Cicm.Database/Migrations/20190527165154_UseLicenseInMachinePhoto.Designer.cs
generated
Normal file
5404
Cicm.Database/Migrations/20190527165154_UseLicenseInMachinePhoto.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class UseLicenseInMachinePhoto : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex("IX_MachinePhotos_License", "MachinePhotos");
|
||||
|
||||
migrationBuilder.DropColumn("License", "MachinePhotos");
|
||||
|
||||
migrationBuilder.AddColumn<int>("LicenseId", "MachinePhotos", nullable: false, defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MachinePhotos_LicenseId", "MachinePhotos", "LicenseId");
|
||||
|
||||
migrationBuilder.AddForeignKey("FK_MachinePhotos_Licenses_LicenseId", "MachinePhotos", "LicenseId",
|
||||
"Licenses", principalColumn: "Id", onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey("FK_MachinePhotos_Licenses_LicenseId", "MachinePhotos");
|
||||
|
||||
migrationBuilder.DropIndex("IX_MachinePhotos_LicenseId", "MachinePhotos");
|
||||
|
||||
migrationBuilder.DropColumn("LicenseId", "MachinePhotos");
|
||||
|
||||
migrationBuilder.AddColumn<string>("License", "MachinePhotos", nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MachinePhotos_License", "MachinePhotos", "License");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3750,7 +3750,7 @@ namespace Cicm.Database.Migrations
|
||||
|
||||
b.Property<string>("Lens");
|
||||
|
||||
b.Property<string>("License");
|
||||
b.Property<int>("LicenseId");
|
||||
|
||||
b.Property<string>("LightSource");
|
||||
|
||||
@@ -3824,7 +3824,7 @@ namespace Cicm.Database.Migrations
|
||||
|
||||
b.HasIndex("Lens");
|
||||
|
||||
b.HasIndex("License");
|
||||
b.HasIndex("LicenseId");
|
||||
|
||||
b.HasIndex("LightSource");
|
||||
|
||||
@@ -4566,6 +4566,9 @@ namespace Cicm.Database.Migrations
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.MachinePhoto", b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.License", "License").WithMany("Photos").HasForeignKey("LicenseId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Cicm.Database.Models.Machine", "Machine").WithMany("Photos").HasForeignKey("MachineId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
@@ -23,5 +24,6 @@ namespace Cicm.Database.Models
|
||||
[Column(TypeName = "longtext")]
|
||||
[StringLength(131072)]
|
||||
public string Text { get; set; }
|
||||
public virtual ICollection<MachinePhoto> Photos { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,6 @@ namespace Cicm.Database.Models
|
||||
public int? IsoRating { get; set; }
|
||||
[DisplayName("Lens used")]
|
||||
public string Lens { get; set; }
|
||||
public string License { get; set; }
|
||||
[DisplayName("Light source")]
|
||||
public string LightSource { get; set; }
|
||||
[DisplayName("Metering mode")]
|
||||
@@ -70,5 +69,7 @@ namespace Cicm.Database.Models
|
||||
|
||||
public virtual ApplicationUser User { get; set; }
|
||||
public virtual Machine Machine { get; set; }
|
||||
[Required]
|
||||
public virtual License License { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -521,8 +521,6 @@ namespace Cicm.Database.Models
|
||||
|
||||
entity.HasIndex(e => e.Lens);
|
||||
|
||||
entity.HasIndex(e => e.License);
|
||||
|
||||
entity.HasIndex(e => e.LightSource);
|
||||
|
||||
entity.HasIndex(e => e.MeteringMode);
|
||||
@@ -554,6 +552,8 @@ namespace Cicm.Database.Models
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Photos).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasOne(d => d.User).WithMany(p => p.Photos).OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
entity.HasOne(d => d.License).WithMany(p => p.Photos).OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MemoryByMachine>(entity =>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.591</Version>
|
||||
<Version>3.0.99.597</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user