using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace TakeoutSaaS.Infrastructure.Identity.Migrations { /// public partial class InitialIdentity : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "identity_users", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Account = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), DisplayName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), PasswordHash = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), MerchantId = table.Column(type: "uuid", nullable: true), Roles = table.Column(type: "text", nullable: false), Permissions = table.Column(type: "text", nullable: false), Avatar = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "uuid", nullable: true), UpdatedBy = table.Column(type: "uuid", nullable: true), DeletedBy = table.Column(type: "uuid", nullable: true), TenantId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_identity_users", x => x.Id); }); migrationBuilder.CreateTable( name: "mini_users", columns: table => new { Id = table.Column(type: "uuid", nullable: false), OpenId = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), UnionId = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), Nickname = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), Avatar = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "uuid", nullable: true), UpdatedBy = table.Column(type: "uuid", nullable: true), DeletedBy = table.Column(type: "uuid", nullable: true), TenantId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_mini_users", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_identity_users_TenantId", table: "identity_users", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_identity_users_TenantId_Account", table: "identity_users", columns: new[] { "TenantId", "Account" }, unique: true); migrationBuilder.CreateIndex( name: "IX_mini_users_TenantId", table: "mini_users", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_mini_users_TenantId_OpenId", table: "mini_users", columns: new[] { "TenantId", "OpenId" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "identity_users"); migrationBuilder.DropTable( name: "mini_users"); } } }