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.

20221103144335_AddedAd.cs 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Diligent.WebAPI.Data.Migrations
  5. {
  6. public partial class AddedAd : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "Ads",
  12. columns: table => new
  13. {
  14. Id = table.Column<int>(type: "int", nullable: false)
  15. .Annotation("SqlServer:Identity", "1, 1"),
  16. Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
  17. MinimumExperience = table.Column<int>(type: "int", nullable: false),
  18. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  19. ExpiredAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  20. MainLiabilities = table.Column<string>(type: "nvarchar(max)", nullable: false),
  21. Conditions = table.Column<string>(type: "nvarchar(max)", nullable: false),
  22. Offer = table.Column<string>(type: "nvarchar(max)", nullable: false)
  23. },
  24. constraints: table =>
  25. {
  26. table.PrimaryKey("PK_Ads", x => x.Id);
  27. });
  28. migrationBuilder.CreateTable(
  29. name: "AdTechnology",
  30. columns: table => new
  31. {
  32. AdsId = table.Column<int>(type: "int", nullable: false),
  33. TechnologiesTechnologyId = table.Column<int>(type: "int", nullable: false)
  34. },
  35. constraints: table =>
  36. {
  37. table.PrimaryKey("PK_AdTechnology", x => new { x.AdsId, x.TechnologiesTechnologyId });
  38. table.ForeignKey(
  39. name: "FK_AdTechnology_Ads_AdsId",
  40. column: x => x.AdsId,
  41. principalTable: "Ads",
  42. principalColumn: "Id",
  43. onDelete: ReferentialAction.Cascade);
  44. table.ForeignKey(
  45. name: "FK_AdTechnology_Technologies_TechnologiesTechnologyId",
  46. column: x => x.TechnologiesTechnologyId,
  47. principalTable: "Technologies",
  48. principalColumn: "TechnologyId",
  49. onDelete: ReferentialAction.Cascade);
  50. });
  51. migrationBuilder.CreateIndex(
  52. name: "IX_AdTechnology_TechnologiesTechnologyId",
  53. table: "AdTechnology",
  54. column: "TechnologiesTechnologyId");
  55. }
  56. protected override void Down(MigrationBuilder migrationBuilder)
  57. {
  58. migrationBuilder.DropTable(
  59. name: "AdTechnology");
  60. migrationBuilder.DropTable(
  61. name: "Ads");
  62. }
  63. }
  64. }