582 lines
22 KiB
C#
582 lines
22 KiB
C#
using System;
|
||
using Microsoft.EntityFrameworkCore.Migrations;
|
||
|
||
#nullable disable
|
||
|
||
namespace TakeoutSaaS.Infrastructure.Identity.Migrations
|
||
{
|
||
/// <inheritdoc />
|
||
public partial class AddEntityComments : Migration
|
||
{
|
||
/// <inheritdoc />
|
||
protected override void Up(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.AlterTable(
|
||
name: "mini_users",
|
||
comment: "小程序用户实体。");
|
||
|
||
migrationBuilder.AlterTable(
|
||
name: "identity_users",
|
||
comment: "管理后台账户实体(平台管理员、租户管理员或商户员工)。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "UpdatedBy",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
comment: "最后更新人用户标识,匿名或系统操作时为 null。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "UpdatedAt",
|
||
table: "mini_users",
|
||
type: "timestamp with time zone",
|
||
nullable: true,
|
||
comment: "最近一次更新时间(UTC),从未更新时为 null。",
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "UnionId",
|
||
table: "mini_users",
|
||
type: "character varying(128)",
|
||
maxLength: 128,
|
||
nullable: true,
|
||
comment: "微信 UnionId,可能为空。",
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(128)",
|
||
oldMaxLength: 128,
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "TenantId",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: false,
|
||
comment: "所属租户 ID。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "OpenId",
|
||
table: "mini_users",
|
||
type: "character varying(128)",
|
||
maxLength: 128,
|
||
nullable: false,
|
||
comment: "微信 OpenId。",
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(128)",
|
||
oldMaxLength: 128);
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Nickname",
|
||
table: "mini_users",
|
||
type: "character varying(64)",
|
||
maxLength: 64,
|
||
nullable: false,
|
||
comment: "昵称。",
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(64)",
|
||
oldMaxLength: 64);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "DeletedBy",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
comment: "删除人用户标识(软删除),未删除时为 null。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "DeletedAt",
|
||
table: "mini_users",
|
||
type: "timestamp with time zone",
|
||
nullable: true,
|
||
comment: "软删除时间(UTC),未删除时为 null。",
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "CreatedBy",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
comment: "创建人用户标识,匿名或系统操作时为 null。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "CreatedAt",
|
||
table: "mini_users",
|
||
type: "timestamp with time zone",
|
||
nullable: false,
|
||
comment: "创建时间(UTC)。",
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Avatar",
|
||
table: "mini_users",
|
||
type: "character varying(256)",
|
||
maxLength: 256,
|
||
nullable: true,
|
||
comment: "头像地址。",
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(256)",
|
||
oldMaxLength: 256,
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "Id",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: false,
|
||
comment: "实体唯一标识。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "UpdatedBy",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
comment: "最后更新人用户标识,匿名或系统操作时为 null。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "UpdatedAt",
|
||
table: "identity_users",
|
||
type: "timestamp with time zone",
|
||
nullable: true,
|
||
comment: "最近一次更新时间(UTC),从未更新时为 null。",
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "TenantId",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: false,
|
||
comment: "所属租户 ID。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Roles",
|
||
table: "identity_users",
|
||
type: "text",
|
||
nullable: false,
|
||
comment: "角色集合。",
|
||
oldClrType: typeof(string),
|
||
oldType: "text");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Permissions",
|
||
table: "identity_users",
|
||
type: "text",
|
||
nullable: false,
|
||
comment: "权限集合。",
|
||
oldClrType: typeof(string),
|
||
oldType: "text");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "PasswordHash",
|
||
table: "identity_users",
|
||
type: "character varying(256)",
|
||
maxLength: 256,
|
||
nullable: false,
|
||
comment: "密码哈希。",
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(256)",
|
||
oldMaxLength: 256);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "MerchantId",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
comment: "所属商户(平台管理员为空)。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "DisplayName",
|
||
table: "identity_users",
|
||
type: "character varying(64)",
|
||
maxLength: 64,
|
||
nullable: false,
|
||
comment: "展示名称。",
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(64)",
|
||
oldMaxLength: 64);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "DeletedBy",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
comment: "删除人用户标识(软删除),未删除时为 null。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "DeletedAt",
|
||
table: "identity_users",
|
||
type: "timestamp with time zone",
|
||
nullable: true,
|
||
comment: "软删除时间(UTC),未删除时为 null。",
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "CreatedBy",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
comment: "创建人用户标识,匿名或系统操作时为 null。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "CreatedAt",
|
||
table: "identity_users",
|
||
type: "timestamp with time zone",
|
||
nullable: false,
|
||
comment: "创建时间(UTC)。",
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Avatar",
|
||
table: "identity_users",
|
||
type: "character varying(256)",
|
||
maxLength: 256,
|
||
nullable: true,
|
||
comment: "头像地址。",
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(256)",
|
||
oldMaxLength: 256,
|
||
oldNullable: true);
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Account",
|
||
table: "identity_users",
|
||
type: "character varying(64)",
|
||
maxLength: 64,
|
||
nullable: false,
|
||
comment: "登录账号。",
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(64)",
|
||
oldMaxLength: 64);
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "Id",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: false,
|
||
comment: "实体唯一标识。",
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid");
|
||
}
|
||
|
||
/// <inheritdoc />
|
||
protected override void Down(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.AlterTable(
|
||
name: "mini_users",
|
||
oldComment: "小程序用户实体。");
|
||
|
||
migrationBuilder.AlterTable(
|
||
name: "identity_users",
|
||
oldComment: "管理后台账户实体(平台管理员、租户管理员或商户员工)。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "UpdatedBy",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true,
|
||
oldComment: "最后更新人用户标识,匿名或系统操作时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "UpdatedAt",
|
||
table: "mini_users",
|
||
type: "timestamp with time zone",
|
||
nullable: true,
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldNullable: true,
|
||
oldComment: "最近一次更新时间(UTC),从未更新时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "UnionId",
|
||
table: "mini_users",
|
||
type: "character varying(128)",
|
||
maxLength: 128,
|
||
nullable: true,
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(128)",
|
||
oldMaxLength: 128,
|
||
oldNullable: true,
|
||
oldComment: "微信 UnionId,可能为空。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "TenantId",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: false,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldComment: "所属租户 ID。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "OpenId",
|
||
table: "mini_users",
|
||
type: "character varying(128)",
|
||
maxLength: 128,
|
||
nullable: false,
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(128)",
|
||
oldMaxLength: 128,
|
||
oldComment: "微信 OpenId。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Nickname",
|
||
table: "mini_users",
|
||
type: "character varying(64)",
|
||
maxLength: 64,
|
||
nullable: false,
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(64)",
|
||
oldMaxLength: 64,
|
||
oldComment: "昵称。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "DeletedBy",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true,
|
||
oldComment: "删除人用户标识(软删除),未删除时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "DeletedAt",
|
||
table: "mini_users",
|
||
type: "timestamp with time zone",
|
||
nullable: true,
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldNullable: true,
|
||
oldComment: "软删除时间(UTC),未删除时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "CreatedBy",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true,
|
||
oldComment: "创建人用户标识,匿名或系统操作时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "CreatedAt",
|
||
table: "mini_users",
|
||
type: "timestamp with time zone",
|
||
nullable: false,
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldComment: "创建时间(UTC)。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Avatar",
|
||
table: "mini_users",
|
||
type: "character varying(256)",
|
||
maxLength: 256,
|
||
nullable: true,
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(256)",
|
||
oldMaxLength: 256,
|
||
oldNullable: true,
|
||
oldComment: "头像地址。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "Id",
|
||
table: "mini_users",
|
||
type: "uuid",
|
||
nullable: false,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldComment: "实体唯一标识。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "UpdatedBy",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true,
|
||
oldComment: "最后更新人用户标识,匿名或系统操作时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "UpdatedAt",
|
||
table: "identity_users",
|
||
type: "timestamp with time zone",
|
||
nullable: true,
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldNullable: true,
|
||
oldComment: "最近一次更新时间(UTC),从未更新时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "TenantId",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: false,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldComment: "所属租户 ID。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Roles",
|
||
table: "identity_users",
|
||
type: "text",
|
||
nullable: false,
|
||
oldClrType: typeof(string),
|
||
oldType: "text",
|
||
oldComment: "角色集合。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Permissions",
|
||
table: "identity_users",
|
||
type: "text",
|
||
nullable: false,
|
||
oldClrType: typeof(string),
|
||
oldType: "text",
|
||
oldComment: "权限集合。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "PasswordHash",
|
||
table: "identity_users",
|
||
type: "character varying(256)",
|
||
maxLength: 256,
|
||
nullable: false,
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(256)",
|
||
oldMaxLength: 256,
|
||
oldComment: "密码哈希。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "MerchantId",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true,
|
||
oldComment: "所属商户(平台管理员为空)。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "DisplayName",
|
||
table: "identity_users",
|
||
type: "character varying(64)",
|
||
maxLength: 64,
|
||
nullable: false,
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(64)",
|
||
oldMaxLength: 64,
|
||
oldComment: "展示名称。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "DeletedBy",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true,
|
||
oldComment: "删除人用户标识(软删除),未删除时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "DeletedAt",
|
||
table: "identity_users",
|
||
type: "timestamp with time zone",
|
||
nullable: true,
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldNullable: true,
|
||
oldComment: "软删除时间(UTC),未删除时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "CreatedBy",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: true,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldNullable: true,
|
||
oldComment: "创建人用户标识,匿名或系统操作时为 null。");
|
||
|
||
migrationBuilder.AlterColumn<DateTime>(
|
||
name: "CreatedAt",
|
||
table: "identity_users",
|
||
type: "timestamp with time zone",
|
||
nullable: false,
|
||
oldClrType: typeof(DateTime),
|
||
oldType: "timestamp with time zone",
|
||
oldComment: "创建时间(UTC)。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Avatar",
|
||
table: "identity_users",
|
||
type: "character varying(256)",
|
||
maxLength: 256,
|
||
nullable: true,
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(256)",
|
||
oldMaxLength: 256,
|
||
oldNullable: true,
|
||
oldComment: "头像地址。");
|
||
|
||
migrationBuilder.AlterColumn<string>(
|
||
name: "Account",
|
||
table: "identity_users",
|
||
type: "character varying(64)",
|
||
maxLength: 64,
|
||
nullable: false,
|
||
oldClrType: typeof(string),
|
||
oldType: "character varying(64)",
|
||
oldMaxLength: 64,
|
||
oldComment: "登录账号。");
|
||
|
||
migrationBuilder.AlterColumn<Guid>(
|
||
name: "Id",
|
||
table: "identity_users",
|
||
type: "uuid",
|
||
nullable: false,
|
||
oldClrType: typeof(Guid),
|
||
oldType: "uuid",
|
||
oldComment: "实体唯一标识。");
|
||
}
|
||
}
|
||
}
|