using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace UnivateProperties_API.Migrations { public partial class Location_Templates : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Location", columns: table => new { Id = table.Column(nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), Created = table.Column(nullable: false), Modified = table.Column(nullable: false), ModifiedBy = table.Column(nullable: true), IsDeleted = table.Column(nullable: false), IsTesting = table.Column(nullable: false), PropertyImageLocation = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Location", x => x.Id); }); migrationBuilder.CreateTable( name: "Templates", columns: table => new { Id = table.Column(nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), Created = table.Column(nullable: false), Modified = table.Column(nullable: false), ModifiedBy = table.Column(nullable: true), IsDeleted = table.Column(nullable: false), Name = table.Column(nullable: true), Subject = table.Column(nullable: true), Body = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Templates", x => x.Id); }); migrationBuilder.CreateTable( name: "PlaceHolders", columns: table => new { Id = table.Column(nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), Name = table.Column(nullable: true), BoundTo = table.Column(nullable: true), TemplateId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_PlaceHolders", x => x.Id); table.ForeignKey( name: "FK_PlaceHolders_Templates_TemplateId", column: x => x.TemplateId, principalTable: "Templates", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Users_Username", table: "Users", column: "Username", unique: true); //migrationBuilder.CreateIndex( // name: "IX_Individuals_Telephone_CellNumber_Email", // table: "Individuals", // columns: new[] { "Telephone", "CellNumber", "Email" }, // unique: true); migrationBuilder.CreateIndex( name: "IX_PlaceHolders_TemplateId", table: "PlaceHolders", column: "TemplateId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Location"); migrationBuilder.DropTable( name: "PlaceHolders"); migrationBuilder.DropTable( name: "Templates"); migrationBuilder.DropIndex( name: "IX_Users_Username", table: "Users"); //migrationBuilder.DropIndex( // name: "IX_Individuals_Telephone_CellNumber_Email", // table: "Individuals"); } } }