20250111031413_AddConfigTable.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace bitforum.Migrations.DefaultDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddConfigTable : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "Config",
  14. columns: table => new
  15. {
  16. ID = table.Column<int>(type: "int", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. Key = table.Column<string>(type: "nvarchar(450)", nullable: false),
  19. Value = table.Column<string>(type: "nvarchar(max)", nullable: true),
  20. Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
  21. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  22. },
  23. constraints: table =>
  24. {
  25. table.PrimaryKey("PK_Config", x => x.ID);
  26. });
  27. migrationBuilder.CreateIndex(
  28. name: "IX_Config_Key",
  29. table: "Config",
  30. column: "Key",
  31. unique: true);
  32. }
  33. /// <inheritdoc />
  34. protected override void Down(MigrationBuilder migrationBuilder)
  35. {
  36. migrationBuilder.DropTable(
  37. name: "Config");
  38. }
  39. }
  40. }