mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add magazines issues.
This commit is contained in:
8040
Cicm.Database/Migrations/20190617024228_AddMagazineIssues.Designer.cs
generated
Normal file
8040
Cicm.Database/Migrations/20190617024228_AddMagazineIssues.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
49
Cicm.Database/Migrations/20190617024228_AddMagazineIssues.cs
Normal file
49
Cicm.Database/Migrations/20190617024228_AddMagazineIssues.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class AddMagazineIssues : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("MagazineIssues",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MagazineId = table.Column<long>(),
|
||||
Caption = table.Column<string>(),
|
||||
NativeCaption = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true),
|
||||
ProductCode = table.Column<string>(maxLength: 18, nullable: true),
|
||||
Pages = table.Column<short>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MagazineIssues", x => x.Id);
|
||||
table.ForeignKey("FK_MagazineIssues_Magazines_MagazineId",
|
||||
x => x.MagazineId, "Magazines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazineIssues_Caption", "MagazineIssues", "Caption");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazineIssues_MagazineId", "MagazineIssues", "MagazineId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazineIssues_NativeCaption", "MagazineIssues", "NativeCaption");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazineIssues_Pages", "MagazineIssues", "Pages");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazineIssues_ProductCode", "MagazineIssues", "ProductCode");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazineIssues_Published", "MagazineIssues", "Published");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("MagazineIssues");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4470,6 +4470,39 @@ namespace Cicm.Database.Migrations
|
||||
b.ToTable("Magazines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.MagazineIssue", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Caption").IsRequired();
|
||||
|
||||
b.Property<long>("MagazineId");
|
||||
|
||||
b.Property<string>("NativeCaption");
|
||||
|
||||
b.Property<short>("Pages");
|
||||
|
||||
b.Property<string>("ProductCode").HasMaxLength(18);
|
||||
|
||||
b.Property<DateTime?>("Published");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Caption");
|
||||
|
||||
b.HasIndex("MagazineId");
|
||||
|
||||
b.HasIndex("NativeCaption");
|
||||
|
||||
b.HasIndex("Pages");
|
||||
|
||||
b.HasIndex("ProductCode");
|
||||
|
||||
b.HasIndex("Published");
|
||||
|
||||
b.ToTable("MagazineIssues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.MemoryByMachine", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("bigint(20)");
|
||||
@@ -5638,6 +5671,13 @@ namespace Cicm.Database.Migrations
|
||||
.HasForeignKey("CountryId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.MagazineIssue",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Magazine", "Magazine").WithMany("Issues")
|
||||
.HasForeignKey("MagazineId").OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.MemoryByMachine",
|
||||
b =>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
@@ -11,6 +12,7 @@ namespace Cicm.Database.Models
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime? FirstPublication { get; set; }
|
||||
|
||||
public virtual Iso31661Numeric Country { get; set; }
|
||||
public virtual Iso31661Numeric Country { get; set; }
|
||||
public virtual ICollection<MagazineIssue> Issues { get; set; }
|
||||
}
|
||||
}
|
||||
22
Cicm.Database/Models/MagazineIssue.cs
Normal file
22
Cicm.Database/Models/MagazineIssue.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class MagazineIssue : BaseModel<long>
|
||||
{
|
||||
[Required]
|
||||
public long MagazineId { get; set; }
|
||||
[Required]
|
||||
public string Caption { get; set; }
|
||||
public string NativeCaption { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime? Published { get; set; }
|
||||
[StringLength(18)]
|
||||
public string ProductCode { get; set; }
|
||||
public short Pages { get; set; }
|
||||
|
||||
public virtual Magazine Magazine { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,7 @@ namespace Cicm.Database.Models
|
||||
public virtual DbSet<BooksByMachine> BooksByMachines { get; set; }
|
||||
public virtual DbSet<BooksByMachineFamily> BooksByMachineFamilies { get; set; }
|
||||
public virtual DbSet<Magazine> Magazines { get; set; }
|
||||
public virtual DbSet<MagazineIssue> MagazineIssues { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -872,6 +873,21 @@ namespace Cicm.Database.Models
|
||||
entity.HasOne(d => d.Country).WithMany(p => p.Magazines).HasForeignKey(d => d.CountryId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MagazineIssue>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Caption);
|
||||
|
||||
entity.HasIndex(e => e.NativeCaption);
|
||||
|
||||
entity.HasIndex(e => e.Published);
|
||||
|
||||
entity.HasIndex(e => e.ProductCode);
|
||||
|
||||
entity.HasIndex(e => e.Pages);
|
||||
|
||||
entity.HasOne(d => d.Magazine).WithMany(p => p.Issues).HasForeignKey(d => d.MagazineId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MemoryByMachine>(entity =>
|
||||
{
|
||||
entity.ToTable("memory_by_machine");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.830</Version>
|
||||
<Version>3.0.99.831</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