[backend/database] Remove unique constraints for drive file access keys
We are now doing proper deduplication so these are not useful anymore.
This commit is contained in:
parent
5a7ef95ff4
commit
d847c0d7d6
4 changed files with 6041 additions and 9 deletions
5960
Iceshrimp.Backend/Core/Database/Migrations/20240213000601_RemoveDriveFileUniqueConstraints.Designer.cs
generated
Normal file
5960
Iceshrimp.Backend/Core/Database/Migrations/20240213000601_RemoveDriveFileUniqueConstraints.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,75 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -991,8 +991,7 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccessKey")
|
||||
.IsUnique();
|
||||
b.HasIndex("AccessKey");
|
||||
|
||||
b.HasIndex("CreatedAt");
|
||||
|
||||
|
@ -1004,8 +1003,7 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
|||
|
||||
b.HasIndex("Sha256");
|
||||
|
||||
b.HasIndex("ThumbnailAccessKey")
|
||||
.IsUnique();
|
||||
b.HasIndex("ThumbnailAccessKey");
|
||||
|
||||
b.HasIndex("Type");
|
||||
|
||||
|
@ -1015,8 +1013,7 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.HasIndex("WebpublicAccessKey")
|
||||
.IsUnique();
|
||||
b.HasIndex("WebpublicAccessKey");
|
||||
|
||||
b.HasIndex("UserId", "FolderId", "Id");
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ namespace Iceshrimp.Backend.Core.Database.Tables;
|
|||
[Index("Type")]
|
||||
[Index("IsSensitive")]
|
||||
[Index("FolderId")]
|
||||
[Index("WebpublicAccessKey", IsUnique = true)]
|
||||
[Index("WebpublicAccessKey")]
|
||||
[Index("CreatedAt")]
|
||||
[Index("AccessKey", IsUnique = true)]
|
||||
[Index("AccessKey")]
|
||||
[Index("Uri")]
|
||||
[Index("ThumbnailAccessKey", IsUnique = true)]
|
||||
[Index("ThumbnailAccessKey")]
|
||||
public class DriveFile : IEntity {
|
||||
/// <summary>
|
||||
/// The created date of the DriveFile.
|
||||
|
|
Loading…
Add table
Reference in a new issue