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.

20191014123820_Location_Templates.cs 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
  4. namespace UnivateProperties_API.Migrations
  5. {
  6. public partial class Location_Templates : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "Location",
  12. columns: table => new
  13. {
  14. Id = table.Column<int>(nullable: false)
  15. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
  16. Created = table.Column<DateTime>(nullable: false),
  17. Modified = table.Column<DateTime>(nullable: false),
  18. ModifiedBy = table.Column<string>(nullable: true),
  19. IsDeleted = table.Column<bool>(nullable: false),
  20. IsTesting = table.Column<bool>(nullable: false),
  21. PropertyImageLocation = table.Column<string>(nullable: true)
  22. },
  23. constraints: table =>
  24. {
  25. table.PrimaryKey("PK_Location", x => x.Id);
  26. });
  27. migrationBuilder.CreateTable(
  28. name: "Templates",
  29. columns: table => new
  30. {
  31. Id = table.Column<int>(nullable: false)
  32. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
  33. Created = table.Column<DateTime>(nullable: false),
  34. Modified = table.Column<DateTime>(nullable: false),
  35. ModifiedBy = table.Column<string>(nullable: true),
  36. IsDeleted = table.Column<bool>(nullable: false),
  37. Name = table.Column<string>(nullable: true),
  38. Subject = table.Column<string>(nullable: true),
  39. Body = table.Column<string>(nullable: true)
  40. },
  41. constraints: table =>
  42. {
  43. table.PrimaryKey("PK_Templates", x => x.Id);
  44. });
  45. migrationBuilder.CreateTable(
  46. name: "PlaceHolders",
  47. columns: table => new
  48. {
  49. Id = table.Column<int>(nullable: false)
  50. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
  51. Name = table.Column<string>(nullable: true),
  52. BoundTo = table.Column<string>(nullable: true),
  53. TemplateId = table.Column<int>(nullable: false)
  54. },
  55. constraints: table =>
  56. {
  57. table.PrimaryKey("PK_PlaceHolders", x => x.Id);
  58. table.ForeignKey(
  59. name: "FK_PlaceHolders_Templates_TemplateId",
  60. column: x => x.TemplateId,
  61. principalTable: "Templates",
  62. principalColumn: "Id",
  63. onDelete: ReferentialAction.Cascade);
  64. });
  65. migrationBuilder.CreateIndex(
  66. name: "IX_Individuals_Telephone_CellNumber_Email",
  67. table: "Individuals",
  68. columns: new[] { "Telephone", "CellNumber", "Email" },
  69. unique: true);
  70. migrationBuilder.CreateIndex(
  71. name: "IX_PlaceHolders_TemplateId",
  72. table: "PlaceHolders",
  73. column: "TemplateId");
  74. }
  75. protected override void Down(MigrationBuilder migrationBuilder)
  76. {
  77. migrationBuilder.DropTable(
  78. name: "Location");
  79. migrationBuilder.DropTable(
  80. name: "PlaceHolders");
  81. migrationBuilder.DropTable(
  82. name: "Templates");
  83. migrationBuilder.DropIndex(
  84. name: "IX_Users_Username",
  85. table: "Users");
  86. migrationBuilder.DropIndex(
  87. name: "IX_Individuals_Telephone_CellNumber_Email",
  88. table: "Individuals");
  89. }
  90. }
  91. }