mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add documents.
This commit is contained in:
5871
Cicm.Database/Migrations/20190616210450_AddDocuments.Designer.cs
generated
Normal file
5871
Cicm.Database/Migrations/20190616210450_AddDocuments.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
47
Cicm.Database/Migrations/20190616210450_AddDocuments.cs
Normal file
47
Cicm.Database/Migrations/20190616210450_AddDocuments.cs
Normal 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
7
Cicm.Database/Models/Document.cs
Normal file
7
Cicm.Database/Models/Document.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Cicm.Database.Models
|
||||||
|
{
|
||||||
|
public class Document : DocumentBase
|
||||||
|
{
|
||||||
|
public virtual Iso31661Numeric Country { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,7 +46,8 @@ namespace Cicm.Database.Models
|
|||||||
[StringLength(64)]
|
[StringLength(64)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<Company> Companies { get; set; }
|
public virtual ICollection<Company> Companies { get; set; }
|
||||||
public virtual ICollection<Person> People { get; set; }
|
public virtual ICollection<Person> People { get; set; }
|
||||||
|
public virtual ICollection<Document> Documents { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +78,7 @@ namespace Cicm.Database.Models
|
|||||||
public virtual DbSet<ResolutionsByScreen> ResolutionsByScreen { get; set; }
|
public virtual DbSet<ResolutionsByScreen> ResolutionsByScreen { get; set; }
|
||||||
public virtual DbSet<Person> People { get; set; }
|
public virtual DbSet<Person> People { get; set; }
|
||||||
public virtual DbSet<Iso639> Iso639 { get; set; }
|
public virtual DbSet<Iso639> Iso639 { get; set; }
|
||||||
|
public virtual DbSet<Document> Documents { get; set; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
@@ -259,6 +260,21 @@ namespace Cicm.Database.Models
|
|||||||
.OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("fk_company_logos_company1");
|
.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 =>
|
modelBuilder.Entity<Forbidden>(entity =>
|
||||||
{
|
{
|
||||||
entity.ToTable("forbidden");
|
entity.ToTable("forbidden");
|
||||||
@@ -422,21 +438,21 @@ namespace Cicm.Database.Models
|
|||||||
entity.ToTable("ISO_639-3");
|
entity.ToTable("ISO_639-3");
|
||||||
|
|
||||||
entity.HasKey(e => e.Id);
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
entity.HasIndex(e => e.Part2B);
|
entity.HasIndex(e => e.Part2B);
|
||||||
|
|
||||||
entity.HasIndex(e => e.Part2T);
|
entity.HasIndex(e => e.Part2T);
|
||||||
|
|
||||||
entity.HasIndex(e => e.Part1);
|
entity.HasIndex(e => e.Part1);
|
||||||
|
|
||||||
entity.HasIndex(e => e.Scope);
|
entity.HasIndex(e => e.Scope);
|
||||||
|
|
||||||
entity.HasIndex(e => e.Type);
|
entity.HasIndex(e => e.Type);
|
||||||
|
|
||||||
entity.HasIndex(e => e.ReferenceName);
|
entity.HasIndex(e => e.ReferenceName);
|
||||||
|
|
||||||
entity.HasIndex(e => e.Comment);
|
entity.HasIndex(e => e.Comment);
|
||||||
|
|
||||||
entity.Property(e => e.ReferenceName).HasColumnName("Ref_Name");
|
entity.Property(e => e.ReferenceName).HasColumnName("Ref_Name");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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.807</Version>
|
<Version>3.0.99.808</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