The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20190804060703_2_5_1_PersistedGrantDBUpdateMigration.cs 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace Teknik.IdentityServer.Data.Migrations.IdentityServer.PersistedGrantDb
  4. {
  5. public partial class _2_5_1_PersistedGrantDBUpdateMigration : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.DropIndex(
  10. name: "IX_PersistedGrants_SubjectId_ClientId_Type",
  11. table: "PersistedGrants");
  12. migrationBuilder.CreateTable(
  13. name: "DeviceCodes",
  14. columns: table => new
  15. {
  16. UserCode = table.Column<string>(maxLength: 200, nullable: false),
  17. DeviceCode = table.Column<string>(maxLength: 200, nullable: false),
  18. SubjectId = table.Column<string>(maxLength: 200, nullable: true),
  19. ClientId = table.Column<string>(maxLength: 200, nullable: false),
  20. CreationTime = table.Column<DateTime>(nullable: false),
  21. Expiration = table.Column<DateTime>(nullable: false),
  22. Data = table.Column<string>(maxLength: 50000, nullable: false)
  23. },
  24. constraints: table =>
  25. {
  26. table.PrimaryKey("PK_DeviceCodes", x => x.UserCode);
  27. });
  28. migrationBuilder.CreateIndex(
  29. name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration",
  30. table: "PersistedGrants",
  31. columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" });
  32. migrationBuilder.CreateIndex(
  33. name: "IX_DeviceCodes_DeviceCode",
  34. table: "DeviceCodes",
  35. column: "DeviceCode",
  36. unique: true);
  37. migrationBuilder.CreateIndex(
  38. name: "IX_DeviceCodes_Expiration",
  39. table: "DeviceCodes",
  40. column: "Expiration");
  41. }
  42. protected override void Down(MigrationBuilder migrationBuilder)
  43. {
  44. migrationBuilder.DropTable(
  45. name: "DeviceCodes");
  46. migrationBuilder.DropIndex(
  47. name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration",
  48. table: "PersistedGrants");
  49. migrationBuilder.CreateIndex(
  50. name: "IX_PersistedGrants_SubjectId_ClientId_Type",
  51. table: "PersistedGrants",
  52. columns: new[] { "SubjectId", "ClientId", "Type" });
  53. }
  54. }
  55. }