using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace AuthServer.Migrations { public partial class init : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "OpenIddictApplications", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ClientId = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ClientSecret = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConsentType = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), DisplayName = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), DisplayNames = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Permissions = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), PostLogoutRedirectUris = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Properties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), RedirectUris = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Requirements = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ClientUri = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), LogoUri = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ExtraProperties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime", nullable: false), CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), LastModificationTime = table.Column(type: "datetime", nullable: true), LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), DeletionTime = table.Column(type: "datetime", nullable: true) }, constraints: table => { table.PrimaryKey("PK_OpenIddictApplications", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "OpenIddictScopes", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Description = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Descriptions = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), DisplayName = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), DisplayNames = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Properties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Resources = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ExtraProperties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime", nullable: false), CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), LastModificationTime = table.Column(type: "datetime", nullable: true), LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), DeletionTime = table.Column(type: "datetime", nullable: true) }, constraints: table => { table.PrimaryKey("PK_OpenIddictScopes", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "OpenIddictAuthorizations", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ApplicationId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), CreationDate = table.Column(type: "datetime", nullable: true), Properties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Scopes = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Status = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Subject = table.Column(type: "varchar(400)", maxLength: 400, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ExtraProperties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime", nullable: false), CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), LastModificationTime = table.Column(type: "datetime", nullable: true), LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), DeletionTime = table.Column(type: "datetime", nullable: true) }, constraints: table => { table.PrimaryKey("PK_OpenIddictAuthorizations", x => x.Id); table.ForeignKey( name: "FK_OpenIddictAuthorizations_OpenIddictApplications_ApplicationId", column: x => x.ApplicationId, principalTable: "OpenIddictApplications", principalColumn: "Id"); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "OpenIddictTokens", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ApplicationId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), AuthorizationId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), CreationDate = table.Column(type: "datetime", nullable: true), ExpirationDate = table.Column(type: "datetime", nullable: true), Payload = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Properties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), RedemptionDate = table.Column(type: "datetime", nullable: true), ReferenceId = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Status = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Subject = table.Column(type: "varchar(400)", maxLength: 400, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ExtraProperties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime", nullable: false), CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), LastModificationTime = table.Column(type: "datetime", nullable: true), LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), DeletionTime = table.Column(type: "datetime", nullable: true) }, constraints: table => { table.PrimaryKey("PK_OpenIddictTokens", x => x.Id); table.ForeignKey( name: "FK_OpenIddictTokens_OpenIddictApplications_ApplicationId", column: x => x.ApplicationId, principalTable: "OpenIddictApplications", principalColumn: "Id"); table.ForeignKey( name: "FK_OpenIddictTokens_OpenIddictAuthorizations_AuthorizationId", column: x => x.AuthorizationId, principalTable: "OpenIddictAuthorizations", principalColumn: "Id"); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_OpenIddictApplications_ClientId", table: "OpenIddictApplications", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_OpenIddictAuthorizations_ApplicationId_Status_Subject_Type", table: "OpenIddictAuthorizations", columns: new[] { "ApplicationId", "Status", "Subject", "Type" }); migrationBuilder.CreateIndex( name: "IX_OpenIddictScopes_Name", table: "OpenIddictScopes", column: "Name"); migrationBuilder.CreateIndex( name: "IX_OpenIddictTokens_ApplicationId_Status_Subject_Type", table: "OpenIddictTokens", columns: new[] { "ApplicationId", "Status", "Subject", "Type" }); migrationBuilder.CreateIndex( name: "IX_OpenIddictTokens_AuthorizationId", table: "OpenIddictTokens", column: "AuthorizationId"); migrationBuilder.CreateIndex( name: "IX_OpenIddictTokens_ReferenceId", table: "OpenIddictTokens", column: "ReferenceId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "OpenIddictScopes"); migrationBuilder.DropTable( name: "OpenIddictTokens"); migrationBuilder.DropTable( name: "OpenIddictAuthorizations"); migrationBuilder.DropTable( name: "OpenIddictApplications"); } } }