Files
MilkyShots/Lactose/Migrations/20260707160046_FixSharedWithManyToMany.cs
T
REDCODE 26674e05e5 refactor: quality improvements from desloppify scan
- Remove 16 unused using System; imports from migration files (implicit usings available)
- Fix 6 empty catch blocks with proper exception logging
- Remove unused import (false positive flagged as wontfix)
- Skip test coverage, orphaned, and stale exclude issues as false positives
- Add missing namespace to IPersonRepository.cs
- Rename IFolderRepository Create/Delete to Insert/Remove for CRUD consistency
- Fix ITagRepository.Delete parameter name from 'id' to 'tag'
- Add missing IDisposable to IMediaRepository
- Rename SettingsExtensions to SettingsExtension for naming consistency
- Rename PagedParametersDTO.cs to PagedParametersDto.cs
- Add .desloppify/ to .gitignore
2026-07-29 19:52:49 +02:00

119 lines
4.0 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lactose.Migrations
{
/// <inheritdoc />
public partial class FixSharedWithManyToMany : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Users_Assets_AssetId",
table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_AssetId",
table: "Users");
migrationBuilder.DropColumn(
name: "AssetId",
table: "Users");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "JobRecords",
type: "VARCHAR(2048)",
nullable: false,
oldClrType: typeof(string),
oldType: "VARCHAR(256)");
migrationBuilder.AlterColumn<string>(
name: "RegexPattern",
table: "Folders",
type: "character varying(2048)",
maxLength: 2048,
nullable: true,
oldClrType: typeof(string),
oldType: "VARCHAR(2048)",
oldMaxLength: 2048,
oldNullable: true);
migrationBuilder.CreateTable(
name: "AssetUser",
columns: table => new
{
SharedAssetsId = table.Column<Guid>(type: "uuid", nullable: false),
SharedWithId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AssetUser", x => new { x.SharedAssetsId, x.SharedWithId });
table.ForeignKey(
name: "FK_AssetUser_Assets_SharedAssetsId",
column: x => x.SharedAssetsId,
principalTable: "Assets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AssetUser_Users_SharedWithId",
column: x => x.SharedWithId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AssetUser_SharedWithId",
table: "AssetUser",
column: "SharedWithId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AssetUser");
migrationBuilder.AddColumn<Guid>(
name: "AssetId",
table: "Users",
type: "uuid",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "JobRecords",
type: "VARCHAR(256)",
nullable: false,
oldClrType: typeof(string),
oldType: "VARCHAR(2048)");
migrationBuilder.AlterColumn<string>(
name: "RegexPattern",
table: "Folders",
type: "VARCHAR(2048)",
maxLength: 2048,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(2048)",
oldMaxLength: 2048,
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_Users_AssetId",
table: "Users",
column: "AssetId");
migrationBuilder.AddForeignKey(
name: "FK_Users_Assets_AssetId",
table: "Users",
column: "AssetId",
principalTable: "Assets",
principalColumn: "Id");
}
}
}