API
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.

20191112124547_templateMod.cs 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. namespace UnivateProperties_API.Migrations
  3. {
  4. public partial class templateMod : Migration
  5. {
  6. protected override void Up(MigrationBuilder migrationBuilder)
  7. {
  8. migrationBuilder.AddColumn<int>(
  9. name: "SenderId",
  10. table: "Templates",
  11. nullable: true);
  12. migrationBuilder.AddColumn<int>(
  13. name: "TemplateId",
  14. table: "Individuals",
  15. nullable: true);
  16. migrationBuilder.AddColumn<int>(
  17. name: "TemplateId",
  18. table: "Agents",
  19. nullable: true);
  20. migrationBuilder.AddColumn<bool>(
  21. name: "Default",
  22. table: "Accounts",
  23. nullable: false,
  24. defaultValue: false);
  25. migrationBuilder.CreateIndex(
  26. name: "IX_Templates_SenderId",
  27. table: "Templates",
  28. column: "SenderId");
  29. migrationBuilder.CreateIndex(
  30. name: "IX_Individuals_TemplateId",
  31. table: "Individuals",
  32. column: "TemplateId");
  33. migrationBuilder.CreateIndex(
  34. name: "IX_Agents_TemplateId",
  35. table: "Agents",
  36. column: "TemplateId");
  37. migrationBuilder.AddForeignKey(
  38. name: "FK_Agents_Templates_TemplateId",
  39. table: "Agents",
  40. column: "TemplateId",
  41. principalTable: "Templates",
  42. principalColumn: "Id",
  43. onDelete: ReferentialAction.Restrict);
  44. migrationBuilder.AddForeignKey(
  45. name: "FK_Individuals_Templates_TemplateId",
  46. table: "Individuals",
  47. column: "TemplateId",
  48. principalTable: "Templates",
  49. principalColumn: "Id",
  50. onDelete: ReferentialAction.Restrict);
  51. migrationBuilder.AddForeignKey(
  52. name: "FK_Templates_Accounts_SenderId",
  53. table: "Templates",
  54. column: "SenderId",
  55. principalTable: "Accounts",
  56. principalColumn: "Id",
  57. onDelete: ReferentialAction.Restrict);
  58. }
  59. protected override void Down(MigrationBuilder migrationBuilder)
  60. {
  61. migrationBuilder.DropForeignKey(
  62. name: "FK_Agents_Templates_TemplateId",
  63. table: "Agents");
  64. migrationBuilder.DropForeignKey(
  65. name: "FK_Individuals_Templates_TemplateId",
  66. table: "Individuals");
  67. migrationBuilder.DropForeignKey(
  68. name: "FK_Templates_Accounts_SenderId",
  69. table: "Templates");
  70. migrationBuilder.DropIndex(
  71. name: "IX_Templates_SenderId",
  72. table: "Templates");
  73. migrationBuilder.DropIndex(
  74. name: "IX_Individuals_TemplateId",
  75. table: "Individuals");
  76. migrationBuilder.DropIndex(
  77. name: "IX_Agents_TemplateId",
  78. table: "Agents");
  79. migrationBuilder.DropColumn(
  80. name: "SenderId",
  81. table: "Templates");
  82. migrationBuilder.DropColumn(
  83. name: "TemplateId",
  84. table: "Individuals");
  85. migrationBuilder.DropColumn(
  86. name: "TemplateId",
  87. table: "Agents");
  88. migrationBuilder.DropColumn(
  89. name: "Default",
  90. table: "Accounts");
  91. }
  92. }
  93. }