fengling-member-service/src/Fengling.Member.Infrastructure/Migrations/20260209163416_ChangeMemberIdToGuid.cs
Sam 96503a593d feat(member): change MemberId to Guid strongly typed id
- Convert MemberId from long to Guid strongly typed ID
- Update all Member commands to use record pattern with MemberId
- Update all Member endpoints to use record pattern with MemberId
- Update entity configurations to use GuidVersion7ValueGenerator
- Add implicit conversion operators for MemberId

Migration: ChangeMemberIdToGuid
2026-02-10 00:41:35 +08:00

73 lines
2.4 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Fengling.Member.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class ChangeMemberIdToGuid : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "MemberId",
table: "OAuthAuthorization",
type: "uuid",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint");
migrationBuilder.AlterColumn<Guid>(
name: "member_id",
table: "fls_member_tag",
type: "uuid",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint");
migrationBuilder.AlterColumn<Guid>(
name: "id",
table: "fls_member",
type: "uuid",
nullable: false,
comment: "会员标识",
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<long>(
name: "MemberId",
table: "OAuthAuthorization",
type: "bigint",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<long>(
name: "member_id",
table: "fls_member_tag",
type: "bigint",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<long>(
name: "id",
table: "fls_member",
type: "bigint",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid",
oldComment: "会员标识")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
}
}
}