| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- 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<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
- ClientId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ClientSecret = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ConsentType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- DisplayName = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- DisplayNames = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Permissions = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- PostLogoutRedirectUris = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Properties = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- RedirectUris = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Requirements = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ClientUri = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- LogoUri = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
- CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- LastModificationTime = table.Column<DateTime>(type: "datetime", nullable: true),
- LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
- DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- DeletionTime = table.Column<DateTime>(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<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
- Description = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Descriptions = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- DisplayName = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- DisplayNames = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Properties = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Resources = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
- CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- LastModificationTime = table.Column<DateTime>(type: "datetime", nullable: true),
- LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
- DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- DeletionTime = table.Column<DateTime>(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<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
- ApplicationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- CreationDate = table.Column<DateTime>(type: "datetime", nullable: true),
- Properties = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Scopes = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Status = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Subject = table.Column<string>(type: "varchar(400)", maxLength: 400, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
- CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- LastModificationTime = table.Column<DateTime>(type: "datetime", nullable: true),
- LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
- DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- DeletionTime = table.Column<DateTime>(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<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
- ApplicationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- AuthorizationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- CreationDate = table.Column<DateTime>(type: "datetime", nullable: true),
- ExpirationDate = table.Column<DateTime>(type: "datetime", nullable: true),
- Payload = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Properties = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- RedemptionDate = table.Column<DateTime>(type: "datetime", nullable: true),
- ReferenceId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Status = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Subject = table.Column<string>(type: "varchar(400)", maxLength: 400, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
- .Annotation("MySql:CharSet", "utf8mb4"),
- CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
- CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- LastModificationTime = table.Column<DateTime>(type: "datetime", nullable: true),
- LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
- DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
- DeletionTime = table.Column<DateTime>(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");
- }
- }
- }
|