using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Webshop.Infrastructure.Migrations { /// public partial class images : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "categories", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), Slug = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), ParentcategorieId = table.Column(type: "uuid", nullable: true), ImageUrl = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), IsActive = table.Column(type: "boolean", nullable: false), DisplayOrder = table.Column(type: "integer", nullable: false), CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), LastModifiedDate = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_categories", x => x.Id); table.ForeignKey( name: "FK_categories_categories_ParentcategorieId", column: x => x.ParentcategorieId, principalTable: "categories", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Discounts", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), DiscountType = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), DiscountValue = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), StartDate = table.Column(type: "timestamp with time zone", nullable: false), EndDate = table.Column(type: "timestamp with time zone", nullable: true), IsActive = table.Column(type: "boolean", nullable: false), RequiresCouponCode = table.Column(type: "boolean", nullable: false), CouponCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), MinimumOrderAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), MaximumUsageCount = table.Column(type: "integer", nullable: true), CurrentUsageCount = table.Column(type: "integer", nullable: false), Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Discounts", x => x.Id); }); migrationBuilder.CreateTable( name: "PaymentMethods", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), IsActive = table.Column(type: "boolean", nullable: false), PaymentGatewayType = table.Column(type: "integer", nullable: false), Configuration = table.Column(type: "jsonb", nullable: true), ProcessingFee = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true) }, constraints: table => { table.PrimaryKey("PK_PaymentMethods", x => x.Id); }); migrationBuilder.CreateTable( name: "Roles", columns: table => new { Id = table.Column(type: "text", nullable: false), Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), ConcurrencyStamp = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Roles", x => x.Id); }); migrationBuilder.CreateTable( name: "Settings", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Key = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Value = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), IsActive = table.Column(type: "boolean", nullable: false), Group = table.Column(type: "character varying(100)", maxLength: 100, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Settings", x => x.Id); }); migrationBuilder.CreateTable( name: "ShippingMethods", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), BaseCost = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), MinimumOrderAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), IsActive = table.Column(type: "boolean", nullable: false), EstimatedDeliveryTime = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), RequiresTracking = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ShippingMethods", x => x.Id); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "text", nullable: false), CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), LastActive = table.Column(type: "timestamp with time zone", nullable: true), UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), EmailConfirmed = table.Column(type: "boolean", nullable: false), PasswordHash = table.Column(type: "text", nullable: true), SecurityStamp = table.Column(type: "text", nullable: true), ConcurrencyStamp = table.Column(type: "text", nullable: true), PhoneNumber = table.Column(type: "text", nullable: true), PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), TwoFactorEnabled = table.Column(type: "boolean", nullable: false), LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), LockoutEnabled = table.Column(type: "boolean", nullable: false), AccessFailedCount = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); }); migrationBuilder.CreateTable( name: "categorieDiscounts", columns: table => new { categorieId = table.Column(type: "uuid", nullable: false), DiscountId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_categorieDiscounts", x => new { x.categorieId, x.DiscountId }); table.ForeignKey( name: "FK_categorieDiscounts_Discounts_DiscountId", column: x => x.DiscountId, principalTable: "Discounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_categorieDiscounts_categories_categorieId", column: x => x.categorieId, principalTable: "categories", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "RoleClaims", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), RoleId = table.Column(type: "text", nullable: false), ClaimType = table.Column(type: "text", nullable: true), ClaimValue = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_RoleClaims", x => x.Id); table.ForeignKey( name: "FK_RoleClaims_Roles_RoleId", column: x => x.RoleId, principalTable: "Roles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Customers", columns: table => new { Id = table.Column(type: "uuid", nullable: false), AspNetUserId = table.Column(type: "text", nullable: false), FirstName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), LastName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), DefaultShippingAddressId = table.Column(type: "uuid", nullable: true), DefaultBillingAddressId = table.Column(type: "uuid", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Customers", x => x.Id); table.ForeignKey( name: "FK_Customers_Users_AspNetUserId", column: x => x.AspNetUserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserClaims", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(type: "text", nullable: false), ClaimType = table.Column(type: "text", nullable: true), ClaimValue = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_UserClaims", x => x.Id); table.ForeignKey( name: "FK_UserClaims_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserLogins", columns: table => new { LoginProvider = table.Column(type: "text", nullable: false), ProviderKey = table.Column(type: "text", nullable: false), ProviderDisplayName = table.Column(type: "text", nullable: true), UserId = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserLogins", x => new { x.LoginProvider, x.ProviderKey }); table.ForeignKey( name: "FK_UserLogins_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserRoles", columns: table => new { UserId = table.Column(type: "text", nullable: false), RoleId = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId }); table.ForeignKey( name: "FK_UserRoles_Roles_RoleId", column: x => x.RoleId, principalTable: "Roles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UserRoles_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserTokens", columns: table => new { UserId = table.Column(type: "text", nullable: false), LoginProvider = table.Column(type: "text", nullable: false), Name = table.Column(type: "text", nullable: false), Value = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_UserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); table.ForeignKey( name: "FK_UserTokens_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Addresses", columns: table => new { Id = table.Column(type: "uuid", nullable: false), CustomerId = table.Column(type: "uuid", nullable: true), Street = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), HouseNumber = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), City = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), PostalCode = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), Country = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Type = table.Column(type: "integer", nullable: false), State = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), CompanyName = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), FirstName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), LastName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false) }, constraints: table => { table.PrimaryKey("PK_Addresses", x => x.Id); table.ForeignKey( name: "FK_Addresses_Customers_CustomerId", column: x => x.CustomerId, principalTable: "Customers", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Orders", columns: table => new { Id = table.Column(type: "uuid", nullable: false), OrderNumber = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), CustomerId = table.Column(type: "uuid", nullable: true), GuestEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), GuestPhoneNumber = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), OrderDate = table.Column(type: "timestamp with time zone", nullable: false), OrderStatus = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), OrderTotal = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), ShippingCost = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), TaxAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), DiscountAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), PaymentStatus = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), PaymentMethod = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), PaymentMethodId = table.Column(type: "uuid", nullable: true), ShippingMethodId = table.Column(type: "uuid", nullable: true), TransactionId = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), ShippingTrackingNumber = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), ShippedDate = table.Column(type: "timestamp with time zone", nullable: true), DeliveredDate = table.Column(type: "timestamp with time zone", nullable: true), BillingAddressId = table.Column(type: "uuid", nullable: false), ShippingAddressId = table.Column(type: "uuid", nullable: false), CustomerNotes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), AdminNotes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Orders", x => x.Id); table.ForeignKey( name: "FK_Orders_Addresses_BillingAddressId", column: x => x.BillingAddressId, principalTable: "Addresses", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Orders_Addresses_ShippingAddressId", column: x => x.ShippingAddressId, principalTable: "Addresses", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Orders_Customers_CustomerId", column: x => x.CustomerId, principalTable: "Customers", principalColumn: "Id"); table.ForeignKey( name: "FK_Orders_PaymentMethods_PaymentMethodId", column: x => x.PaymentMethodId, principalTable: "PaymentMethods", principalColumn: "Id"); table.ForeignKey( name: "FK_Orders_ShippingMethods_ShippingMethodId", column: x => x.ShippingMethodId, principalTable: "ShippingMethods", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Suppliers", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), ContactPerson = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), PhoneNumber = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), AddressId = table.Column(type: "uuid", nullable: true), Notes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Suppliers", x => x.Id); table.ForeignKey( name: "FK_Suppliers_Addresses_AddressId", column: x => x.AddressId, principalTable: "Addresses", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Products", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Description = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), ShortDescription = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), SKU = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), OldPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), IsActive = table.Column(type: "boolean", nullable: false), IsInStock = table.Column(type: "boolean", nullable: false), StockQuantity = table.Column(type: "integer", nullable: false), Weight = table.Column(type: "numeric(18,3)", precision: 18, scale: 3, nullable: true), Width = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), Height = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), Length = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), Slug = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), LastModifiedDate = table.Column(type: "timestamp with time zone", nullable: true), SupplierId = table.Column(type: "uuid", nullable: true), PurchasePrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Products", x => x.Id); table.ForeignKey( name: "FK_Products_Suppliers_SupplierId", column: x => x.SupplierId, principalTable: "Suppliers", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Productcategories", columns: table => new { ProductId = table.Column(type: "uuid", nullable: false), categorieId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Productcategories", x => new { x.ProductId, x.categorieId }); table.ForeignKey( name: "FK_Productcategories_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Productcategories_categories_categorieId", column: x => x.categorieId, principalTable: "categories", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ProductDiscounts", columns: table => new { ProductId = table.Column(type: "uuid", nullable: false), DiscountId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ProductDiscounts", x => new { x.ProductId, x.DiscountId }); table.ForeignKey( name: "FK_ProductDiscounts_Discounts_DiscountId", column: x => x.DiscountId, principalTable: "Discounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ProductDiscounts_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ProductImages", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Url = table.Column(type: "text", nullable: false), IsMainImage = table.Column(type: "boolean", nullable: false), DisplayOrder = table.Column(type: "integer", nullable: false), ProductId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ProductImages", x => x.Id); table.ForeignKey( name: "FK_ProductImages_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ProductVariants", columns: table => new { Id = table.Column(type: "uuid", nullable: false), ProductId = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Value = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), SKU = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), PriceAdjustment = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), StockQuantity = table.Column(type: "integer", nullable: false), ImageUrl = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), IsActive = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ProductVariants", x => x.Id); table.ForeignKey( name: "FK_ProductVariants_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Reviews", columns: table => new { Id = table.Column(type: "uuid", nullable: false), ProductId = table.Column(type: "uuid", nullable: false), CustomerId = table.Column(type: "uuid", nullable: true), Rating = table.Column(type: "integer", nullable: false), Title = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), Comment = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), ReviewDate = table.Column(type: "timestamp with time zone", nullable: false), IsApproved = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Reviews", x => x.Id); table.ForeignKey( name: "FK_Reviews_Customers_CustomerId", column: x => x.CustomerId, principalTable: "Customers", principalColumn: "Id"); table.ForeignKey( name: "FK_Reviews_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "OrderItems", columns: table => new { Id = table.Column(type: "uuid", nullable: false), OrderId = table.Column(type: "uuid", nullable: false), ProductId = table.Column(type: "uuid", nullable: true), ProductVariantId = table.Column(type: "uuid", nullable: true), ProductName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), ProductSKU = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Quantity = table.Column(type: "integer", nullable: false), UnitPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), TotalPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false) }, constraints: table => { table.PrimaryKey("PK_OrderItems", x => x.Id); table.ForeignKey( name: "FK_OrderItems_Orders_OrderId", column: x => x.OrderId, principalTable: "Orders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_OrderItems_ProductVariants_ProductVariantId", column: x => x.ProductVariantId, principalTable: "ProductVariants", principalColumn: "Id", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_OrderItems_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateIndex( name: "IX_Addresses_CustomerId", table: "Addresses", column: "CustomerId"); migrationBuilder.CreateIndex( name: "IX_categorieDiscounts_DiscountId", table: "categorieDiscounts", column: "DiscountId"); migrationBuilder.CreateIndex( name: "IX_categories_ParentcategorieId", table: "categories", column: "ParentcategorieId"); migrationBuilder.CreateIndex( name: "IX_categories_Slug", table: "categories", column: "Slug", unique: true); migrationBuilder.CreateIndex( name: "IX_Customers_AspNetUserId", table: "Customers", column: "AspNetUserId", unique: true); migrationBuilder.CreateIndex( name: "IX_Discounts_CouponCode", table: "Discounts", column: "CouponCode", unique: true, filter: "\"CouponCode\" IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_OrderItems_OrderId", table: "OrderItems", column: "OrderId"); migrationBuilder.CreateIndex( name: "IX_OrderItems_ProductId", table: "OrderItems", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_OrderItems_ProductVariantId", table: "OrderItems", column: "ProductVariantId"); migrationBuilder.CreateIndex( name: "IX_Orders_BillingAddressId", table: "Orders", column: "BillingAddressId"); migrationBuilder.CreateIndex( name: "IX_Orders_CustomerId", table: "Orders", column: "CustomerId"); migrationBuilder.CreateIndex( name: "IX_Orders_OrderNumber", table: "Orders", column: "OrderNumber", unique: true); migrationBuilder.CreateIndex( name: "IX_Orders_PaymentMethodId", table: "Orders", column: "PaymentMethodId"); migrationBuilder.CreateIndex( name: "IX_Orders_ShippingAddressId", table: "Orders", column: "ShippingAddressId"); migrationBuilder.CreateIndex( name: "IX_Orders_ShippingMethodId", table: "Orders", column: "ShippingMethodId"); migrationBuilder.CreateIndex( name: "IX_Productcategories_categorieId", table: "Productcategories", column: "categorieId"); migrationBuilder.CreateIndex( name: "IX_ProductDiscounts_DiscountId", table: "ProductDiscounts", column: "DiscountId"); migrationBuilder.CreateIndex( name: "IX_ProductImages_ProductId", table: "ProductImages", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_Products_SKU", table: "Products", column: "SKU", unique: true); migrationBuilder.CreateIndex( name: "IX_Products_Slug", table: "Products", column: "Slug", unique: true); migrationBuilder.CreateIndex( name: "IX_Products_SupplierId", table: "Products", column: "SupplierId"); migrationBuilder.CreateIndex( name: "IX_ProductVariants_ProductId", table: "ProductVariants", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_Reviews_CustomerId", table: "Reviews", column: "CustomerId"); migrationBuilder.CreateIndex( name: "IX_Reviews_ProductId", table: "Reviews", column: "ProductId"); migrationBuilder.CreateIndex( name: "IX_RoleClaims_RoleId", table: "RoleClaims", column: "RoleId"); migrationBuilder.CreateIndex( name: "RoleNameIndex", table: "Roles", column: "NormalizedName", unique: true); migrationBuilder.CreateIndex( name: "IX_Settings_Key", table: "Settings", column: "Key", unique: true); migrationBuilder.CreateIndex( name: "IX_Suppliers_AddressId", table: "Suppliers", column: "AddressId"); migrationBuilder.CreateIndex( name: "IX_UserClaims_UserId", table: "UserClaims", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_UserLogins_UserId", table: "UserLogins", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_UserRoles_RoleId", table: "UserRoles", column: "RoleId"); migrationBuilder.CreateIndex( name: "EmailIndex", table: "Users", column: "NormalizedEmail"); migrationBuilder.CreateIndex( name: "UserNameIndex", table: "Users", column: "NormalizedUserName", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "categorieDiscounts"); migrationBuilder.DropTable( name: "OrderItems"); migrationBuilder.DropTable( name: "Productcategories"); migrationBuilder.DropTable( name: "ProductDiscounts"); migrationBuilder.DropTable( name: "ProductImages"); migrationBuilder.DropTable( name: "Reviews"); migrationBuilder.DropTable( name: "RoleClaims"); migrationBuilder.DropTable( name: "Settings"); migrationBuilder.DropTable( name: "UserClaims"); migrationBuilder.DropTable( name: "UserLogins"); migrationBuilder.DropTable( name: "UserRoles"); migrationBuilder.DropTable( name: "UserTokens"); migrationBuilder.DropTable( name: "Orders"); migrationBuilder.DropTable( name: "ProductVariants"); migrationBuilder.DropTable( name: "categories"); migrationBuilder.DropTable( name: "Discounts"); migrationBuilder.DropTable( name: "Roles"); migrationBuilder.DropTable( name: "PaymentMethods"); migrationBuilder.DropTable( name: "ShippingMethods"); migrationBuilder.DropTable( name: "Products"); migrationBuilder.DropTable( name: "Suppliers"); migrationBuilder.DropTable( name: "Addresses"); migrationBuilder.DropTable( name: "Customers"); migrationBuilder.DropTable( name: "Users"); } } }