using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace Marco.Pms.DataAccess.Migrations { /// public partial class Added_PaymentRequest_RecurringPayment_AdvancePayment_Related_Tables : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_PaymentModeMatser_Tenants_TenantId", table: "PaymentModeMatser"); migrationBuilder.DropIndex( name: "IX_PaymentModeMatser_TenantId", table: "PaymentModeMatser"); migrationBuilder.DropColumn( name: "TenantId", table: "PaymentModeMatser"); migrationBuilder.CreateTable( name: "AdvancePaymentTransactions", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), FinanceUIdPrefix = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), FinanceUIdPostfix = table.Column(type: "int", nullable: false), EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Amount = table.Column(type: "double", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), IsActive = table.Column(type: "tinyint(1)", nullable: false), TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_AdvancePaymentTransactions", x => x.Id); table.ForeignKey( name: "FK_AdvancePaymentTransactions_Employees_CreatedById", column: x => x.CreatedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AdvancePaymentTransactions_Employees_EmployeeId", column: x => x.EmployeeId, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AdvancePaymentTransactions_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "RecurringPayments", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Title = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), UIDPrefix = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), UIDPostfix = table.Column(type: "int", nullable: false), Payee = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), NotifyTo = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CurrencyId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Amount = table.Column(type: "double", nullable: false), StrikeDate = table.Column(type: "datetime(6)", nullable: false), LatestPRGeneratedAt = table.Column(type: "datetime(6)", nullable: false), PaymentBufferDays = table.Column(type: "int", nullable: false), NumberOfIteration = table.Column(type: "int", nullable: false), ExpenseCategoryId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), ExpenseStatusId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), StatusId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Frequency = table.Column(type: "int", nullable: false), IsVariable = table.Column(type: "tinyint(1)", nullable: false), IsActive = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_RecurringPayments", x => x.Id); table.ForeignKey( name: "FK_RecurringPayments_CurrencyMaster_CurrencyId", column: x => x.CurrencyId, principalTable: "CurrencyMaster", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_RecurringPayments_Employees_CreatedById", column: x => x.CreatedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_RecurringPayments_Employees_UpdatedById", column: x => x.UpdatedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_RecurringPayments_ExpensesStatusMaster_ExpenseStatusId", column: x => x.ExpenseStatusId, principalTable: "ExpensesStatusMaster", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_RecurringPayments_ExpensesStatusMaster_StatusId", column: x => x.StatusId, principalTable: "ExpensesStatusMaster", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_RecurringPayments_ExpensesTypeMaster_ExpenseCategoryId", column: x => x.ExpenseCategoryId, principalTable: "ExpensesTypeMaster", principalColumn: "Id"); table.ForeignKey( name: "FK_RecurringPayments_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "StatusUpdateLogs", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), StatusId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), EntityId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Comment = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_StatusUpdateLogs", x => x.Id); table.ForeignKey( name: "FK_StatusUpdateLogs_Employees_UpdatedById", column: x => x.UpdatedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_StatusUpdateLogs_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "PaymentRequests", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Title = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), UIDPrefix = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), UIDPostfix = table.Column(type: "int", nullable: false), Payee = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CurrencyId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Amount = table.Column(type: "double", nullable: false), DueDate = table.Column(type: "datetime(6)", nullable: false), RecurringPaymentId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), ExpenseCategoryId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), ExpenseStatusId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), IsActive = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_PaymentRequests", x => x.Id); table.ForeignKey( name: "FK_PaymentRequests_CurrencyMaster_CurrencyId", column: x => x.CurrencyId, principalTable: "CurrencyMaster", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PaymentRequests_Employees_CreatedById", column: x => x.CreatedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PaymentRequests_Employees_UpdatedById", column: x => x.UpdatedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PaymentRequests_ExpensesStatusMaster_ExpenseStatusId", column: x => x.ExpenseStatusId, principalTable: "ExpensesStatusMaster", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PaymentRequests_ExpensesTypeMaster_ExpenseCategoryId", column: x => x.ExpenseCategoryId, principalTable: "ExpensesTypeMaster", principalColumn: "Id"); table.ForeignKey( name: "FK_PaymentRequests_RecurringPayments_RecurringPaymentId", column: x => x.RecurringPaymentId, principalTable: "RecurringPayments", principalColumn: "Id"); table.ForeignKey( name: "FK_PaymentRequests_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.InsertData( table: "PaymentModeMatser", columns: new[] { "Id", "Description", "IsActive", "Name" }, values: new object[,] { { new Guid("95697409-baf6-4f78-86ab-42d93d9569a8"), "A debit card is a payment card that deducts funds directly from the cardholder's bank account when a purchase is made.", true, "Debit Card" }, { new Guid("a820f240-5e9a-4ae9-9091-8a7aa7720cea"), "A credit card is a payment card that allows you to borrow funds from a financial institution to pay for goods and services", true, "Credit card" }, { new Guid("f67beee6-6763-4108-922c-03bd86b9178d"), "When a bill is paid using the amount received in advance from a company.", true, "Advance Payment" } }); migrationBuilder.CreateIndex( name: "IX_AdvancePaymentTransactions_CreatedById", table: "AdvancePaymentTransactions", column: "CreatedById"); migrationBuilder.CreateIndex( name: "IX_AdvancePaymentTransactions_EmployeeId", table: "AdvancePaymentTransactions", column: "EmployeeId"); migrationBuilder.CreateIndex( name: "IX_AdvancePaymentTransactions_TenantId", table: "AdvancePaymentTransactions", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_PaymentRequests_CreatedById", table: "PaymentRequests", column: "CreatedById"); migrationBuilder.CreateIndex( name: "IX_PaymentRequests_CurrencyId", table: "PaymentRequests", column: "CurrencyId"); migrationBuilder.CreateIndex( name: "IX_PaymentRequests_ExpenseCategoryId", table: "PaymentRequests", column: "ExpenseCategoryId"); migrationBuilder.CreateIndex( name: "IX_PaymentRequests_ExpenseStatusId", table: "PaymentRequests", column: "ExpenseStatusId"); migrationBuilder.CreateIndex( name: "IX_PaymentRequests_RecurringPaymentId", table: "PaymentRequests", column: "RecurringPaymentId"); migrationBuilder.CreateIndex( name: "IX_PaymentRequests_TenantId", table: "PaymentRequests", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_PaymentRequests_UpdatedById", table: "PaymentRequests", column: "UpdatedById"); migrationBuilder.CreateIndex( name: "IX_RecurringPayments_CreatedById", table: "RecurringPayments", column: "CreatedById"); migrationBuilder.CreateIndex( name: "IX_RecurringPayments_CurrencyId", table: "RecurringPayments", column: "CurrencyId"); migrationBuilder.CreateIndex( name: "IX_RecurringPayments_ExpenseCategoryId", table: "RecurringPayments", column: "ExpenseCategoryId"); migrationBuilder.CreateIndex( name: "IX_RecurringPayments_ExpenseStatusId", table: "RecurringPayments", column: "ExpenseStatusId"); migrationBuilder.CreateIndex( name: "IX_RecurringPayments_StatusId", table: "RecurringPayments", column: "StatusId"); migrationBuilder.CreateIndex( name: "IX_RecurringPayments_TenantId", table: "RecurringPayments", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_RecurringPayments_UpdatedById", table: "RecurringPayments", column: "UpdatedById"); migrationBuilder.CreateIndex( name: "IX_StatusUpdateLogs_TenantId", table: "StatusUpdateLogs", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_StatusUpdateLogs_UpdatedById", table: "StatusUpdateLogs", column: "UpdatedById"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AdvancePaymentTransactions"); migrationBuilder.DropTable( name: "PaymentRequests"); migrationBuilder.DropTable( name: "StatusUpdateLogs"); migrationBuilder.DropTable( name: "RecurringPayments"); migrationBuilder.DeleteData( table: "PaymentModeMatser", keyColumn: "Id", keyValue: new Guid("95697409-baf6-4f78-86ab-42d93d9569a8")); migrationBuilder.DeleteData( table: "PaymentModeMatser", keyColumn: "Id", keyValue: new Guid("a820f240-5e9a-4ae9-9091-8a7aa7720cea")); migrationBuilder.DeleteData( table: "PaymentModeMatser", keyColumn: "Id", keyValue: new Guid("f67beee6-6763-4108-922c-03bd86b9178d")); migrationBuilder.AddColumn( name: "TenantId", table: "PaymentModeMatser", type: "char(36)", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), collation: "ascii_general_ci"); migrationBuilder.UpdateData( table: "PaymentModeMatser", keyColumn: "Id", keyValue: new Guid("24e6b0df-7929-47d2-88a3-4cf14c1f28f9"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.UpdateData( table: "PaymentModeMatser", keyColumn: "Id", keyValue: new Guid("2e919e94-694c-41d9-9489-0a2b4208a027"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.UpdateData( table: "PaymentModeMatser", keyColumn: "Id", keyValue: new Guid("48d9b462-5d87-4dec-8dec-2bc943943172"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.UpdateData( table: "PaymentModeMatser", keyColumn: "Id", keyValue: new Guid("ed667353-8eea-4fd1-8750-719405932480"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.CreateIndex( name: "IX_PaymentModeMatser_TenantId", table: "PaymentModeMatser", column: "TenantId"); migrationBuilder.AddForeignKey( name: "FK_PaymentModeMatser_Tenants_TenantId", table: "PaymentModeMatser", column: "TenantId", principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }