using Microsoft.EntityFrameworkCore.Migrations; namespace Gateway.POS.Migrations { public partial class addPayments : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Payment_Transactions_TransactionId", table: "Payment"); migrationBuilder.DropPrimaryKey( name: "PK_Payment", table: "Payment"); migrationBuilder.RenameTable( name: "Payment", newName: "Payments"); migrationBuilder.RenameIndex( name: "IX_Payment_TransactionId", table: "Payments", newName: "IX_Payments_TransactionId"); migrationBuilder.AlterColumn( name: "TotalAmount", table: "Transactions", type: "REAL", nullable: true, oldClrType: typeof(decimal), oldType: "TEXT", oldNullable: true); migrationBuilder.AlterColumn( name: "NetAmount", table: "Transactions", type: "REAL", nullable: true, oldClrType: typeof(decimal), oldType: "TEXT", oldNullable: true); migrationBuilder.AlterColumn( name: "PaidAmount", table: "Payments", type: "REAL", nullable: false, oldClrType: typeof(decimal), oldType: "TEXT"); migrationBuilder.AlterColumn( name: "ExpectAmount", table: "Payments", type: "REAL", nullable: false, oldClrType: typeof(decimal), oldType: "TEXT"); migrationBuilder.AddPrimaryKey( name: "PK_Payments", table: "Payments", column: "Id"); migrationBuilder.AddForeignKey( name: "FK_Payments_Transactions_TransactionId", table: "Payments", column: "TransactionId", principalTable: "Transactions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Payments_Transactions_TransactionId", table: "Payments"); migrationBuilder.DropPrimaryKey( name: "PK_Payments", table: "Payments"); migrationBuilder.RenameTable( name: "Payments", newName: "Payment"); migrationBuilder.RenameIndex( name: "IX_Payments_TransactionId", table: "Payment", newName: "IX_Payment_TransactionId"); migrationBuilder.AlterColumn( name: "TotalAmount", table: "Transactions", type: "TEXT", nullable: true, oldClrType: typeof(double), oldType: "REAL", oldNullable: true); migrationBuilder.AlterColumn( name: "NetAmount", table: "Transactions", type: "TEXT", nullable: true, oldClrType: typeof(double), oldType: "REAL", oldNullable: true); migrationBuilder.AlterColumn( name: "PaidAmount", table: "Payment", type: "TEXT", nullable: false, oldClrType: typeof(double), oldType: "REAL"); migrationBuilder.AlterColumn( name: "ExpectAmount", table: "Payment", type: "TEXT", nullable: false, oldClrType: typeof(double), oldType: "REAL"); migrationBuilder.AddPrimaryKey( name: "PK_Payment", table: "Payment", column: "Id"); migrationBuilder.AddForeignKey( name: "FK_Payment_Transactions_TransactionId", table: "Payment", column: "TransactionId", principalTable: "Transactions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }