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>("Lens");
|
||||||
|
|
||||||
b.Property<string>("License");
|
b.Property<int>("LicenseId");
|
||||||
|
|
||||||
b.Property<string>("LightSource");
|
b.Property<string>("LightSource");
|
||||||
|
|
||||||
@@ -3824,7 +3824,7 @@ namespace Cicm.Database.Migrations
|
|||||||
|
|
||||||
b.HasIndex("Lens");
|
b.HasIndex("Lens");
|
||||||
|
|
||||||
b.HasIndex("License");
|
b.HasIndex("LicenseId");
|
||||||
|
|
||||||
b.HasIndex("LightSource");
|
b.HasIndex("LightSource");
|
||||||
|
|
||||||
@@ -4566,6 +4566,9 @@ namespace Cicm.Database.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Cicm.Database.Models.MachinePhoto", b =>
|
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")
|
b.HasOne("Cicm.Database.Models.Machine", "Machine").WithMany("Photos").HasForeignKey("MachineId")
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
@@ -22,6 +23,7 @@ namespace Cicm.Database.Models
|
|||||||
[DisplayName("License text")]
|
[DisplayName("License text")]
|
||||||
[Column(TypeName = "longtext")]
|
[Column(TypeName = "longtext")]
|
||||||
[StringLength(131072)]
|
[StringLength(131072)]
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
public virtual ICollection<MachinePhoto> Photos { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,8 +40,7 @@ namespace Cicm.Database.Models
|
|||||||
[DisplayName("ISO speed rating")]
|
[DisplayName("ISO speed rating")]
|
||||||
public int? IsoRating { get; set; }
|
public int? IsoRating { get; set; }
|
||||||
[DisplayName("Lens used")]
|
[DisplayName("Lens used")]
|
||||||
public string Lens { get; set; }
|
public string Lens { get; set; }
|
||||||
public string License { get; set; }
|
|
||||||
[DisplayName("Light source")]
|
[DisplayName("Light source")]
|
||||||
public string LightSource { get; set; }
|
public string LightSource { get; set; }
|
||||||
[DisplayName("Metering mode")]
|
[DisplayName("Metering mode")]
|
||||||
@@ -70,5 +69,7 @@ namespace Cicm.Database.Models
|
|||||||
|
|
||||||
public virtual ApplicationUser User { get; set; }
|
public virtual ApplicationUser User { get; set; }
|
||||||
public virtual Machine Machine { 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.Lens);
|
||||||
|
|
||||||
entity.HasIndex(e => e.License);
|
|
||||||
|
|
||||||
entity.HasIndex(e => e.LightSource);
|
entity.HasIndex(e => e.LightSource);
|
||||||
|
|
||||||
entity.HasIndex(e => e.MeteringMode);
|
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.Machine).WithMany(p => p.Photos).OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
entity.HasOne(d => d.User).WithMany(p => p.Photos).OnDelete(DeleteBehavior.SetNull);
|
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 =>
|
modelBuilder.Entity<MemoryByMachine>(entity =>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<Version>3.0.99.591</Version>
|
<Version>3.0.99.597</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user