20200727154942_CraftEmployee_Hotfix.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using Microsoft.EntityFrameworkCore.Metadata;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace GreenTree.Strohrmann.ERP.Domain.Migrations
  4. {
  5. public partial class CraftEmployee_Hotfix : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.DropPrimaryKey(
  10. name: "PK_CraftEmployees",
  11. table: "CraftEmployees");
  12. migrationBuilder.AddColumn<int>(
  13. name: "Id",
  14. table: "CraftEmployees",
  15. nullable: false,
  16. defaultValue: 0)
  17. .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
  18. migrationBuilder.AddColumn<string>(
  19. name: "Comment",
  20. table: "CraftEmployees",
  21. nullable: true);
  22. migrationBuilder.AddPrimaryKey(
  23. name: "PK_CraftEmployees",
  24. table: "CraftEmployees",
  25. column: "Id");
  26. migrationBuilder.CreateIndex(
  27. name: "IX_CraftEmployees_CraftId",
  28. table: "CraftEmployees",
  29. column: "CraftId");
  30. }
  31. protected override void Down(MigrationBuilder migrationBuilder)
  32. {
  33. migrationBuilder.DropPrimaryKey(
  34. name: "PK_CraftEmployees",
  35. table: "CraftEmployees");
  36. migrationBuilder.DropIndex(
  37. name: "IX_CraftEmployees_CraftId",
  38. table: "CraftEmployees");
  39. migrationBuilder.DropColumn(
  40. name: "Id",
  41. table: "CraftEmployees");
  42. migrationBuilder.DropColumn(
  43. name: "Comment",
  44. table: "CraftEmployees");
  45. migrationBuilder.AddPrimaryKey(
  46. name: "PK_CraftEmployees",
  47. table: "CraftEmployees",
  48. columns: new[] { "CraftId", "EmployeeId" });
  49. }
  50. }
  51. }