Files
marechai/Marechai.Database/Migrations/20190616210450_AddDocuments.cs

42 lines
1.8 KiB
C#
Raw Normal View History

2019-06-16 22:08:50 +01:00
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
2020-02-10 02:10:18 +00:00
namespace Marechai.Database.Migrations
2019-06-16 22:08:50 +01:00
{
public partial class AddDocuments : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
2020-02-10 22:44:18 +00:00
migrationBuilder.CreateTable("Documents", table => new
{
Id = table.Column<long>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
2020-08-05 21:00:35 +01:00
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)
2020-02-10 22:44:18 +00:00
}, 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);
});
2019-06-16 22:08:50 +01:00
migrationBuilder.CreateIndex("IX_Documents_CountryId", "Documents", "CountryId");
migrationBuilder.CreateIndex("IX_Documents_NativeTitle", "Documents", "NativeTitle");
migrationBuilder.CreateIndex("IX_Documents_Published", "Documents", "Published");
2020-02-10 22:44:18 +00:00
migrationBuilder.CreateIndex("IX_Documents_Synopsis", "Documents", "Synopsis").
Annotation("MySql:FullTextIndex", true);
2019-06-16 22:08:50 +01:00
migrationBuilder.CreateIndex("IX_Documents_Title", "Documents", "Title");
}
2020-02-10 22:44:18 +00:00
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("Documents");
2019-06-16 22:08:50 +01:00
}
}