using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CMSMicroservice.Infrastructure.Persistence.Migrations { /// public partial class u05 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "PaymentStatus", schema: "CMS", table: "UserOrders", type: "int", nullable: false, oldClrType: typeof(bool), oldType: "bit"); migrationBuilder.CreateTable( name: "ProductImagess", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Title = table.Column(type: "nvarchar(max)", nullable: false), ImagePath = table.Column(type: "nvarchar(max)", nullable: false), ImageThumbnailPath = table.Column(type: "nvarchar(max)", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ProductImagess", x => x.Id); }); migrationBuilder.CreateTable( name: "Productss", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Title = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: false), ShortInfomation = table.Column(type: "nvarchar(max)", nullable: false), FullInformation = table.Column(type: "nvarchar(max)", nullable: false), Price = table.Column(type: "bigint", nullable: false), Discount = table.Column(type: "int", nullable: false), Rate = table.Column(type: "int", nullable: false), ImagePath = table.Column(type: "nvarchar(max)", nullable: false), ThumbnailPath = table.Column(type: "nvarchar(max)", nullable: false), SaleCount = table.Column(type: "int", nullable: false), ViewCount = table.Column(type: "int", nullable: false), RemainingCount = table.Column(type: "int", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Productss", x => x.Id); }); migrationBuilder.CreateTable( name: "Transactionss", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), MerchantId = table.Column(type: "nvarchar(max)", nullable: false), Amount = table.Column(type: "bigint", nullable: false), CallbackUrl = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: false), Mobile = table.Column(type: "nvarchar(max)", nullable: true), Email = table.Column(type: "nvarchar(max)", nullable: true), RequestStatusCode = table.Column(type: "int", nullable: true), RequestStatusMessage = table.Column(type: "nvarchar(max)", nullable: true), Authority = table.Column(type: "nvarchar(max)", nullable: true), FeeType = table.Column(type: "nvarchar(max)", nullable: true), Fee = table.Column(type: "bigint", nullable: true), Currency = table.Column(type: "int", nullable: true), PaymentStatus = table.Column(type: "int", nullable: false), PaymentDate = table.Column(type: "datetime2", nullable: true), VerificationStatusCode = table.Column(type: "int", nullable: true), VerificationStatusMessage = table.Column(type: "nvarchar(max)", nullable: true), CardHash = table.Column(type: "nvarchar(max)", nullable: true), CardPan = table.Column(type: "nvarchar(max)", nullable: true), RefId = table.Column(type: "nvarchar(max)", nullable: true), OrderId = table.Column(type: "bigint", nullable: true), Type = table.Column(type: "int", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Transactionss", x => x.Id); table.ForeignKey( name: "FK_Transactionss_UserOrders_OrderId", column: x => x.OrderId, principalSchema: "CMS", principalTable: "UserOrders", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "UserWallets", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "bigint", nullable: false), Balance = table.Column(type: "bigint", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserWallets", x => x.Id); table.ForeignKey( name: "FK_UserWallets_Users_UserId", column: x => x.UserId, principalSchema: "CMS", principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "FactorDetailss", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ProductId = table.Column(type: "bigint", nullable: false), Count = table.Column(type: "int", nullable: false), UnitPrice = table.Column(type: "bigint", nullable: false), UnitDiscount = table.Column(type: "int", nullable: false), OrderId = table.Column(type: "bigint", nullable: false), UnitDiscountPrice = table.Column(type: "bigint", nullable: false), IsChangePrice = table.Column(type: "bit", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_FactorDetailss", x => x.Id); table.ForeignKey( name: "FK_FactorDetailss_Productss_ProductId", column: x => x.ProductId, principalSchema: "CMS", principalTable: "Productss", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_FactorDetailss_UserOrders_OrderId", column: x => x.OrderId, principalSchema: "CMS", principalTable: "UserOrders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ProductGalleryss", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ProductImageId = table.Column(type: "bigint", nullable: false), ProductId = table.Column(type: "bigint", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ProductGalleryss", x => x.Id); table.ForeignKey( name: "FK_ProductGalleryss_ProductImagess_ProductImageId", column: x => x.ProductImageId, principalSchema: "CMS", principalTable: "ProductImagess", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ProductGalleryss_Productss_ProductId", column: x => x.ProductId, principalSchema: "CMS", principalTable: "Productss", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserCartss", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ProductId = table.Column(type: "bigint", nullable: false), UserId = table.Column(type: "bigint", nullable: false), Count = table.Column(type: "int", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserCartss", x => x.Id); table.ForeignKey( name: "FK_UserCartss_Productss_ProductId", column: x => x.ProductId, principalSchema: "CMS", principalTable: "Productss", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UserCartss_Users_UserId", column: x => x.UserId, principalSchema: "CMS", principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserWalletChangeLogs", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), WalletId = table.Column(type: "bigint", nullable: false), CurrentBalance = table.Column(type: "bigint", nullable: false), ChangeValue = table.Column(type: "bigint", nullable: false), IsIncrease = table.Column(type: "bit", nullable: false), RefrenceId = table.Column(type: "bigint", nullable: true), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserWalletChangeLogs", x => x.Id); table.ForeignKey( name: "FK_UserWalletChangeLogs_UserWallets_WalletId", column: x => x.WalletId, principalSchema: "CMS", principalTable: "UserWallets", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_FactorDetailss_OrderId", schema: "CMS", table: "FactorDetailss", column: "OrderId"); migrationBuilder.CreateIndex( name: "IX_FactorDetailss_ProductId", schema: "CMS", table: "FactorDetailss", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_ProductGalleryss_ProductId", schema: "CMS", table: "ProductGalleryss", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_ProductGalleryss_ProductImageId", schema: "CMS", table: "ProductGalleryss", column: "ProductImageId"); migrationBuilder.CreateIndex( name: "IX_Transactionss_OrderId", schema: "CMS", table: "Transactionss", column: "OrderId"); migrationBuilder.CreateIndex( name: "IX_UserCartss_ProductId", schema: "CMS", table: "UserCartss", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_UserCartss_UserId", schema: "CMS", table: "UserCartss", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_UserWalletChangeLogs_WalletId", schema: "CMS", table: "UserWalletChangeLogs", column: "WalletId"); migrationBuilder.CreateIndex( name: "IX_UserWallets_UserId", schema: "CMS", table: "UserWallets", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "FactorDetailss", schema: "CMS"); migrationBuilder.DropTable( name: "ProductGalleryss", schema: "CMS"); migrationBuilder.DropTable( name: "Transactionss", schema: "CMS"); migrationBuilder.DropTable( name: "UserCartss", schema: "CMS"); migrationBuilder.DropTable( name: "UserWalletChangeLogs", schema: "CMS"); migrationBuilder.DropTable( name: "ProductImagess", schema: "CMS"); migrationBuilder.DropTable( name: "Productss", schema: "CMS"); migrationBuilder.DropTable( name: "UserWallets", schema: "CMS"); migrationBuilder.AlterColumn( name: "PaymentStatus", schema: "CMS", table: "UserOrders", type: "bit", nullable: false, oldClrType: typeof(int), oldType: "int"); } } }