diff options
Diffstat (limited to 'Migrations/20230831162159_MediaOcr.cs')
| -rw-r--r-- | Migrations/20230831162159_MediaOcr.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Migrations/20230831162159_MediaOcr.cs b/Migrations/20230831162159_MediaOcr.cs new file mode 100644 index 0000000..02f6185 --- /dev/null +++ b/Migrations/20230831162159_MediaOcr.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace HyperBooru.Migrations +{ + /// <inheritdoc /> + public partial class MediaOcr : Migration + { + /// <inheritdoc /> + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "OcrData", + columns: table => new + { + OcrDataId = table.Column<int>(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MediaId = table.Column<int>(type: "integer", nullable: false), + Text = table.Column<string>(type: "text", nullable: false), + SearchableText = table.Column<string>(type: "text", nullable: false), + Timestamp = table.Column<DateTime>(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); + } + + /// <inheritdoc /> + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "OcrData"); + } + } +} |
