Iceshrimp.NET/Iceshrimp.Backend/Core/Database/Migrations/20240213000601_RemoveDriveFileUniqueConstraints.cs
Laura Hausmann d847c0d7d6
[backend/database] Remove unique constraints for drive file access keys
We are now doing proper deduplication so these are not useful anymore.
2024-02-13 01:09:00 +01:00

75 lines
2.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Iceshrimp.Backend.Core.Database.Migrations
{
/// <inheritdoc />
public partial class RemoveDriveFileUniqueConstraints : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_drive_file_accessKey",
table: "drive_file");
migrationBuilder.DropIndex(
name: "IX_drive_file_thumbnailAccessKey",
table: "drive_file");
migrationBuilder.DropIndex(
name: "IX_drive_file_webpublicAccessKey",
table: "drive_file");
migrationBuilder.CreateIndex(
name: "IX_drive_file_accessKey",
table: "drive_file",
column: "accessKey");
migrationBuilder.CreateIndex(
name: "IX_drive_file_thumbnailAccessKey",
table: "drive_file",
column: "thumbnailAccessKey");
migrationBuilder.CreateIndex(
name: "IX_drive_file_webpublicAccessKey",
table: "drive_file",
column: "webpublicAccessKey");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_drive_file_accessKey",
table: "drive_file");
migrationBuilder.DropIndex(
name: "IX_drive_file_thumbnailAccessKey",
table: "drive_file");
migrationBuilder.DropIndex(
name: "IX_drive_file_webpublicAccessKey",
table: "drive_file");
migrationBuilder.CreateIndex(
name: "IX_drive_file_accessKey",
table: "drive_file",
column: "accessKey",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_drive_file_thumbnailAccessKey",
table: "drive_file",
column: "thumbnailAccessKey",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_drive_file_webpublicAccessKey",
table: "drive_file",
column: "webpublicAccessKey",
unique: true);
}
}
}