Add documents.

This commit is contained in:
2019-06-16 22:08:50 +01:00
parent 858d11d543
commit aad8ff251e
7 changed files with 10298 additions and 5009 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Cicm.Database.Migrations
{
public partial class AddDocuments : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("Documents",
table => new
{
Id = table.Column<long>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
Title = table.Column<string>(),
NativeTitle = table.Column<string>(nullable: true),
Published = table.Column<DateTime>(nullable: true),
CountryId = table.Column<short>(nullable: true),
Synopsis = table.Column<string>(maxLength: 262144, nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_Documents", x => x.Id);
table.ForeignKey("FK_Documents_iso3166_1_numeric_CountryId",
x => x.CountryId, "iso3166_1_numeric", "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex("IX_Documents_CountryId", "Documents", "CountryId");
migrationBuilder.CreateIndex("IX_Documents_NativeTitle", "Documents", "NativeTitle");
migrationBuilder.CreateIndex("IX_Documents_Published", "Documents", "Published");
migrationBuilder.CreateIndex("IX_Documents_Synopsis", "Documents", "Synopsis")
.Annotation("MySql:FullTextIndex", true);
migrationBuilder.CreateIndex("IX_Documents_Title", "Documents", "Title");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable("Documents");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
namespace Cicm.Database.Models
{
public class Document : DocumentBase
{
public virtual Iso31661Numeric Country { get; set; }
}
}

View File

@@ -46,7 +46,8 @@ namespace Cicm.Database.Models
[StringLength(64)]
public string Name { get; set; }
public virtual ICollection<Company> Companies { get; set; }
public virtual ICollection<Person> People { get; set; }
public virtual ICollection<Company> Companies { get; set; }
public virtual ICollection<Person> People { get; set; }
public virtual ICollection<Document> Documents { get; set; }
}
}

View File

@@ -78,6 +78,7 @@ namespace Cicm.Database.Models
public virtual DbSet<ResolutionsByScreen> ResolutionsByScreen { get; set; }
public virtual DbSet<Person> People { get; set; }
public virtual DbSet<Iso639> Iso639 { get; set; }
public virtual DbSet<Document> Documents { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@@ -259,6 +260,21 @@ namespace Cicm.Database.Models
.OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("fk_company_logos_company1");
});
modelBuilder.Entity<Document>(entity =>
{
entity.HasIndex(e => e.Title);
entity.HasIndex(e => e.NativeTitle);
entity.HasIndex(e => e.Published);
entity.HasIndex(e => e.CountryId);
entity.HasIndex(e => e.Synopsis).ForMySqlIsFullText();
entity.HasOne(d => d.Country).WithMany(p => p.Documents).HasForeignKey(d => d.CountryId);
});
modelBuilder.Entity<Forbidden>(entity =>
{
entity.ToTable("forbidden");
@@ -422,21 +438,21 @@ namespace Cicm.Database.Models
entity.ToTable("ISO_639-3");
entity.HasKey(e => e.Id);
entity.HasIndex(e => e.Part2B);
entity.HasIndex(e => e.Part2T);
entity.HasIndex(e => e.Part1);
entity.HasIndex(e => e.Scope);
entity.HasIndex(e => e.Type);
entity.HasIndex(e => e.ReferenceName);
entity.HasIndex(e => e.Comment);
entity.Property(e => e.ReferenceName).HasColumnName("Ref_Name");
});

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Version>3.0.99.807</Version>
<Version>3.0.99.808</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>