using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace UnivateProperties_API.Migrations { public partial class PaymentsTable : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Payments", 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), TimeshareWeekId = table.Column(nullable: true), PropertyId = table.Column(nullable: true), Amount = table.Column(nullable: false), PaymentStatus = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Payments", x => x.Id); table.ForeignKey( name: "FK_Payments_Properties_PropertyId", column: x => x.PropertyId, principalTable: "Properties", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Payments_Weeks_TimeshareWeekId", column: x => x.TimeshareWeekId, principalTable: "Weeks", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Payments_PropertyId", table: "Payments", column: "PropertyId"); migrationBuilder.CreateIndex( name: "IX_Payments_TimeshareWeekId", table: "Payments", column: "TimeshareWeekId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Payments"); } } }