- Fix MSTest compatibility with .NET 9.0 by upgrading to MSTest.TestFramework 4.2.3 - Move Tests directory to solution level (Tests/) to prevent test files from being compiled with GermanApp - Update test project references to point to GermanApp/GermanApp.csproj - Add InternalsVisibleTo attributes for test assemblies - Make RefreshToken properties internal for testability - Fix User.ChangeEmail null handling - Add 46 comprehensive unit tests for User and RefreshToken domain entities - All tests passing successfully Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
52 lines
2.2 KiB
C#
52 lines
2.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace GermanApp.Infrastructure.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddRefreshTokensTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "RefreshTokens",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
UserId = table.Column<int>(type: "integer", nullable: false),
|
|
Token = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
|
ExpiresAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
IsActive = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
RevokedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_RefreshTokens", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_RefreshTokens_Users_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "Users",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_RefreshTokens_UserId",
|
|
table: "RefreshTokens",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "RefreshTokens");
|
|
}
|
|
}
|
|
}
|