20260714112143_AddStockWatch.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddStockWatch : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "StockWatch",
  14. columns: table => new
  15. {
  16. ID = table.Column<long>(type: "bigint", nullable: false, comment: "PK")
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. MemberID = table.Column<int>(type: "int", nullable: false, comment: "관심 등록 회원 ID"),
  19. StockCode = table.Column<string>(type: "nchar(6)", fixedLength: true, maxLength: 6, nullable: false, comment: "단축코드 (char 6, Stock.Code denorm)"),
  20. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  21. },
  22. constraints: table =>
  23. {
  24. table.PrimaryKey("PK_StockWatch", x => x.ID);
  25. },
  26. comment: "회원 관심종목");
  27. migrationBuilder.CreateIndex(
  28. name: "IX_StockWatch_MemberID_CreatedAt",
  29. table: "StockWatch",
  30. columns: new[] { "MemberID", "CreatedAt" },
  31. descending: new[] { false, true });
  32. migrationBuilder.CreateIndex(
  33. name: "IX_StockWatch_MemberID_StockCode",
  34. table: "StockWatch",
  35. columns: new[] { "MemberID", "StockCode" },
  36. unique: true);
  37. }
  38. /// <inheritdoc />
  39. protected override void Down(MigrationBuilder migrationBuilder)
  40. {
  41. migrationBuilder.DropTable(
  42. name: "StockWatch");
  43. }
  44. }
  45. }