using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace HyperBooru.Migrations { /// public partial class MediaOcr : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "OcrData", columns: table => new { OcrDataId = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), MediaId = table.Column(type: "integer", nullable: false), Text = table.Column(type: "text", nullable: false), SearchableText = table.Column(type: "text", nullable: false), Timestamp = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_OcrData", x => x.OcrDataId); table.ForeignKey( name: "FK_OcrData_Media_MediaId", column: x => x.MediaId, principalTable: "Media", principalColumn: "ObjectId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_OcrData_MediaId", table: "OcrData", column: "MediaId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "OcrData"); } } }