NUKE METADATA REQUIREMENTS (plus new migrations)

This commit is contained in:
lumijiez
2025-05-27 13:32:42 +03:00
parent a30ada5061
commit 6d2e8f7fc8
10 changed files with 45 additions and 3266 deletions

View File

@@ -9,6 +9,6 @@ public class CategoryDto
public int SortOrder { get; set; }
public bool IsActive { get; set; }
public Guid? ParentCategoryId { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; }
public DateTime? CreatedAt { get; set; }
public DateTime? ModifiedAt { get; set; }
}

View File

@@ -11,6 +11,6 @@ public class ProductDto
public string? ImageUrl { get; set; }
public Guid? CategoryId { get; set; }
public CategoryDto? Category { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; }
public DateTime? CreatedAt { get; set; }
public DateTime? ModifiedAt { get; set; }
}

View File

@@ -12,6 +12,6 @@ public class ProductVariantDto
public int StockQuantity { get; set; }
public bool IsActive { get; set; }
public ProductDto? Product { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; }
public DateTime? CreatedAt { get; set; }
public DateTime? ModifiedAt { get; set; }
}

View File

@@ -3,8 +3,8 @@ namespace Printbase.Domain.Entities;
public abstract class EntityBase
{
public Guid Id { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; }
public DateTime? CreatedAt { get; set; }
public DateTime? ModifiedAt { get; set; }
public string? CreatedBy { get; set; }
public string? ModifiedBy { get; set; }
}

View File

@@ -30,6 +30,18 @@ public class CategoryConfiguration : EntityBaseConfiguration<Category>
builder.Property(c => c.ParentCategoryId)
.IsRequired(false);
builder.Property(c => c.CreatedAt)
.IsRequired(false);
builder.Property(c => c.CreatedBy)
.IsRequired(false);
builder.Property(c => c.ModifiedAt)
.IsRequired(false);
builder.Property(c => c.ModifiedBy)
.IsRequired(false);
builder.HasOne(c => c.ParentCategory)
.WithMany(c => c.SubCategories)

View File

@@ -31,9 +31,21 @@ public class ProductConfiguration : EntityBaseConfiguration<Product>
builder.Property(p => p.ImageUrl)
.HasMaxLength(500);
builder.Property(p => p.CategoryId)
.IsRequired(false);
builder.Property(c => c.CreatedAt)
.IsRequired(false);
builder.Property(c => c.CreatedBy)
.IsRequired(false);
builder.Property(c => c.ModifiedAt)
.IsRequired(false);
builder.Property(c => c.ModifiedBy)
.IsRequired(false);
builder.HasOne(p => p.Category)
.WithMany(c => c.Products)

View File

@@ -37,6 +37,18 @@ public class ProductVariantConfiguration : EntityBaseConfiguration<ProductVarian
builder.Property(pv => pv.IsActive)
.IsRequired()
.HasDefaultValue(true);
builder.Property(c => c.CreatedAt)
.IsRequired(false);
builder.Property(c => c.CreatedBy)
.IsRequired(false);
builder.Property(c => c.ModifiedAt)
.IsRequired(false);
builder.Property(c => c.ModifiedBy)
.IsRequired(false);
builder.HasOne(pv => pv.Product)
.WithMany(p => p.ProductVariants)

View File

@@ -1,824 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Printbase.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class InitialSetup : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
FirstName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
LastName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
DateOfBirth = table.Column<DateTime>(type: "datetime2", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
LastLoginAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
ProfileImageUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Categories",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Description = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false),
ImageUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
SortOrder = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
ParentCategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Categories", x => x.Id);
table.ForeignKey(
name: "FK_Categories_Categories_ParentCategoryId",
column: x => x.ParentCategoryId,
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "OrderStatuses",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderStatuses", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ShippingStatuses",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ShippingStatuses", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Addresses",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
UserId = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
AddressType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Street = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
City = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
State = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
PostalCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
Country = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
IsDefault = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Addresses", x => x.Id);
table.ForeignKey(
name: "FK_Addresses_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Description = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
BasePrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
IsCustomizable = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
ImageUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
CategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.Id);
table.ForeignKey(
name: "FK_Products_Categories_CategoryId",
column: x => x.CategoryId,
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
UserId = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
OrderDate = table.Column<DateTime>(type: "datetime2", nullable: false),
TotalPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
OrderStatusId = table.Column<int>(type: "int", nullable: false),
ShippingStatusId = table.Column<int>(type: "int", nullable: false),
OrderNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Notes = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Orders", x => x.Id);
table.ForeignKey(
name: "FK_Orders_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Orders_OrderStatuses_OrderStatusId",
column: x => x.OrderStatusId,
principalTable: "OrderStatuses",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Orders_ShippingStatuses_ShippingStatusId",
column: x => x.ShippingStatusId,
principalTable: "ShippingStatuses",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ProductVariants",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
ProductId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Size = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Color = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
ImageUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
Sku = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
StockQuantity = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, 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: "OrderAddresses",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Street = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
City = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
State = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
PostalCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
Country = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderAddresses", x => x.Id);
table.ForeignKey(
name: "FK_OrderAddresses_Orders_OrderId",
column: x => x.OrderId,
principalTable: "Orders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OrderItems",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ProductId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ProductVariantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Quantity = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
TotalPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
CustomizationImageUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
CustomizationDescription = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(450)", maxLength: 450, 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.Restrict);
table.ForeignKey(
name: "FK_OrderItems_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "CreatedAt", "Description", "IsActive", "Name", "NormalizedName" },
values: new object[,]
{
{ "1", null, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Full system access", true, "Administrator", "ADMINISTRATOR" },
{ "2", null, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Standard customer access", true, "Customer", "CUSTOMER" },
{ "3", null, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Manage orders and fulfillment", true, "OrderManager", "ORDERMANAGER" },
{ "4", null, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Manage products and inventory", true, "ProductManager", "PRODUCTMANAGER" }
});
migrationBuilder.InsertData(
table: "Categories",
columns: new[] { "Id", "CreatedAt", "CreatedBy", "Description", "ImageUrl", "IsActive", "ModifiedAt", "ModifiedBy", "Name", "ParentCategoryId", "SortOrder" },
values: new object[,]
{
{ new Guid("11111111-1111-1111-1111-111111111111"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Textile and fabric-based products", null, true, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Textile", null, 1 },
{ new Guid("22222222-2222-2222-2222-222222222222"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Products for hard surface printing", null, true, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Hard Surfaces", null, 2 },
{ new Guid("33333333-3333-3333-3333-333333333333"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Paper-based printing products", null, true, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Paper", null, 3 }
});
migrationBuilder.InsertData(
table: "OrderStatuses",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ 0, "Pending" },
{ 1, "Processing" },
{ 2, "Completed" },
{ 3, "Cancelled" }
});
migrationBuilder.InsertData(
table: "ShippingStatuses",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ 0, "Prepping" },
{ 1, "Packaging" },
{ 2, "Shipped" },
{ 3, "Delivered" }
});
migrationBuilder.CreateIndex(
name: "IX_Address_CreatedAt",
table: "Addresses",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_Address_CreatedBy",
table: "Addresses",
column: "CreatedBy");
migrationBuilder.CreateIndex(
name: "IX_Address_ModifiedAt",
table: "Addresses",
column: "ModifiedAt");
migrationBuilder.CreateIndex(
name: "IX_Address_User_Default",
table: "Addresses",
columns: new[] { "UserId", "IsDefault" });
migrationBuilder.CreateIndex(
name: "IX_Address_User_Type",
table: "Addresses",
columns: new[] { "UserId", "AddressType" });
migrationBuilder.CreateIndex(
name: "IX_Address_UserId",
table: "Addresses",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_ApplicationRole_IsActive",
table: "AspNetRoles",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true,
filter: "[NormalizedName] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserLogins_UserId",
table: "AspNetUserLogins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true,
filter: "[NormalizedUserName] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Category_Active_SortOrder",
table: "Categories",
columns: new[] { "IsActive", "SortOrder" });
migrationBuilder.CreateIndex(
name: "IX_Category_CreatedAt",
table: "Categories",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_Category_CreatedBy",
table: "Categories",
column: "CreatedBy");
migrationBuilder.CreateIndex(
name: "IX_Category_IsActive",
table: "Categories",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_Category_ModifiedAt",
table: "Categories",
column: "ModifiedAt");
migrationBuilder.CreateIndex(
name: "IX_Category_Name",
table: "Categories",
column: "Name");
migrationBuilder.CreateIndex(
name: "IX_Category_Parent_SortOrder",
table: "Categories",
columns: new[] { "ParentCategoryId", "SortOrder" });
migrationBuilder.CreateIndex(
name: "IX_Category_ParentCategoryId",
table: "Categories",
column: "ParentCategoryId");
migrationBuilder.CreateIndex(
name: "IX_OrderAddress_CreatedAt",
table: "OrderAddresses",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_OrderAddress_CreatedBy",
table: "OrderAddresses",
column: "CreatedBy");
migrationBuilder.CreateIndex(
name: "IX_OrderAddress_ModifiedAt",
table: "OrderAddresses",
column: "ModifiedAt");
migrationBuilder.CreateIndex(
name: "IX_OrderAddress_OrderId",
table: "OrderAddresses",
column: "OrderId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_OrderItem_CreatedAt",
table: "OrderItems",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_OrderItem_CreatedBy",
table: "OrderItems",
column: "CreatedBy");
migrationBuilder.CreateIndex(
name: "IX_OrderItem_ModifiedAt",
table: "OrderItems",
column: "ModifiedAt");
migrationBuilder.CreateIndex(
name: "IX_OrderItem_Order_Product",
table: "OrderItems",
columns: new[] { "OrderId", "ProductId" });
migrationBuilder.CreateIndex(
name: "IX_OrderItem_OrderId",
table: "OrderItems",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_OrderItem_ProductId",
table: "OrderItems",
column: "ProductId");
migrationBuilder.CreateIndex(
name: "IX_OrderItem_ProductVariantId",
table: "OrderItems",
column: "ProductVariantId");
migrationBuilder.CreateIndex(
name: "IX_Order_CreatedAt",
table: "Orders",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_Order_CreatedBy",
table: "Orders",
column: "CreatedBy");
migrationBuilder.CreateIndex(
name: "IX_Order_ModifiedAt",
table: "Orders",
column: "ModifiedAt");
migrationBuilder.CreateIndex(
name: "IX_Order_OrderDate",
table: "Orders",
column: "OrderDate");
migrationBuilder.CreateIndex(
name: "IX_Order_OrderNumber",
table: "Orders",
column: "OrderNumber",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Order_OrderStatusId",
table: "Orders",
column: "OrderStatusId");
migrationBuilder.CreateIndex(
name: "IX_Order_ShippingStatusId",
table: "Orders",
column: "ShippingStatusId");
migrationBuilder.CreateIndex(
name: "IX_Order_User_Date",
table: "Orders",
columns: new[] { "UserId", "OrderDate" });
migrationBuilder.CreateIndex(
name: "IX_Order_UserId",
table: "Orders",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_OrderStatus_Name",
table: "OrderStatuses",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Product_Active_Customizable",
table: "Products",
columns: new[] { "IsActive", "IsCustomizable" });
migrationBuilder.CreateIndex(
name: "IX_Product_Category_Active",
table: "Products",
columns: new[] { "CategoryId", "IsActive" });
migrationBuilder.CreateIndex(
name: "IX_Product_CategoryId",
table: "Products",
column: "CategoryId");
migrationBuilder.CreateIndex(
name: "IX_Product_CreatedAt",
table: "Products",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_Product_CreatedBy",
table: "Products",
column: "CreatedBy");
migrationBuilder.CreateIndex(
name: "IX_Product_IsActive",
table: "Products",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_Product_IsCustomizable",
table: "Products",
column: "IsCustomizable");
migrationBuilder.CreateIndex(
name: "IX_Product_ModifiedAt",
table: "Products",
column: "ModifiedAt");
migrationBuilder.CreateIndex(
name: "IX_Product_Name",
table: "Products",
column: "Name");
migrationBuilder.CreateIndex(
name: "IX_ProductVariant_CreatedAt",
table: "ProductVariants",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_ProductVariant_CreatedBy",
table: "ProductVariants",
column: "CreatedBy");
migrationBuilder.CreateIndex(
name: "IX_ProductVariant_IsActive",
table: "ProductVariants",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_ProductVariant_ModifiedAt",
table: "ProductVariants",
column: "ModifiedAt");
migrationBuilder.CreateIndex(
name: "IX_ProductVariant_Product_Size_Color",
table: "ProductVariants",
columns: new[] { "ProductId", "Size", "Color" },
unique: true,
filter: "[Color] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_ProductVariant_ProductId",
table: "ProductVariants",
column: "ProductId");
migrationBuilder.CreateIndex(
name: "IX_ProductVariant_SKU",
table: "ProductVariants",
column: "Sku",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ShippingStatus_Name",
table: "ShippingStatuses",
column: "Name",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Addresses");
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
migrationBuilder.DropTable(
name: "AspNetUserClaims");
migrationBuilder.DropTable(
name: "AspNetUserLogins");
migrationBuilder.DropTable(
name: "AspNetUserRoles");
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "OrderAddresses");
migrationBuilder.DropTable(
name: "OrderItems");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "Orders");
migrationBuilder.DropTable(
name: "ProductVariants");
migrationBuilder.DropTable(
name: "AspNetUsers");
migrationBuilder.DropTable(
name: "OrderStatuses");
migrationBuilder.DropTable(
name: "ShippingStatuses");
migrationBuilder.DropTable(
name: "Products");
migrationBuilder.DropTable(
name: "Categories");
}
}
}