From 148475fa436ca6efa50ccc1dcf5118e502c4d05a Mon Sep 17 00:00:00 2001 From: MSuMshk <2039814060@qq.com> Date: Tue, 2 Dec 2025 09:04:37 +0800 Subject: [PATCH] feat: migrate snowflake ids and refresh migrations --- AGENTS.md | 150 + Document/10_设计期DbContext配置指引.md | 42 + Document/11_SystemTodo.md | 92 +- Document/12_BusinessTodo.md | 89 +- Document/13_AppSeed说明.md | 52 + .../Controllers/AuthController.cs | 2 +- .../Controllers/DictionaryController.cs | 20 +- .../Controllers/MerchantsController.cs | 72 + src/Api/TakeoutSaaS.AdminApi/Program.cs | 4 + .../TakeoutSaaS.AdminApi.csproj | 4 + .../appsettings.Development.json | 34 + .../Controllers/MeController.cs | 2 +- ...pApplicationServiceCollectionExtensions.cs | 23 + .../Commands/CreateMerchantCommand.cs | 53 + .../App/Merchants/Dto/MerchantDto.cs | 63 + .../Handlers/CreateMerchantCommandHandler.cs | 54 + .../Handlers/GetMerchantByIdQueryHandler.cs | 42 + .../Handlers/SearchMerchantsQueryHandler.cs | 42 + .../Merchants/Queries/GetMerchantByIdQuery.cs | 15 + .../Merchants/Queries/SearchMerchantsQuery.cs | 16 + .../Abstractions/IDictionaryAppService.cs | 8 +- .../Abstractions/IDictionaryCache.cs | 6 +- .../Contracts/CreateDictionaryItemRequest.cs | 5 +- .../Dictionary/Models/DictionaryGroupDto.cs | 6 +- .../Dictionary/Models/DictionaryItemDto.cs | 9 +- .../Services/DictionaryAppService.cs | 38 +- .../Abstractions/IAdminAuthService.cs | 2 +- .../Identity/Abstractions/IMiniAuthService.cs | 2 +- .../Abstractions/IRefreshTokenStore.cs | 2 +- .../Identity/Contracts/CurrentUserProfile.cs | 6 +- .../Identity/Models/RefreshTokenDescriptor.cs | 2 +- .../Identity/Services/AdminAuthService.cs | 2 +- .../Identity/Services/MiniAuthService.cs | 6 +- .../Messaging/Events/OrderCreatedEvent.cs | 4 +- .../Messaging/Events/PaymentSucceededEvent.cs | 4 +- .../Sms/Services/VerificationCodeService.cs | 4 +- .../Storage/Services/FileStorageService.cs | 2 +- .../TakeoutSaaS.Application.csproj | 1 + .../Entities/AuditableEntityBase.cs | 6 +- .../Entities/EntityBase.cs | 2 +- .../Entities/IAuditableEntity.cs | 6 +- .../Entities/IMultiTenantEntity.cs | 2 +- .../Entities/MultiTenantEntityBase.cs | 2 +- .../Ids/IIdGenerator.cs | 13 + .../Ids/IdGeneratorOptions.cs | 26 + .../Results/ApiResponse.cs | 61 +- .../Security/ICurrentUserAccessor.cs | 2 +- .../Serialization/SnowflakeIdJsonConverter.cs | 52 + .../Tenancy/ITenantProvider.cs | 2 +- .../Tenancy/TenantContext.cs | 8 +- .../Ids/SnowflakeIdGenerator.cs | 111 + .../Middleware/CorrelationIdMiddleware.cs | 9 +- .../Security/ClaimsPrincipalExtensions.cs | 10 +- .../HttpContextCurrentUserAccessor.cs | 8 +- .../Analytics/Entities/MetricAlertRule.cs | 2 +- .../Analytics/Entities/MetricSnapshot.cs | 2 +- .../Coupons/Entities/Coupon.cs | 6 +- .../CustomerService/Entities/ChatMessage.cs | 4 +- .../CustomerService/Entities/ChatSession.cs | 6 +- .../CustomerService/Entities/SupportTicket.cs | 6 +- .../CustomerService/Entities/TicketComment.cs | 4 +- .../Deliveries/Entities/DeliveryEvent.cs | 2 +- .../Deliveries/Entities/DeliveryOrder.cs | 2 +- .../Repositories/IDeliveryRepository.cs | 42 + .../Dictionary/Entities/DictionaryItem.cs | 2 +- .../Repositories/IDictionaryRepository.cs | 8 +- .../Distribution/Entities/AffiliateOrder.cs | 6 +- .../Distribution/Entities/AffiliatePartner.cs | 2 +- .../Distribution/Entities/AffiliatePayout.cs | 2 +- .../Engagement/Entities/CheckInRecord.cs | 4 +- .../Engagement/Entities/CommunityComment.cs | 6 +- .../Engagement/Entities/CommunityPost.cs | 2 +- .../Engagement/Entities/CommunityReaction.cs | 4 +- .../GroupBuying/Entities/GroupOrder.cs | 6 +- .../GroupBuying/Entities/GroupParticipant.cs | 6 +- .../Identity/Entities/IdentityUser.cs | 2 +- .../Repositories/IIdentityUserRepository.cs | 2 +- .../Repositories/IMiniUserRepository.cs | 4 +- .../Inventory/Entities/InventoryAdjustment.cs | 4 +- .../Inventory/Entities/InventoryBatch.cs | 4 +- .../Inventory/Entities/InventoryItem.cs | 4 +- .../Membership/Entities/MemberGrowthLog.cs | 2 +- .../Membership/Entities/MemberPointLedger.cs | 4 +- .../Membership/Entities/MemberProfile.cs | 4 +- .../Merchants/Entities/MerchantContract.cs | 2 +- .../Merchants/Entities/MerchantDocument.cs | 2 +- .../Merchants/Entities/MerchantStaff.cs | 6 +- .../Repositories/IMerchantRepository.cs | 63 + .../Navigation/Entities/MapLocation.cs | 2 +- .../Navigation/Entities/NavigationRequest.cs | 4 +- .../Ordering/Entities/CartItem.cs | 6 +- .../Ordering/Entities/CartItemAddon.cs | 4 +- .../Ordering/Entities/CheckoutSession.cs | 4 +- .../Ordering/Entities/ShoppingCart.cs | 4 +- .../Orders/Entities/Order.cs | 4 +- .../Orders/Entities/OrderItem.cs | 4 +- .../Orders/Entities/OrderStatusHistory.cs | 4 +- .../Orders/Entities/RefundRequest.cs | 2 +- .../Orders/Repositories/IOrderRepository.cs | 69 + .../Payments/Entities/PaymentRecord.cs | 2 +- .../Payments/Entities/PaymentRefundRecord.cs | 4 +- .../Repositories/IPaymentRepository.cs | 42 + .../Products/Entities/Product.cs | 4 +- .../Products/Entities/ProductAddonGroup.cs | 2 +- .../Products/Entities/ProductAddonOption.cs | 2 +- .../Entities/ProductAttributeGroup.cs | 7 +- .../Entities/ProductAttributeOption.cs | 2 +- .../Products/Entities/ProductCategory.cs | 2 +- .../Products/Entities/ProductMediaAsset.cs | 2 +- .../Products/Entities/ProductPricingRule.cs | 7 +- .../Products/Entities/ProductSku.cs | 7 +- .../Repositories/IProductRepository.cs | 103 + .../Queues/Entities/QueueTicket.cs | 2 +- .../Reservations/Entities/Reservation.cs | 2 +- .../Stores/Entities/Store.cs | 2 +- .../Stores/Entities/StoreBusinessHour.cs | 2 +- .../Stores/Entities/StoreDeliveryZone.cs | 7 +- .../Stores/Entities/StoreEmployeeShift.cs | 4 +- .../Stores/Entities/StoreHoliday.cs | 2 +- .../Stores/Entities/StoreTable.cs | 4 +- .../Stores/Entities/StoreTableArea.cs | 7 +- .../Stores/Repositories/IStoreRepository.cs | 93 + .../Tenants/Entities/Tenant.cs | 2 +- .../Tenants/Entities/TenantSubscription.cs | 4 +- .../AppServiceCollectionExtensions.cs | 48 + .../20251201044927_InitialApp.Designer.cs | 949 - .../Migrations/20251201044927_InitialApp.cs | 497 - ...51201055852_ExpandDomainSchema.Designer.cs | 4330 --- .../20251201055852_ExpandDomainSchema.cs | 2206 -- .../20251201094254_AddEntityComments.cs | 22401 ---------------- .../App/Options/AppSeedOptions.cs | 29 + .../App/Options/DictionarySeedGroupOptions.cs | 51 + .../App/Options/DictionarySeedItemOptions.cs | 39 + .../App/Options/TenantSeedOptions.cs | 46 + .../App/Persistence/AppDataSeeder.cs | 301 + .../App/Persistence/TakeoutAppDbContext.cs | 6 +- .../App/Repositories/EfDeliveryRepository.cs | 71 + .../App/Repositories/EfMerchantRepository.cs | 116 + .../App/Repositories/EfOrderRepository.cs | 133 + .../App/Repositories/EfPaymentRepository.cs | 71 + .../App/Repositories/EfProductRepository.cs | 227 + .../App/Repositories/EfStoreRepository.cs | 174 + .../DatabaseServiceCollectionExtensions.cs | 13 + .../Common/Persistence/AppDbContext.cs | 38 +- .../DesignTimeDbContextFactoryBase.cs | 4 +- .../Persistence/TenantAwareDbContext.cs | 8 +- ...251201042346_InitialDictionary.Designer.cs | 172 - .../20251201042346_InitialDictionary.cs | 101 - .../20251201094456_AddEntityComments.cs | 599 - .../Persistence/DictionaryDbContext.cs | 6 +- .../Repositories/EfDictionaryRepository.cs | 10 +- .../Services/DistributedDictionaryCache.cs | 10 +- ...20251201042324_InitialIdentity.Designer.cs | 152 - .../20251201042324_InitialIdentity.cs | 94 - .../20251201094410_AddEntityComments.cs | 581 - .../Identity/Options/AdminSeedOptions.cs | 4 +- .../Persistence/EfIdentityUserRepository.cs | 2 +- .../Persistence/EfMiniUserRepository.cs | 6 +- .../Persistence/IdentityDataSeeder.cs | 4 +- .../Identity/Persistence/IdentityDbContext.cs | 6 +- .../Services/RedisRefreshTokenStore.cs | 2 +- ...51202005208_InitSnowflake_App.Designer.cs} | 1928 +- .../20251202005208_InitSnowflake_App.cs | 2550 ++ ...5247_InitSnowflake_Dictionary.Designer.cs} | 54 +- ...20251202005247_InitSnowflake_Dictionary.cs | 106 + .../DictionaryDbContextModelSnapshot.cs | 50 +- ...005226_InitSnowflake_Identity.Designer.cs} | 54 +- .../20251202005226_InitSnowflake_Identity.cs | 99 + .../IdentityDbContextModelSnapshot.cs | 50 +- .../TakeoutAppDbContextModelSnapshot.cs | 1924 +- .../TakeoutSaaS.Infrastructure.csproj | 1 + .../TenantProvider.cs | 4 +- .../TenantResolutionMiddleware.cs | 8 +- .../TenantResolutionOptions.cs | 12 +- 174 files changed, 8020 insertions(+), 34278 deletions(-) create mode 100644 AGENTS.md create mode 100644 Document/13_AppSeed说明.md create mode 100644 src/Api/TakeoutSaaS.AdminApi/Controllers/MerchantsController.cs create mode 100644 src/Application/TakeoutSaaS.Application/App/Extensions/AppApplicationServiceCollectionExtensions.cs create mode 100644 src/Application/TakeoutSaaS.Application/App/Merchants/Commands/CreateMerchantCommand.cs create mode 100644 src/Application/TakeoutSaaS.Application/App/Merchants/Dto/MerchantDto.cs create mode 100644 src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/CreateMerchantCommandHandler.cs create mode 100644 src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/GetMerchantByIdQueryHandler.cs create mode 100644 src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/SearchMerchantsQueryHandler.cs create mode 100644 src/Application/TakeoutSaaS.Application/App/Merchants/Queries/GetMerchantByIdQuery.cs create mode 100644 src/Application/TakeoutSaaS.Application/App/Merchants/Queries/SearchMerchantsQuery.cs create mode 100644 src/Core/TakeoutSaaS.Shared.Abstractions/Ids/IIdGenerator.cs create mode 100644 src/Core/TakeoutSaaS.Shared.Abstractions/Ids/IdGeneratorOptions.cs create mode 100644 src/Core/TakeoutSaaS.Shared.Abstractions/Serialization/SnowflakeIdJsonConverter.cs create mode 100644 src/Core/TakeoutSaaS.Shared.Kernel/Ids/SnowflakeIdGenerator.cs create mode 100644 src/Domain/TakeoutSaaS.Domain/Deliveries/Repositories/IDeliveryRepository.cs create mode 100644 src/Domain/TakeoutSaaS.Domain/Merchants/Repositories/IMerchantRepository.cs create mode 100644 src/Domain/TakeoutSaaS.Domain/Orders/Repositories/IOrderRepository.cs create mode 100644 src/Domain/TakeoutSaaS.Domain/Payments/Repositories/IPaymentRepository.cs create mode 100644 src/Domain/TakeoutSaaS.Domain/Products/Repositories/IProductRepository.cs create mode 100644 src/Domain/TakeoutSaaS.Domain/Stores/Repositories/IStoreRepository.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Extensions/AppServiceCollectionExtensions.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201044927_InitialApp.Designer.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201044927_InitialApp.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201055852_ExpandDomainSchema.Designer.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201055852_ExpandDomainSchema.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201094254_AddEntityComments.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/AppSeedOptions.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/DictionarySeedGroupOptions.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/DictionarySeedItemOptions.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/TenantSeedOptions.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/AppDataSeeder.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfDeliveryRepository.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfMerchantRepository.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfOrderRepository.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfPaymentRepository.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfProductRepository.cs create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfStoreRepository.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201042346_InitialDictionary.Designer.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201042346_InitialDictionary.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201094456_AddEntityComments.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201042324_InitialIdentity.Designer.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201042324_InitialIdentity.cs delete mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201094410_AddEntityComments.cs rename src/Infrastructure/TakeoutSaaS.Infrastructure/{App/Migrations/20251201094254_AddEntityComments.Designer.cs => Migrations/20251202005208_InitSnowflake_App.Designer.cs} (79%) create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20251202005208_InitSnowflake_App.cs rename src/Infrastructure/TakeoutSaaS.Infrastructure/{Dictionary/Migrations/20251201094456_AddEntityComments.Designer.cs => Migrations/DictionaryDb/20251202005247_InitSnowflake_Dictionary.Designer.cs} (83%) create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/20251202005247_InitSnowflake_Dictionary.cs rename src/Infrastructure/TakeoutSaaS.Infrastructure/{Dictionary/Migrations => Migrations/DictionaryDb}/DictionaryDbContextModelSnapshot.cs (84%) rename src/Infrastructure/TakeoutSaaS.Infrastructure/{Identity/Migrations/20251201094410_AddEntityComments.Designer.cs => Migrations/IdentityDb/20251202005226_InitSnowflake_Identity.Designer.cs} (81%) create mode 100644 src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20251202005226_InitSnowflake_Identity.cs rename src/Infrastructure/TakeoutSaaS.Infrastructure/{Identity/Migrations => Migrations/IdentityDb}/IdentityDbContextModelSnapshot.cs (82%) rename src/Infrastructure/TakeoutSaaS.Infrastructure/{App => }/Migrations/TakeoutAppDbContextModelSnapshot.cs (79%) diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..6ff2f4f --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,150 @@ +# Repository expectations +# 编程规范_FOR_AI(TakeoutSaaS) - 终极完全体 + +> **核心指令**:你是一个高级 .NET 架构师。本文件是你生成代码的最高宪法。当用户需求与本规范冲突时,请先提示用户,除非用户强制要求覆盖。 + +## 0. AI 交互核心约束 (元规则) +1. **语言**:必须使用**中文**回复和编写注释。 +2. **文件完整性**: + * **严禁**随意删除现有代码逻辑。 + * **严禁**修改文件编码(保持 UTF-8 无 BOM)。 + * PowerShell 读取命令必须带 `-Encoding UTF8`。 +3. **Git 原子性**:每个独立的功能点或 Bug 修复完成后,必须提示用户进行 Git 提交。 +4. **无乱码承诺**:确保所有输出(控制台、日志、API响应)无乱码。 +5. **不确定的处理**:如果你通过上下文找不到某些配置(如数据库连接串格式),**请直接询问用户**,不要瞎编。 + +## 1. 技术栈详细版本 +| 组件 | 版本/选型 | 用途说明 | +| :--- | :--- | :--- | +| **Runtime** | .NET 10 | 核心运行时 | +| **API** | ASP.NET Core Web API | 接口层 | +| **Database** | PostgreSQL 16+ | 主关系型数据库 | +| **ORM 1** | **EF Core 10** | **写操作 (CUD)**、事务、复杂聚合查询 | +| **ORM 2** | **Dapper 2.1+** | **纯读操作 (R)**、复杂报表、大批量查询 | +| **Cache** | Redis 7.0+ | 分布式缓存、Session | +| **MQ** | RabbitMQ 3.12+ | 异步解耦 (MassTransit) | +| **Libs** | MediatR, Serilog, FluentValidation | CQRS, 日志, 验证 | + +## 2. 命名与风格 (严格匹配) +* **C# 代码**: + * 类/接口/方法/属性:`PascalCase` (如 `OrderService`) + * **布尔属性**:必须加 `Is` 或 `Has` 前缀 (如 `IsDeleted`, `HasPayment`) + * 私有字段:`_camelCase` (如 `_orderRepository`) + * 参数/变量:`camelCase` (如 `orderId`) +* **PostgreSQL 数据库**: + * 表名:`snake_case` + **复数** (如 `merchant_orders`) + * 列名:`snake_case` (如 `order_no`, `is_active`) + * 主键:`id` (类型 `bigint`) +* **文件规则**: + * **一个文件一个类**。文件名必须与类名完全一致。 + +## 3. 分层架构 (Clean Architecture) +**你生成的代码必须严格归类到以下目录:** +* **`src/Api`**: 仅负责路由与 DTO 转换,**禁止**包含业务逻辑。 +* **`src/Application`**: 业务编排层。必须使用 **CQRS** (`IRequestHandler`) 和 **Mediator**。 +* **`src/Domain`**: 核心领域层。包含实体、枚举、领域异常。**禁止**依赖 EF Core 等外部库。 +* **`src/Infrastructure`**: 基础设施层。实现仓储、数据库上下文、第三方服务。 + +## 4. 注释与文档 +* **强制 XML 注释**:所有 `public` 的类、方法、属性必须有 ``。 +* **步骤注释**:超过 5 行的业务逻辑,必须分步注释: + ```csharp + // 1. 验证库存 + // 2. 扣减余额 + ``` +* **Swagger**:必须开启 JWT 鉴权按钮,Request/Response 示例必须清晰。 + +## 5. 异常处理 (防御性编程) +* **禁止空 Catch**:严禁 `catch (Exception) {}`,必须记录日志或抛出。 +* **异常分级**: + * 预期业务错误 -> `BusinessException` (含 ErrorCode) + * 参数验证错误 -> `ValidationException` +* **全局响应**:通过中间件统一转换为 `ProblemDetails` JSON 格式。 + +## 6. 异步与日志 +* **全异步**:所有 I/O 操作必须 `await`。**严禁** `.Result` 或 `.Wait()`。 +* **结构化日志**: + * ❌ `_logger.LogInfo("订单 " + id + " 创建成功");` + * ✅ `_logger.LogInformation("订单 {OrderId} 创建成功", id);` +* **脱敏**:严禁打印密码、密钥、支付凭证等敏感信息。 + +## 7. 依赖注入 (DI) +* **构造函数注入**:统一使用构造函数注入。 +* **禁止项**: + * ❌ 禁止使用 `[Inject]` 属性注入。 + * ❌ 禁止使用 `ServiceLocator` (服务定位器模式)。 + * ❌ 禁止在静态类中持有 ServiceProvider。 + +## 8. 数据访问规范 (重点执行) +### 8.1 Entity Framework Core (写/事务) +1. **无跟踪查询**:只读查询**必须**加 `.AsNoTracking()`。 +2. **杜绝 N+1**:严禁在 `foreach` 循环中查询数据库。必须使用 `.Include()`。 +3. **复杂查询**:关联表超过 2 层时,考虑使用 `.AsSplitQuery()`。 + +### 8.2 Dapper (读/报表) +1. **SQL 注入防御**:**严禁**拼接 SQL 字符串。必须使用参数化查询 (`@Param`)。 +2. **字段映射**:注意 PostgreSQL (`snake_case`) 与 C# (`PascalCase`) 的映射配置。 + +## 9. 多租户与 ID 策略 +* **ID 生成**: + * **强制**使用 **雪花算法 (Snowflake ID)**。 + * 类型:C# `long` <-> DB `bigint`。 + * **禁止**使用 UUID 或 自增 INT。 +* **租户隔离**: + * 所有业务表必须包含 `tenant_id`。 + * 写入时自动填充,读取时强制过滤。 + +## 10. API 设计与序列化 (前端兼容) +* **大整数处理**: + * 所有 `long` 类型 (Snowflake ID) 在 DTO 中**必须序列化为 string**。 + * 方案:DTO 属性加 `[JsonConverter(typeof(ToStringJsonConverter))]` 或全局配置。 +* **DTO 规范**: + * 输入:`XxxRequest` + * 输出:`XxxDto` + * **禁止** Controller 直接返回 Entity。 + +## 11. 模块化与复用 +* **核心模块划分**:Identity (身份), Tenancy (租户), Dictionary (字典), Storage (存储)。 +* **公共库 (Shared)**:通用工具类、扩展方法、常量定义必须放在 `Core/Shared` 项目中,避免重复造轮子。 + +## 12. 测试规范 +* **模式**:Arrange-Act-Assert (AAA)。 +* **工具**:xUnit + Moq + FluentAssertions。 +* **覆盖率**:核心 Domain 逻辑必须 100% 覆盖;Service 层 ≥ 70%。 + +## 13. Git 工作流 +* **提交格式 (Conventional Commits)**: + * `feat`: 新功能 + * `fix`: 修复 Bug + * `refactor`: 重构 + * `docs`: 文档 + * `style`: 格式调整 +* **分支规范**:`feature/功能名`,`bugfix/问题描述`。 + +## 14. 性能优化 (显式指令) +* **投影查询**:使用 `.Select(x => new Dto { ... })` 只查询需要的字段,减少 I/O。 +* **缓存策略**:Cache-Aside 模式。数据更新后必须立即失效缓存。 +* **批量操作**: + * EF Core 10:使用 `ExecuteUpdateAsync` / `ExecuteDeleteAsync`。 + * Dapper:使用 `ExecuteAsync` 进行批量插入。 + +## 15. 安全规范 +* **SQL 注入**:已在第 8 条强制参数化。 +* **身份认证**:Admin 端使用 JWT + RBAC;小程序端使用 Session/Token。 +* **密码存储**:必须使用 PBKDF2 或 BCrypt 加盐哈希。 + +## 16. 绝对禁止事项 (AI 自检清单) +**生成代码前,请自查是否违反以下红线:** +1. [ ] **SQL 注入**:是否拼接了 SQL 字符串? +2. [ ] **架构违规**:是否在 Controller/Domain 中使用了 DbContext? +3. [ ] **数据泄露**:是否返回了 Entity 或打印了密码? +4. [ ] **同步阻塞**:是否使用了 `.Result` 或 `.Wait()`? +5. [ ] **性能陷阱**:是否在循环中查询了数据库 (N+1)? +6. [ ] **精度丢失**:Long 类型的 ID 是否转为了 String? +7. [ ] **配置硬编码**:是否直接写死了连接串或密钥? + +--- + + +# Working agreements +- 严格遵循上述技术栈和命名规范。 \ No newline at end of file diff --git a/Document/10_设计期DbContext配置指引.md b/Document/10_设计期DbContext配置指引.md index 5baba69..2da0fd9 100644 --- a/Document/10_设计期DbContext配置指引.md +++ b/Document/10_设计期DbContext配置指引.md @@ -2,6 +2,48 @@ > 目的:在执行 `dotnet ef` 命令时无需硬编码数据库连接,可根据 appsettings 与环境变量自动加载。本文覆盖环境变量设置、配置目录指定等细节。 +## 三库迁移命令 只需更改 SnowflakeIds_App 迁移关键字 +> 先生成迁移,再执行数据库更新。启动项目统一用 AdminApi 确保加载最新配置。 + +### 生成迁移 +```bash +# App 主库 +dotnet tool run dotnet-ef migrations add SnowflakeIds_App ` + --project src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj ` + --startup-project src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj ` + --context TakeoutSaaS.Infrastructure.App.Persistence.TakeoutAppDbContext + +# Identity 库 +dotnet tool run dotnet-ef migrations add SnowflakeIds_Identity ` + --project src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj ` + --startup-project src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj ` + --context TakeoutSaaS.Infrastructure.Identity.Persistence.IdentityDbContext + +# Dictionary 库 +dotnet tool run dotnet-ef migrations add SnowflakeIds_Dictionary ` + --project src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj ` + --startup-project src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj ` + --context TakeoutSaaS.Infrastructure.Dictionary.Persistence.DictionaryDbContext +``` + +### 更新数据库 +```bash +dotnet tool run dotnet-ef database update ` + --project src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj ` + --startup-project src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj ` + --context TakeoutSaaS.Infrastructure.App.Persistence.TakeoutAppDbContext + +dotnet tool run dotnet-ef database update ` + --project src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj ` + --startup-project src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj ` + --context TakeoutSaaS.Infrastructure.Identity.Persistence.IdentityDbContext + +dotnet tool run dotnet-ef database update ` + --project src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj ` + --startup-project src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj ` + --context TakeoutSaaS.Infrastructure.Dictionary.Persistence.DictionaryDbContext +``` + ## 一、设计时工厂读取逻辑概述 设计时工厂(`DesignTimeDbContextFactoryBase`)按下面顺序解析连接串: 1. 若设置了 `TAKEOUTSAAS_APP_CONNECTION` / `TAKEOUTSAAS_IDENTITY_CONNECTION` / `TAKEOUTSAAS_DICTIONARY_CONNECTION` 等环境变量,则优先使用。 diff --git a/Document/11_SystemTodo.md b/Document/11_SystemTodo.md index d6e5114..f715bbc 100644 --- a/Document/11_SystemTodo.md +++ b/Document/11_SystemTodo.md @@ -1,57 +1,57 @@ -# System-Level TODOs +# TODO Roadmap -> Infrastructure / platform backlog migrated from the former 11th document. Unless noted explicitly, all checklist items remain pending. +> 当前列表为原 11 号文档中的待办事项,已迁移到此处并统一以复选框形式标记。若无特殊说明,均尚未完成。 -## 1. 閰嶇疆涓庡熀纭€璁炬柦锛堥珮浼橈級 -- [x] Development/Production 鏁版嵁搴撹繛鎺ヤ笌 Secret 钀藉湴锛圫taging 鏆備笉闇€瑕侊級銆? -- [x] Redis 鏈嶅姟閮ㄧ讲瀹屾瘯骞惰褰曢厤缃€? -- [x] RabbitMQ 鏈嶅姟閮ㄧ讲瀹屾瘯骞惰褰曢厤缃€? -- [x] COS 瀵嗛挜閰嶇疆琛ュ綍瀹屾瘯銆? -- [ ] OSS 瀵嗛挜閰嶇疆琛ュ綍瀹屾瘯锛堝緟閲囪喘锛夈€? -- [ ] SMS 骞冲彴瀵嗛挜閰嶇疆琛ュ綍瀹屾瘯锛堝緟閲囪喘锛夈€? -- [x] WeChat Mini 绋嬪簭瀵嗛挜閰嶇疆琛ュ綍瀹屾瘯锛圓ppID锛歸x30f91e6afe79f405锛孉ppSecret锛?4324a7f604245301066ba7c3add488e锛屽凡鍚屾鍒?admin/mini 閰嶇疆骞剁櫥璁版洿鏂颁汉锛夈€? -- [x] PostgreSQL 鍩虹瀹炰緥閮ㄧ讲瀹屾瘯骞惰褰曢厤缃€? -- [x] Postgres/Redis 鎺ュ叆鏂囨。 + IaC/鑴氭湰琛ラ綈锛堣 Document/infra/postgres_redis.md 涓?deploy/postgres|redis锛夈€? +## 1. 配置与基础设施(高优) +- [x] Development/Production 数据库连接与 Secret 落地(Staging 暂不需要)。 +- [x] Redis 服务部署完毕并记录配置。 +- [x] RabbitMQ 服务部署完毕并记录配置。 +- [x] COS 密钥配置补录完毕。 +- [ ] OSS 密钥配置补录完毕(已忽略,待采购后再补录)。 +- [ ] SMS 平台密钥配置补录完毕(已忽略,待采购后再补录)。 +- [x] WeChat Mini 程序密钥配置补录完毕(AppID:wx30f91e6afe79f405,AppSecret:64324a7f604245301066ba7c3add488e,已同步到 admin/mini 配置并登记更新人)。 +- [x] PostgreSQL 基础实例部署完毕并记录配置。 +- [x] Postgres/Redis 接入文档 + IaC/脚本补齐(见 Document/infra/postgres_redis.md 与 deploy/postgres|redis)。 - [x] RabbitMQ/Redis/Hangfire storage scripts available (see deploy/postgres and deploy/redis). -- [ ] admin/mini/user/gateway 缃戝叧鍩熷悕銆佽瘉涔︺€丆ORS 鍒楄〃鏁寸悊瀹屾垚銆? -- [ ] Hangfire Dashboard 鍚敤骞舵柊澧?Admin 瑙掕壊楠岃瘉/缃戝叧鐧藉悕鍗曘€? +- [ ] admin/mini/user/gateway 网关域名、证书、CORS 列表整理完成。(忽略,暂时不用完成) +- [ ] Hangfire Dashboard 启用并新增 Admin 角色验证/网关白名单。(忽略,暂时不用完成) -## 2. 鏁版嵁涓庤縼绉伙紙楂樹紭锛? -- [x] App/Identity/Dictionary/Hangfire 鍥涗釜 DbContext 鍧囩敓鎴愬垵濮?Migration 骞舵垚鍔?update database銆? -- [ ] 鍟嗘埛/闂ㄥ簵/鍟嗗搧/璁㈠崟/鏀粯/閰嶉€佺瓑瀹炰綋涓庝粨鍌ㄥ疄鐜板畬鎴愶紝鎻愪緵 CRUD + 鏌ヨ銆? -- [ ] 绯荤粺鍙傛暟銆侀粯璁ょ鎴枫€佺鐞嗗憳璐﹀彿銆佸熀纭€瀛楀吀鐨勭瀛愯剼鏈彲閲嶅鎵ц銆? +## 2. 数据与迁移(高优) +- [x] App/Identity/Dictionary/Hangfire 四个 DbContext 均生成初始 Migration 并成功 update database。 +- [ ] 商户/门店/商品/订单/支付/配送等实体与仓储实现完成,提供 CRUD + 查询。 +- [ ] 系统参数、默认租户、管理员账号、基础字典的种子脚本可重复执行。 -## 3. 绋冲畾鎬т笌璐ㄩ噺 -- [ ] Dictionary/Identity/Storage/Sms/Messaging/Scheduler 鐨?xUnit+FluentAssertions 鍗曞厓娴嬭瘯妗嗘灦鎼缓銆? -- [ ] WebApplicationFactory + Testcontainers 鎷夎捣 Postgres/Redis/RabbitMQ/MinIO 鐨勯泦鎴愭祴璇曟ā鏉裤€? -- [ ] .editorconfig銆?globalconfig銆丷oslyn 鍒嗘瀽鍣ㄩ厤缃粨搴撻€氱敤瑙勫垯骞跺惎鐢?CI 妫€鏌ャ€? +## 3. 稳定性与质量 +- [ ] Dictionary/Identity/Storage/Sms/Messaging/Scheduler 的 xUnit+FluentAssertions 单元测试框架搭建。 +- [ ] WebApplicationFactory + Testcontainers 拉起 Postgres/Redis/RabbitMQ/MinIO 的集成测试模板。 +- [ ] .editorconfig、.globalconfig、Roslyn 分析器配置仓库通用规则并启用 CI 检查。 -## 4. 瀹夊叏涓庡悎瑙? -- [ ] RBAC 鏉冮檺銆佺鎴烽殧绂汇€佺敤鎴?鏉冮檺娲炲療 API 瀹屾暣婕旂ず骞跺湪 Swagger 涓彁渚涚ず渚嬨€? -- [ ] 鐧诲綍/鍒锋柊娴佺▼澧炲姞 IP 鏍¢獙銆佺鎴烽殧绂汇€侀獙璇佺爜/棰戠巼闄愬埗銆? -- [ ] 鐧诲綍/鏉冮檺/鏁忔劅鎿嶄綔鏃ュ織鍙拷婧紝鎻愪緵鏌ヨ鎺ュ彛鎴?Kibana Saved Search銆? -- [ ] Secret Store/KeyVault/KMS 绠$悊鏁忔劅閰嶇疆锛岀姝㈠瘑閽ュ啓鍏?Git/鏁版嵁搴撴槑鏂囥€? +## 4. 安全与合规 +- [ ] RBAC 权限、租户隔离、用户/权限洞察 API 完整演示并在 Swagger 中提供示例。 +- [ ] 登录/刷新流程增加 IP 校验、租户隔离、验证码/频率限制。 +- [ ] 登录/权限/敏感操作日志可追溯,提供查询接口或 Kibana Saved Search。 +- [ ] Secret Store/KeyVault/KMS 管理敏感配置,禁止密钥写入 Git/数据库明文。 -## 5. 瑙傛祴涓庤繍缁? -- [ ] TraceId 璐€氾紝骞跺湪 Serilog 涓緭鍑?Console/File/ELK 涓夌鐩爣銆? -- [ ] Prometheus exporter 鏆撮湶鍏抽敭鎸囨爣锛?health 鎺㈤拡涓庡憡璀﹁鍒欏悓姝ユ帹閫併€? -- [ ] PostgreSQL 鍏ㄩ噺/澧為噺澶囦唤鑴氭湰鍙婁竴娆$湡瀹炴仮澶嶆紨缁冩姤鍛娿€? +## 5. 观测与运维 +- [ ] TraceId 贯通,并在 Serilog 中输出 Console/File/ELK 三种目标。 +- [ ] Prometheus exporter 暴露关键指标,/health 探针与告警规则同步推送。 +- [ ] PostgreSQL 全量/增量备份脚本及一次真实恢复演练报告。 -## 6. 涓氬姟鑳藉姏琛ュ叏 -- [ ] 鍟嗘埛/闂ㄥ簵/鑿滃搧 API 瀹屾垚骞跺湪 MQ 涓姇閫掍笂鏋?鏀粯鎴愬姛浜嬩欢銆? -- [ ] 閰嶉€佸鎺?API 鏀寔涓嬪崟/鍙栨秷/鏌ヨ骞跺畬鎴愮鍚嶉獙绛句腑闂翠欢銆? -- [ ] 灏忕▼搴忕鍟嗗搧娴忚銆佷笅鍗曘€佹敮浠樸€佽瘎浠枫€佸浘鐗囩洿浼犵瓑 API 鍙棴鐜窇閫氥€? +## 6. 业务能力补全 +- [ ] 商户/门店/菜品 API 完成并在 MQ 中投递上架/支付成功事件。 +- [ ] 配送对接 API 支持下单/取消/查询并完成签名验签中间件。 +- [ ] 小程序端商品浏览、下单、支付、评价、图片直传等 API 可闭环跑通。 -## 7. 鍓嶅悗鍙?UI 瀵规帴 -- [ ] Admin UI 閫氳繃 OpenAPI 鐢熸垚鎴栨墜鍐欑晫闈紝鎺ュ叆 Hangfire Dashboard/MQ 鐩戞帶鍙妯″紡銆? -- [ ] 灏忕▼搴忕瀹屾垚鐧诲綍銆佽彍鍗曟祻瑙堛€佷笅鍗曘€佹敮浠樸€佺墿娴佽建杩广€佺礌鏉愮洿浼犻棴鐜€? +## 7. 前后台 UI 对接 +- [ ] Admin UI 通过 OpenAPI 生成或手写界面,接入 Hangfire Dashboard/MQ 监控只读模式。 +- [ ] 小程序端完成登录、菜单浏览、下单、支付、物流轨迹、素材直传闭环。 -## 8. CI/CD 涓庡彂甯? -- [ ] CI/CD 娴佹按绾胯鐩栨瀯寤恒€佸彂甯冦€侀潤鎬佹壂鎻忋€佹暟鎹簱杩佺Щ銆? -- [ ] Dev/Staging/Prod 澶氱幆澧冮厤缃煩闃?+ 鍩虹璁炬柦 IaC 鑴氭湰銆? -- [ ] 鐗堟湰涓庡彂甯冭鏄庢ā鏉挎暣鐞嗗苟鍦ㄤ粨搴撲腑鎻愪緵绀轰緥銆? +## 8. CI/CD 与发布 +- [ ] CI/CD 流水线覆盖构建、发布、静态扫描、数据库迁移。 +- [ ] Dev/Staging/Prod 多环境配置矩阵 + 基础设施 IaC 脚本。 +- [ ] 版本与发布说明模板整理并在仓库中提供示例。 -## 9. 鏂囨。涓庣煡璇嗗簱 -- [ ] 鎺ュ彛鏂囨。銆侀鍩熸ā鍨嬨€佸叧閿害鏉熶娇鐢?Markdown 鎴?API Portal 瀹屾暣璁板綍銆? -- [ ] 杩愯鎵嬪唽鍖呭惈閮ㄧ讲姝ラ銆佽祫婧愭嫇鎵戙€佹晠闅滄帓鏌ユ墜鍐屻€? -- [ ] 瀹夊叏鍚堣妯℃澘瑕嗙洊鏁版嵁鍒嗙骇銆佸瘑閽ョ鐞嗐€佸璁℃祦绋嬪苟褰㈡垚鍙鐢ㄨ〃鏍笺€ +## 9. 文档与知识库 +- [ ] 接口文档、领域模型、关键约束使用 Markdown 或 API Portal 完整记录。 +- [ ] 运行手册包含部署步骤、资源拓扑、故障排查手册。 +- [ ] 安全合规模板覆盖数据分级、密钥管理、审计流程并形成可复用表格。 diff --git a/Document/12_BusinessTodo.md b/Document/12_BusinessTodo.md index e59a6dc..bd3da81 100644 --- a/Document/12_BusinessTodo.md +++ b/Document/12_BusinessTodo.md @@ -1,54 +1,53 @@ -# Business-Level TODOs +# 里程碑待办追踪 -> Product & business capability roadmap grouped by milestones; each phase only tracks the scoped backlog to enable staged delivery. +> 按“小程序版模块规划”划分四个里程碑;每个里程碑只含对应范围的任务,便于分阶段推进。 --- -## Phase 1锛堝綋鍓嶉樁娈碉級锛氱鎴?鍟嗗鍏ラ┗銆侀棬搴椾笌鑿滃搧銆佹壂鐮佸爞椋熴€佸熀纭€涓嬪崟鏀粯銆侀璐嚜鎻愩€佺涓夋柟閰嶉€侀鏋? -- [ ] 绠$悊绔鎴?API锛氭敞鍐屻€佸疄鍚嶈璇併€佸椁愯闃?缁垂/鍗囬檷閰嶃€佸鏍告祦锛孲wagger 鈮? 涓鐐癸紝鍚鏍告棩蹇椼€? -- [ ] 鍟嗗鍏ラ┗ API锛氳瘉鐓т笂浼犮€佸悎鍚岀鐞嗐€佺被鐩€夋嫨锛岄┍鍔ㄥ緟瀹?瀹℃牳/椹冲洖/閫氳繃鐘舵€佹満锛屾枃浠舵寔涔呭湪 COS銆? -- [ ] RBAC 妯℃澘锛氬钩鍙扮鐞嗗憳銆佺鎴风鐞嗗憳銆佸簵闀裤€佸簵鍛樺洓瑙掕壊妯℃澘锛汚PI 鍙鍒跺苟鍏佽绉熸埛鑷畾涔夋墿灞曘€? -- [ ] 閰嶉涓庡椁愶細TenantPackage CRUD銆佽闃?缁垂/閰嶉鏍¢獙锛堥棬搴?璐﹀彿/鐭俊/閰嶉€佸崟閲忥級锛岃秴棰濊繑鍥?409 骞惰褰?TenantQuotaUsage銆? -- [ ] 绉熸埛杩愯惀闈㈡澘锛氭瑺璐?鍒版湡鍛婅銆佽处鍗曞垪琛ㄣ€佸叕鍛婇€氱煡鎺ュ彛锛屾敮鎸佸凡璇荤姸鎬佸苟鍦?Admin UI 灞曠ず銆? -- [ ] 闂ㄥ簵绠$悊锛歋tore/StoreBusinessHour/StoreDeliveryZone/StoreHoliday CRUD 瀹屾暣锛屽惈 GeoJSON 閰嶉€佽寖鍥村強鑳藉姏寮€鍏炽€? -- [ ] 妗岀爜绠$悊锛氭壒閲忕敓鎴愭鐮併€佺粦瀹氬尯鍩?瀹归噺銆佸鍑轰簩缁寸爜 ZIP锛圥OST /api/admin/stores/{id}/tables 鍙笅杞斤級銆? -- [ ] 鍛樺伐鎺掔彮锛氬垱寤哄憳宸ャ€佺粦瀹氶棬搴楄鑹层€佺淮鎶?StoreEmployeeShift锛屽彲鏌ヨ鏈潵 7 鏃ユ帓鐝€? -- [ ] 妗岀爜鎵爜鍏ュ彛锛歁ini 绔В鏋愪簩缁寸爜锛孏ET /api/mini/tables/{code}/context 杩斿洖闂ㄥ簵銆佹鍙般€佸叕鍛娿€? -- [ ] 鑿滃搧寤烘ā锛氬垎绫汇€丼PU銆丼KU銆佽鏍?鍔犳枡缁勩€佷环鏍肩瓥鐣ャ€佸獟璧?CRUD + 涓婁笅鏋舵祦绋嬶紱Mini 绔彲鎷夊彇瀹屾暣 JSON銆? -- [ ] 搴撳瓨浣撶郴锛歋KU 搴撳瓨銆佹壒娆°€佽皟鏁淬€佸敭缃勭鐞嗭紝鏀寔棰勫敭/妗f湡閿佸畾骞跺湪璁㈠崟涓墸鍑?閲婃斁銆? -- [ ] 鑷彁妗f湡锛氶棬搴楅厤缃嚜鎻愭椂闂寸獥銆佸閲忋€佹埅鍗曟椂闂达紱Mini 绔嵁姝ら檺鍒朵笅鍗曟椂闂淬€? -- [ ] 璐墿杞︽湇鍔★細ShoppingCart/CartItem/CartItemAddon API 鏀寔骞跺彂閿併€侀檺璐€佸埜/绉垎棰勬牎楠岋紝淇濊瘉骞跺彂鏃犺剰鏁版嵁銆? -- [ ] 璁㈠崟涓庢敮浠橈細鍫傞/鑷彁/閰嶉€佷笅鍗曘€佸井淇?鏀粯瀹濇敮浠樸€佷紭鎯犲埜/绉垎鎶垫墸銆佽鍗曠姸鎬佹満涓庨€氱煡閾捐矾榻愬叏銆? -- [ ] 妗屽彴璐﹀崟锛氬悎鍗?鎷嗗崟銆佺粨璐︺€佺數瀛愬皬绁ㄣ€佹鍙伴噴鏀撅紝瀹屾垚缁撹处鍚庢仮澶?Idle 骞剁敓鎴愮エ鎹?URL銆? -- [ ] 鑷厤閫侀鏋讹細楠戞墜绠$悊銆佸彇閫佷欢淇℃伅褰曞叆銆佽垂鐢ㄨˉ璐磋褰曪紝Admin 绔彲娲惧崟骞舵洿鏂?DeliveryOrder銆? -- [ ] 绗笁鏂归厤閫佹娊璞★細缁熶竴涓嬪崟/鍙栨秷/鍔犱环/鏌ヨ鎺ュ彛锛屾敮鎸佽揪杈俱€佺編鍥€侀棯閫佺瓑锛屽惈鍥炶皟楠岀涓庡紓甯歌ˉ鍋块鏋躲€? -- [ ] 棰勮喘鑷彁鏍搁攢锛氭彁璐х爜鐢熸垚銆佹墜鏈哄彿/浜岀淮鐮佹牳閿€銆佽嚜鎻愭煖/鍓嶅彴娴佺▼锛岃秴鏃惰嚜鍔ㄥ彇娑堟垨閫€娆撅紝璁板綍鎿嶄綔鑰呬笌鏃堕棿銆? -- [ ] 鎸囨爣涓庢棩蹇楋細Prometheus 杈撳嚭璁㈠崟鍒涘缓銆佹敮浠樻垚鍔熺巼銆侀厤閫佸洖璋冭€楁椂绛夛紝Grafana 鈮? 涓浘琛紱鍏抽敭娴佺▼鏃ュ織璁板綍 TraceId + 涓氬姟 ID銆? -- [ ] 娴嬭瘯锛歅hase 1 鏍稿績 API 鍏峰 鈮?0 鏉¤嚜鍔ㄥ寲鐢ㄤ緥锛堝崟鍏?+ 闆嗘垚锛夛紝瑕嗙洊绉熸埛鈫掑晢鎴封啋涓嬪崟閾捐矾銆? - +## Phase 1(当前阶段):租户/商家入驻、门店与菜品、扫码堂食、基础下单支付、预购自提、第三方配送骨架 +- [ ] 管理端租户 API:注册、实名认证、套餐订阅/续费/升降配、审核流,Swagger ≥6 个端点,含审核日志。 +- [ ] 商家入驻 API:证照上传、合同管理、类目选择,驱动待审/审核/驳回/通过状态机,文件持久在 COS。 +- [ ] RBAC 模板:平台管理员、租户管理员、店长、店员四角色模板;API 可复制并允许租户自定义扩展。 +- [ ] 配额与套餐:TenantPackage CRUD、订阅/续费/配额校验(门店/账号/短信/配送单量),超额返回 409 并记录 TenantQuotaUsage。 +- [ ] 租户运营面板:欠费/到期告警、账单列表、公告通知接口,支持已读状态并在 Admin UI 展示。 +- [ ] 门店管理:Store/StoreBusinessHour/StoreDeliveryZone/StoreHoliday CRUD 完整,含 GeoJSON 配送范围及能力开关。 +- [ ] 桌码管理:批量生成桌码、绑定区域/容量、导出二维码 ZIP(POST /api/admin/stores/{id}/tables 可下载)。 +- [ ] 员工排班:创建员工、绑定门店角色、维护 StoreEmployeeShift,可查询未来 7 日排班。 +- [ ] 桌码扫码入口:Mini 端解析二维码,GET /api/mini/tables/{code}/context 返回门店、桌台、公告。 +- [ ] 菜品建模:分类、SPU、SKU、规格/加料组、价格策略、媒资 CRUD + 上下架流程;Mini 端可拉取完整 JSON。 +- [ ] 库存体系:SKU 库存、批次、调整、售罄管理,支持预售/档期锁定并在订单中扣减/释放。 +- [ ] 自提档期:门店配置自提时间窗、容量、截单时间;Mini 端据此限制下单时间。 +- [ ] 购物车服务:ShoppingCart/CartItem/CartItemAddon API 支持并发锁、限购、券/积分预校验,保证并发无脏数据。 +- [ ] 订单与支付:堂食/自提/配送下单、微信/支付宝支付、优惠券/积分抵扣、订单状态机与通知链路齐全。 +- [ ] 桌台账单:合单/拆单、结账、电子小票、桌台释放,完成结账后恢复 Idle 并生成票据 URL。 +- [ ] 自配送骨架:骑手管理、取送件信息录入、费用补贴记录,Admin 端可派单并更新 DeliveryOrder。 +- [ ] 第三方配送抽象:统一下单/取消/加价/查询接口,支持达达、美团、闪送等,含回调验签与异常补偿骨架。 +- [ ] 预购自提核销:提货码生成、手机号/二维码核销、自提柜/前台流程,超时自动取消或退款,记录操作者与时间。 +- [ ] 指标与日志:Prometheus 输出订单创建、支付成功率、配送回调耗时等,Grafana ≥8 个图表;关键流程日志记录 TraceId + 业务 ID。 +- [ ] 测试:Phase 1 核心 API 具备 ≥30 条自动化用例(单元 + 集成),覆盖租户→商户→下单链路。 --- -## Phase 2锛堜笅涓€闃舵锛夛細鎷煎崟銆佷紭鎯犲埜涓庡熀纭€钀ラ攢銆佷細鍛樼Н鍒?浼氬憳鏃ャ€佸鏈嶈亰澶┿€佸悓鍩庤嚜閰嶉€佽皟搴︺€佹悳绱? -- [ ] 鎷煎崟寮曟搸锛欸roupOrder/Participant CRUD銆佸彂璧?鍔犲叆/鎴愬洟鏉′欢銆佽嚜鍔ㄨВ鏁d笌閫€娆俱€佸洟鍐呮秷鎭笌鎻愰啋銆? -- [ ] 浼樻儬鍒镐笌鍩虹钀ラ攢锛氭ā鏉跨鐞嗐€侀鍒搞€佹牳閿€銆佸簱瀛?鏈夋晥鏈?鍙犲姞瑙勫垯锛屽熀纭€鎶藉/绉掓潃/婊″噺娲诲姩銆? -- [ ] 浼氬憳涓庣Н鍒嗭細浼氬憳妗f銆佺瓑绾?鎴愰暱鍊笺€佷細鍛樻棩閫氱煡锛涚Н鍒嗚幏鍙?娑堣€椼€佹湁鏁堟湡銆侀粦鍚嶅崟銆? -- [ ] 瀹㈡湇鑱婂ぉ锛氬疄鏃朵細璇濄€佹満鍣ㄤ汉/浜哄伐鍒囨崲銆佹帓闃?杞帴銆佹秷鎭ā鏉裤€佹晱鎰熻瘝瀹℃煡銆佸伐鍗曟祦杞笌璇勪环銆? -- [ ] 鍚屽煄鑷厤閫佽皟搴︼細楠戞墜鏅鸿兘鎸囨淳銆佽矾绾夸及鏃躲€佹棤鎺ヨЕ閰嶉€併€佽垂鐢ㄨˉ璐寸瓥鐣ャ€佽皟搴︾湅鏉裤€? -- [ ] 鎼滅储锛氶棬搴?鑿滃搧/娲诲姩/浼樻儬鍒告悳绱紝杩囨护/鎺掑簭銆佺儹闂?鍘嗗彶璁板綍銆佽仈鎯充笌绾犻敊銆? +## Phase 2(下一阶段):拼单、优惠券与基础营销、会员积分/会员日、客服聊天、同城自配送调度、搜索 +- [ ] 拼单引擎:GroupOrder/Participant CRUD、发起/加入/成团条件、自动解散与退款、团内消息与提醒。 +- [ ] 优惠券与基础营销:模板管理、领券、核销、库存/有效期/叠加规则,基础抽奖/秒杀/满减活动。 +- [ ] 会员与积分:会员档案、等级/成长值、会员日通知;积分获取/消耗、有效期、黑名单。 +- [ ] 客服聊天:实时会话、机器人/人工切换、排队/转接、消息模板、敏感词审查、工单流转与评价。 +- [ ] 同城自配送调度:骑手智能指派、路线估时、无接触配送、费用补贴策略、调度看板。 +- [ ] 搜索:门店/菜品/活动/优惠券搜索,过滤/排序、热门/历史记录、联想与纠错。 --- -## Phase 3锛氬垎閿€杩斿埄銆佺鍒版墦鍗°€侀绾﹂璁€佸湴鍥惧鑸€佺ぞ鍖恒€侀珮闃惰惀閿€銆侀鎺т笌琛ュ伩 -- [ ] 鍒嗛攢杩斿埄锛欰ffiliatePartner/Order/Payout 绠$悊锛屼剑閲戦樁姊€佺粨绠楀懆鏈熴€佺◣鍔′俊鎭€佽繚瑙勫鐞嗐€? -- [ ] 绛惧埌鎵撳崱锛欳heckInCampaign/Record銆佽繛绛惧鍔便€佽ˉ绛俱€佺Н鍒?鍒?鎴愰暱鍊煎鍔便€佸弽浣滃紛鏈哄埗銆? -- [ ] 棰勭害棰勮锛氭。鏈?璧勬簮鍗犵敤銆侀绾︿笅鍗?鏀粯銆佹彁閱?鏀规湡/鍙栨秷銆佸埌搴楁牳閿€涓庡饱绾﹁褰曘€? -- [ ] 鍦板浘瀵艰埅鎵╁睍锛氶檮杩戦棬搴?鎺ㄨ崘銆佽窛绂?璺嚎瑙勫垝銆佽烦杞師鐢熷鑸€佸鑸姹傚煁鐐广€? -- [ ] 绀惧尯锛氬姩鎬佸彂甯冦€佽瘎璁恒€佺偣璧炪€佽瘽棰?鏍囩銆佸浘鐗?瑙嗛瀹℃牳銆佷妇鎶ヤ笌椋庢帶锛屽簵閾哄彛纰戝睍绀恒€? -- [ ] 楂橀樁钀ラ攢锛氱鏉€/鎶藉/瑁傚彉銆佽鍙樻捣鎶ャ€佺垎娆炬帹鑽愪綅銆佸娓犻亾鎶曟斁鍒嗘瀽銆? -- [ ] 椋庢帶涓庡璁★細榛戝悕鍗曘€侀鐜囬檺鍒躲€佸紓甯歌涓虹洃鎺с€佸璁℃棩蹇椼€佽ˉ鍋夸笌鍛婅浣撶郴銆? +## Phase 3:分销返利、签到打卡、预约预订、地图导航、社区、高阶营销、风控与补偿 +- [ ] 分销返利:AffiliatePartner/Order/Payout 管理,佣金阶梯、结算周期、税务信息、违规处理。 +- [ ] 签到打卡:CheckInCampaign/Record、连签奖励、补签、积分/券/成长值奖励、反作弊机制。 +- [ ] 预约预订:档期/资源占用、预约下单/支付、提醒/改期/取消、到店核销与履约记录。 +- [ ] 地图导航扩展:附近门店/推荐、距离/路线规划、跳转原生导航、导航请求埋点。 +- [ ] 社区:动态发布、评论、点赞、话题/标签、图片/视频审核、举报与风控,店铺口碑展示。 +- [ ] 高阶营销:秒杀/抽奖/裂变、裂变海报、爆款推荐位、多渠道投放分析。 +- [ ] 风控与审计:黑名单、频率限制、异常行为监控、审计日志、补偿与告警体系。 --- -## Phase 4锛氭€ц兘浼樺寲銆佺紦瀛樸€佽繍钀ュぇ鐩樸€佹祴璇曚笌鏂囨。銆佷笂绾夸笌鐩戞帶 -- [ ] 鎬ц兘涓庣紦瀛橈細鐑偣鎺ュ彛缂撳瓨銆佹參鏌ヨ娌荤悊銆佹壒澶勭悊浼樺寲銆佸紓姝ュ寲鏀归€犮€? -- [ ] 鍙潬鎬э細骞傜瓑涓庨噸璇曠瓥鐣ャ€佷换鍔¤皟搴﹁ˉ鍋裤€侀摼璺拷韪€佸憡璀﹁仈鍔ㄣ€? -- [ ] 杩愯惀澶х洏锛氫氦鏄?钀ラ攢/灞ョ害/鐢ㄦ埛缁村害鐨勭粏鍒嗘姤琛ㄣ€丟MV/鎴愭湰/姣涘埄鍒嗘瀽銆? -- [ ] 鏂囨。涓庢祴璇曪細瀹屾暣娴嬭瘯鐭╅樀銆佹€ц兘娴嬭瘯鎶ュ憡銆佷笂绾挎墜鍐屻€佸洖婊氭柟妗堛€? -- [ ] 鐩戞帶涓庤繍缁达細涓婄嚎鍙戝竷娴佺▼銆佺伆搴?鍥炴粴绛栫暐銆佺郴缁熺ǔ瀹氭€ф寚鏍囥€?4x7 鐩戞帶涓庡憡璀︺€? +## Phase 4:性能优化、缓存、运营大盘、测试与文档、上线与监控 +- [ ] 性能与缓存:热点接口缓存、慢查询治理、批处理优化、异步化改造。 +- [ ] 可靠性:幂等与重试策略、任务调度补偿、链路追踪、告警联动。 +- [ ] 运营大盘:交易/营销/履约/用户维度的细分报表、GMV/成本/毛利分析。 +- [ ] 文档与测试:完整测试矩阵、性能测试报告、上线手册、回滚方案。 +- [ ] 监控与运维:上线发布流程、灰度/回滚策略、系统稳定性指标、24x7 监控与告警。 \ No newline at end of file diff --git a/Document/13_AppSeed说明.md b/Document/13_AppSeed说明.md new file mode 100644 index 0000000..8ab02e7 --- /dev/null +++ b/Document/13_AppSeed说明.md @@ -0,0 +1,52 @@ +# App 数据种子使用说明(App:Seed) + +> 作用:在启动时自动创建默认租户与基础字典,便于本地/测试环境快速落地必备数据。由 `AppDataSeeder` 执行,支持幂等多次运行。 + +## 配置入口 +- 文件位置:`appsettings.{Environment}.json`(示例已写入 AdminApi 的 Development 配置)。 +- 配置节:`App:Seed`。 + +示例(已写入 `src/Api/TakeoutSaaS.AdminApi/appsettings.Development.json`): +```json +"App": { + "Seed": { + "Enabled": true, + "DefaultTenant": { + "TenantId": 1000000000001, + "Code": "demo", + "Name": "Demo租户", + "ShortName": "Demo", + "ContactName": "DemoAdmin", + "ContactPhone": "13800000000" + }, + "DictionaryGroups": [ + { + "Code": "order_status", + "Name": "订单状态", + "Scope": "Business", + "Items": [ + { "Key": "pending", "Value": "待支付", "SortOrder": 10 }, + { "Key": "paid", "Value": "已支付", "SortOrder": 20 }, + { "Key": "finished", "Value": "已完成", "SortOrder": 30 } + ] + } + ] + } +} +``` + +字段说明: +- `Enabled`: 是否启用种子。 +- `DefaultTenant`: 默认租户(使用雪花 long ID,0 表示让雪花生成)。 +- `DictionaryGroups`: 基础字典,`Scope` 可选 `System`/`Business`,`Items` 支持重复执行更新。 + +## 运行方式 +1. 确保 Admin API 已调用 `AddAppInfrastructure`(已在 Program.cs 中注册,会启动 `AppDataSeeder`)。 +2. 修改 `appsettings.{Environment}.json` 的 `App:Seed` 后,启动 Admin API,即会自动执行种子逻辑(幂等)。 +3. 查看日志:`AppSeed` 前缀会输出创建/更新结果。 + +## 注意事项 +- ID 必须为 long(雪花),不要再使用 Guid/自增。 +- 系统租户使用 `TenantId = 0`;业务租户请填写实际雪花 ID。 +- 字典分组编码需唯一;重复运行会按编码合并更新。 +- 生产环境请按需开启 `Enabled`,避免误写入。 diff --git a/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs b/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs index 164d0c3..962ee57 100644 --- a/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs +++ b/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs @@ -67,7 +67,7 @@ public sealed class AuthController : BaseApiController public async Task> GetProfile(CancellationToken cancellationToken) { var userId = User.GetUserId(); - if (userId == Guid.Empty) + if (userId == 0) { return ApiResponse.Error(ErrorCodes.Unauthorized, "Token 缺少有效的用户标识"); } diff --git a/src/Api/TakeoutSaaS.AdminApi/Controllers/DictionaryController.cs b/src/Api/TakeoutSaaS.AdminApi/Controllers/DictionaryController.cs index 7232ed2..f63c273 100644 --- a/src/Api/TakeoutSaaS.AdminApi/Controllers/DictionaryController.cs +++ b/src/Api/TakeoutSaaS.AdminApi/Controllers/DictionaryController.cs @@ -55,10 +55,10 @@ public sealed class DictionaryController : BaseApiController /// /// 更新字典分组。 /// - [HttpPut("{groupId:guid}")] + [HttpPut("{groupId:long}")] [PermissionAuthorize("dictionary:group:update")] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] - public async Task> UpdateGroup(Guid groupId, [FromBody] UpdateDictionaryGroupRequest request, CancellationToken cancellationToken) + public async Task> UpdateGroup(long groupId, [FromBody] UpdateDictionaryGroupRequest request, CancellationToken cancellationToken) { var group = await _dictionaryAppService.UpdateGroupAsync(groupId, request, cancellationToken); return ApiResponse.Ok(group); @@ -67,10 +67,10 @@ public sealed class DictionaryController : BaseApiController /// /// 删除字典分组。 /// - [HttpDelete("{groupId:guid}")] + [HttpDelete("{groupId:long}")] [PermissionAuthorize("dictionary:group:delete")] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] - public async Task> DeleteGroup(Guid groupId, CancellationToken cancellationToken) + public async Task> DeleteGroup(long groupId, CancellationToken cancellationToken) { await _dictionaryAppService.DeleteGroupAsync(groupId, cancellationToken); return ApiResponse.Success(); @@ -79,10 +79,10 @@ public sealed class DictionaryController : BaseApiController /// /// 创建字典项。 /// - [HttpPost("{groupId:guid}/items")] + [HttpPost("{groupId:long}/items")] [PermissionAuthorize("dictionary:item:create")] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] - public async Task> CreateItem(Guid groupId, [FromBody] CreateDictionaryItemRequest request, CancellationToken cancellationToken) + public async Task> CreateItem(long groupId, [FromBody] CreateDictionaryItemRequest request, CancellationToken cancellationToken) { request.GroupId = groupId; var item = await _dictionaryAppService.CreateItemAsync(request, cancellationToken); @@ -92,10 +92,10 @@ public sealed class DictionaryController : BaseApiController /// /// 更新字典项。 /// - [HttpPut("items/{itemId:guid}")] + [HttpPut("items/{itemId:long}")] [PermissionAuthorize("dictionary:item:update")] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] - public async Task> UpdateItem(Guid itemId, [FromBody] UpdateDictionaryItemRequest request, CancellationToken cancellationToken) + public async Task> UpdateItem(long itemId, [FromBody] UpdateDictionaryItemRequest request, CancellationToken cancellationToken) { var item = await _dictionaryAppService.UpdateItemAsync(itemId, request, cancellationToken); return ApiResponse.Ok(item); @@ -104,10 +104,10 @@ public sealed class DictionaryController : BaseApiController /// /// 删除字典项。 /// - [HttpDelete("items/{itemId:guid}")] + [HttpDelete("items/{itemId:long}")] [PermissionAuthorize("dictionary:item:delete")] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] - public async Task> DeleteItem(Guid itemId, CancellationToken cancellationToken) + public async Task> DeleteItem(long itemId, CancellationToken cancellationToken) { await _dictionaryAppService.DeleteItemAsync(itemId, cancellationToken); return ApiResponse.Success(); diff --git a/src/Api/TakeoutSaaS.AdminApi/Controllers/MerchantsController.cs b/src/Api/TakeoutSaaS.AdminApi/Controllers/MerchantsController.cs new file mode 100644 index 0000000..cc11ec1 --- /dev/null +++ b/src/Api/TakeoutSaaS.AdminApi/Controllers/MerchantsController.cs @@ -0,0 +1,72 @@ +using MediatR; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using TakeoutSaaS.Application.App.Merchants.Commands; +using TakeoutSaaS.Application.App.Merchants.Dto; +using TakeoutSaaS.Application.App.Merchants.Queries; +using TakeoutSaaS.Domain.Merchants.Enums; +using TakeoutSaaS.Module.Authorization.Attributes; +using TakeoutSaaS.Shared.Abstractions.Constants; +using TakeoutSaaS.Shared.Abstractions.Results; +using TakeoutSaaS.Shared.Web.Api; + +namespace TakeoutSaaS.AdminApi.Controllers; + +/// +/// 商户管理。 +/// +[ApiVersion("1.0")] +[Authorize] +[Route("api/admin/v{version:apiVersion}/merchants")] +public sealed class MerchantsController : BaseApiController +{ + private readonly IMediator _mediator; + + /// + /// 初始化控制器。 + /// + public MerchantsController(IMediator mediator) + { + _mediator = mediator; + } + + /// + /// 创建商户。 + /// + [HttpPost] + [PermissionAuthorize("merchant:create")] + [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] + public async Task> Create([FromBody] CreateMerchantCommand command, CancellationToken cancellationToken) + { + var result = await _mediator.Send(command, cancellationToken); + return ApiResponse.Ok(result); + } + + /// + /// 查询商户列表。 + /// + [HttpGet] + [PermissionAuthorize("merchant:read")] + [ProducesResponseType(typeof(ApiResponse>), StatusCodes.Status200OK)] + public async Task>> List([FromQuery] MerchantStatus? status, CancellationToken cancellationToken) + { + var result = await _mediator.Send(new SearchMerchantsQuery { Status = status }, cancellationToken); + return ApiResponse>.Ok(result); + } + + /// + /// 获取商户详情。 + /// + [HttpGet("{merchantId:long}")] + [PermissionAuthorize("merchant:read")] + [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status404NotFound)] + public async Task> Detail(long merchantId, CancellationToken cancellationToken) + { + var result = await _mediator.Send(new GetMerchantByIdQuery { MerchantId = merchantId }, cancellationToken); + return result == null + ? ApiResponse.Error(ErrorCodes.NotFound, "商户不存在") + : ApiResponse.Ok(result); + } +} diff --git a/src/Api/TakeoutSaaS.AdminApi/Program.cs b/src/Api/TakeoutSaaS.AdminApi/Program.cs index 91a6c72..14eb59d 100644 --- a/src/Api/TakeoutSaaS.AdminApi/Program.cs +++ b/src/Api/TakeoutSaaS.AdminApi/Program.cs @@ -6,10 +6,12 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; +using TakeoutSaaS.Application.App.Extensions; using TakeoutSaaS.Application.Identity.Extensions; using TakeoutSaaS.Application.Messaging.Extensions; using TakeoutSaaS.Application.Sms.Extensions; using TakeoutSaaS.Application.Storage.Extensions; +using TakeoutSaaS.Infrastructure.App.Extensions; using TakeoutSaaS.Infrastructure.Identity.Extensions; using TakeoutSaaS.Module.Authorization.Extensions; using TakeoutSaaS.Module.Dictionary.Extensions; @@ -40,6 +42,8 @@ builder.Services.AddSharedSwagger(options => }); builder.Services.AddIdentityApplication(); builder.Services.AddIdentityInfrastructure(builder.Configuration, enableAdminSeed: true); +builder.Services.AddAppInfrastructure(builder.Configuration); +builder.Services.AddAppApplication(); builder.Services.AddJwtAuthentication(builder.Configuration); builder.Services.AddAuthorization(); builder.Services.AddPermissionAuthorization(); diff --git a/src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj b/src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj index 8a896da..c8258af 100644 --- a/src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj +++ b/src/Api/TakeoutSaaS.AdminApi/TakeoutSaaS.AdminApi.csproj @@ -8,6 +8,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/Api/TakeoutSaaS.AdminApi/appsettings.Development.json b/src/Api/TakeoutSaaS.AdminApi/appsettings.Development.json index 4eb2c0e..01c5725 100644 --- a/src/Api/TakeoutSaaS.AdminApi/appsettings.Development.json +++ b/src/Api/TakeoutSaaS.AdminApi/appsettings.Development.json @@ -149,5 +149,39 @@ "WorkerCount": 5, "DashboardEnabled": false, "DashboardPath": "/hangfire" + }, + "App": { + "Seed": { + "Enabled": true, + "DefaultTenant": { + "TenantId": 1000000000001, + "Code": "demo", + "Name": "Demo租户", + "ShortName": "Demo", + "ContactName": "DemoAdmin", + "ContactPhone": "13800000000" + }, + "DictionaryGroups": [ + { + "Code": "order_status", + "Name": "订单状态", + "Scope": "Business", + "Items": [ + { "Key": "pending", "Value": "待支付", "SortOrder": 10 }, + { "Key": "paid", "Value": "已支付", "SortOrder": 20 }, + { "Key": "finished", "Value": "已完成", "SortOrder": 30 } + ] + }, + { + "Code": "store_tags", + "Name": "门店标签", + "Scope": "Business", + "Items": [ + { "Key": "hot", "Value": "热门", "SortOrder": 10 }, + { "Key": "new", "Value": "新店", "SortOrder": 20 } + ] + } + ] + } } } diff --git a/src/Api/TakeoutSaaS.MiniApi/Controllers/MeController.cs b/src/Api/TakeoutSaaS.MiniApi/Controllers/MeController.cs index 795116f..4dd1fa8 100644 --- a/src/Api/TakeoutSaaS.MiniApi/Controllers/MeController.cs +++ b/src/Api/TakeoutSaaS.MiniApi/Controllers/MeController.cs @@ -41,7 +41,7 @@ public sealed class MeController : BaseApiController public async Task> Get(CancellationToken cancellationToken) { var userId = User.GetUserId(); - if (userId == Guid.Empty) + if (userId == 0) { return ApiResponse.Error(ErrorCodes.Unauthorized, "Token 缺少有效的用户标识"); } diff --git a/src/Application/TakeoutSaaS.Application/App/Extensions/AppApplicationServiceCollectionExtensions.cs b/src/Application/TakeoutSaaS.Application/App/Extensions/AppApplicationServiceCollectionExtensions.cs new file mode 100644 index 0000000..61d259f --- /dev/null +++ b/src/Application/TakeoutSaaS.Application/App/Extensions/AppApplicationServiceCollectionExtensions.cs @@ -0,0 +1,23 @@ +using System.Reflection; +using MediatR; +using Microsoft.Extensions.DependencyInjection; + +namespace TakeoutSaaS.Application.App.Extensions; + +/// +/// 业务应用层服务注册。 +/// +public static class AppApplicationServiceCollectionExtensions +{ + /// + /// 注册业务应用层(MediatR 处理器等)。 + /// + /// 服务集合。 + /// 服务集合。 + public static IServiceCollection AddAppApplication(this IServiceCollection services) + { + services.AddMediatR(Assembly.GetExecutingAssembly()); + + return services; + } +} diff --git a/src/Application/TakeoutSaaS.Application/App/Merchants/Commands/CreateMerchantCommand.cs b/src/Application/TakeoutSaaS.Application/App/Merchants/Commands/CreateMerchantCommand.cs new file mode 100644 index 0000000..ba98a8c --- /dev/null +++ b/src/Application/TakeoutSaaS.Application/App/Merchants/Commands/CreateMerchantCommand.cs @@ -0,0 +1,53 @@ +using MediatR; +using System.ComponentModel.DataAnnotations; +using TakeoutSaaS.Application.App.Merchants.Dto; +using TakeoutSaaS.Domain.Merchants.Enums; + +namespace TakeoutSaaS.Application.App.Merchants.Commands; + +/// +/// 创建商户命令。 +/// +public sealed class CreateMerchantCommand : IRequest +{ + /// + /// 品牌名称。 + /// + [Required, MaxLength(128)] + public string BrandName { get; init; } = string.Empty; + + /// + /// 品牌简称。 + /// + [MaxLength(64)] + public string? BrandAlias { get; init; } + + /// + /// 品牌 Logo。 + /// + [MaxLength(256)] + public string? LogoUrl { get; init; } + + /// + /// 品类。 + /// + [MaxLength(64)] + public string? Category { get; init; } + + /// + /// 联系电话。 + /// + [Required, MaxLength(32)] + public string ContactPhone { get; init; } = string.Empty; + + /// + /// 联系邮箱。 + /// + [MaxLength(128)] + public string? ContactEmail { get; init; } + + /// + /// 状态,可用于直接设为审核通过等场景。 + /// + public MerchantStatus Status { get; init; } = MerchantStatus.Pending; +} diff --git a/src/Application/TakeoutSaaS.Application/App/Merchants/Dto/MerchantDto.cs b/src/Application/TakeoutSaaS.Application/App/Merchants/Dto/MerchantDto.cs new file mode 100644 index 0000000..d1552c8 --- /dev/null +++ b/src/Application/TakeoutSaaS.Application/App/Merchants/Dto/MerchantDto.cs @@ -0,0 +1,63 @@ +using System.Text.Json.Serialization; +using TakeoutSaaS.Domain.Merchants.Enums; +using TakeoutSaaS.Shared.Abstractions.Serialization; + +namespace TakeoutSaaS.Application.App.Merchants.Dto; + +/// +/// 商户 DTO。 +/// +public sealed class MerchantDto +{ + /// + /// 商户 ID。 + /// + [JsonConverter(typeof(SnowflakeIdJsonConverter))] + public long Id { get; init; } + + /// + /// 租户 ID。 + /// + [JsonConverter(typeof(SnowflakeIdJsonConverter))] + public long TenantId { get; init; } + + /// + /// 品牌名称。 + /// + public string BrandName { get; init; } = string.Empty; + + /// + /// 品牌简称。 + /// + public string? BrandAlias { get; init; } + + /// + /// 品牌 Logo。 + /// + public string? LogoUrl { get; init; } + + /// + /// 品类。 + /// + public string? Category { get; init; } + + /// + /// 联系电话。 + /// + public string ContactPhone { get; init; } = string.Empty; + + /// + /// 联系邮箱。 + /// + public string? ContactEmail { get; init; } + + /// + /// 入驻状态。 + /// + public MerchantStatus Status { get; init; } + + /// + /// 入驻时间。 + /// + public DateTime? JoinedAt { get; init; } +} diff --git a/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/CreateMerchantCommandHandler.cs b/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/CreateMerchantCommandHandler.cs new file mode 100644 index 0000000..4b32e70 --- /dev/null +++ b/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/CreateMerchantCommandHandler.cs @@ -0,0 +1,54 @@ +using MediatR; +using Microsoft.Extensions.Logging; +using TakeoutSaaS.Application.App.Merchants.Commands; +using TakeoutSaaS.Application.App.Merchants.Dto; +using TakeoutSaaS.Domain.Merchants.Entities; +using TakeoutSaaS.Domain.Merchants.Repositories; + +namespace TakeoutSaaS.Application.App.Merchants.Handlers; + +/// +/// 创建商户命令处理器。 +/// +public sealed class CreateMerchantCommandHandler(IMerchantRepository merchantRepository, ILogger logger) + : IRequestHandler +{ + private readonly IMerchantRepository _merchantRepository = merchantRepository; + private readonly ILogger _logger = logger; + + /// + public async Task Handle(CreateMerchantCommand request, CancellationToken cancellationToken) + { + var merchant = new Merchant + { + BrandName = request.BrandName.Trim(), + BrandAlias = request.BrandAlias?.Trim(), + LogoUrl = request.LogoUrl?.Trim(), + Category = request.Category?.Trim(), + ContactPhone = request.ContactPhone.Trim(), + ContactEmail = request.ContactEmail?.Trim(), + Status = request.Status, + JoinedAt = DateTime.UtcNow + }; + + await _merchantRepository.AddMerchantAsync(merchant, cancellationToken); + await _merchantRepository.SaveChangesAsync(cancellationToken); + + _logger.LogInformation("创建商户 {MerchantId} - {BrandName}", merchant.Id, merchant.BrandName); + return MapToDto(merchant); + } + + private static MerchantDto MapToDto(Merchant merchant) => new() + { + Id = merchant.Id, + TenantId = merchant.TenantId, + BrandName = merchant.BrandName, + BrandAlias = merchant.BrandAlias, + LogoUrl = merchant.LogoUrl, + Category = merchant.Category, + ContactPhone = merchant.ContactPhone, + ContactEmail = merchant.ContactEmail, + Status = merchant.Status, + JoinedAt = merchant.JoinedAt + }; +} diff --git a/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/GetMerchantByIdQueryHandler.cs b/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/GetMerchantByIdQueryHandler.cs new file mode 100644 index 0000000..f689743 --- /dev/null +++ b/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/GetMerchantByIdQueryHandler.cs @@ -0,0 +1,42 @@ +using MediatR; +using TakeoutSaaS.Application.App.Merchants.Dto; +using TakeoutSaaS.Application.App.Merchants.Queries; +using TakeoutSaaS.Domain.Merchants.Repositories; +using TakeoutSaaS.Shared.Abstractions.Tenancy; + +namespace TakeoutSaaS.Application.App.Merchants.Handlers; + +/// +/// 获取商户详情查询处理器。 +/// +public sealed class GetMerchantByIdQueryHandler(IMerchantRepository merchantRepository, ITenantProvider tenantProvider) + : IRequestHandler +{ + private readonly IMerchantRepository _merchantRepository = merchantRepository; + private readonly ITenantProvider _tenantProvider = tenantProvider; + + /// + public async Task Handle(GetMerchantByIdQuery request, CancellationToken cancellationToken) + { + var tenantId = _tenantProvider.GetCurrentTenantId(); + var merchant = await _merchantRepository.FindByIdAsync(request.MerchantId, tenantId, cancellationToken); + if (merchant == null) + { + return null; + } + + return new MerchantDto + { + Id = merchant.Id, + TenantId = merchant.TenantId, + BrandName = merchant.BrandName, + BrandAlias = merchant.BrandAlias, + LogoUrl = merchant.LogoUrl, + Category = merchant.Category, + ContactPhone = merchant.ContactPhone, + ContactEmail = merchant.ContactEmail, + Status = merchant.Status, + JoinedAt = merchant.JoinedAt + }; + } +} diff --git a/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/SearchMerchantsQueryHandler.cs b/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/SearchMerchantsQueryHandler.cs new file mode 100644 index 0000000..bfd2f9b --- /dev/null +++ b/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/SearchMerchantsQueryHandler.cs @@ -0,0 +1,42 @@ +using MediatR; +using TakeoutSaaS.Application.App.Merchants.Dto; +using TakeoutSaaS.Application.App.Merchants.Queries; +using TakeoutSaaS.Domain.Merchants.Repositories; +using TakeoutSaaS.Shared.Abstractions.Tenancy; + +namespace TakeoutSaaS.Application.App.Merchants.Handlers; + +/// +/// 商户列表查询处理器。 +/// +public sealed class SearchMerchantsQueryHandler( + IMerchantRepository merchantRepository, + ITenantProvider tenantProvider) + : IRequestHandler> +{ + private readonly IMerchantRepository _merchantRepository = merchantRepository; + private readonly ITenantProvider _tenantProvider = tenantProvider; + + /// + public async Task> Handle(SearchMerchantsQuery request, CancellationToken cancellationToken) + { + var tenantId = _tenantProvider.GetCurrentTenantId(); + var merchants = await _merchantRepository.SearchAsync(tenantId, request.Status, cancellationToken); + + return merchants + .Select(merchant => new MerchantDto + { + Id = merchant.Id, + TenantId = merchant.TenantId, + BrandName = merchant.BrandName, + BrandAlias = merchant.BrandAlias, + LogoUrl = merchant.LogoUrl, + Category = merchant.Category, + ContactPhone = merchant.ContactPhone, + ContactEmail = merchant.ContactEmail, + Status = merchant.Status, + JoinedAt = merchant.JoinedAt + }) + .ToList(); + } +} diff --git a/src/Application/TakeoutSaaS.Application/App/Merchants/Queries/GetMerchantByIdQuery.cs b/src/Application/TakeoutSaaS.Application/App/Merchants/Queries/GetMerchantByIdQuery.cs new file mode 100644 index 0000000..fce904d --- /dev/null +++ b/src/Application/TakeoutSaaS.Application/App/Merchants/Queries/GetMerchantByIdQuery.cs @@ -0,0 +1,15 @@ +using MediatR; +using TakeoutSaaS.Application.App.Merchants.Dto; + +namespace TakeoutSaaS.Application.App.Merchants.Queries; + +/// +/// 按 ID 获取商户。 +/// +public sealed class GetMerchantByIdQuery : IRequest +{ + /// + /// 商户 ID。 + /// + public long MerchantId { get; init; } +} diff --git a/src/Application/TakeoutSaaS.Application/App/Merchants/Queries/SearchMerchantsQuery.cs b/src/Application/TakeoutSaaS.Application/App/Merchants/Queries/SearchMerchantsQuery.cs new file mode 100644 index 0000000..3ec7561 --- /dev/null +++ b/src/Application/TakeoutSaaS.Application/App/Merchants/Queries/SearchMerchantsQuery.cs @@ -0,0 +1,16 @@ +using MediatR; +using TakeoutSaaS.Application.App.Merchants.Dto; +using TakeoutSaaS.Domain.Merchants.Enums; + +namespace TakeoutSaaS.Application.App.Merchants.Queries; + +/// +/// 搜索商户列表。 +/// +public sealed class SearchMerchantsQuery : IRequest> +{ + /// + /// 按状态过滤。 + /// + public MerchantStatus? Status { get; init; } +} diff --git a/src/Application/TakeoutSaaS.Application/Dictionary/Abstractions/IDictionaryAppService.cs b/src/Application/TakeoutSaaS.Application/Dictionary/Abstractions/IDictionaryAppService.cs index dc51fe3..60e5f61 100644 --- a/src/Application/TakeoutSaaS.Application/Dictionary/Abstractions/IDictionaryAppService.cs +++ b/src/Application/TakeoutSaaS.Application/Dictionary/Abstractions/IDictionaryAppService.cs @@ -10,17 +10,17 @@ public interface IDictionaryAppService { Task CreateGroupAsync(CreateDictionaryGroupRequest request, CancellationToken cancellationToken = default); - Task UpdateGroupAsync(Guid groupId, UpdateDictionaryGroupRequest request, CancellationToken cancellationToken = default); + Task UpdateGroupAsync(long groupId, UpdateDictionaryGroupRequest request, CancellationToken cancellationToken = default); - Task DeleteGroupAsync(Guid groupId, CancellationToken cancellationToken = default); + Task DeleteGroupAsync(long groupId, CancellationToken cancellationToken = default); Task> SearchGroupsAsync(DictionaryGroupQuery request, CancellationToken cancellationToken = default); Task CreateItemAsync(CreateDictionaryItemRequest request, CancellationToken cancellationToken = default); - Task UpdateItemAsync(Guid itemId, UpdateDictionaryItemRequest request, CancellationToken cancellationToken = default); + Task UpdateItemAsync(long itemId, UpdateDictionaryItemRequest request, CancellationToken cancellationToken = default); - Task DeleteItemAsync(Guid itemId, CancellationToken cancellationToken = default); + Task DeleteItemAsync(long itemId, CancellationToken cancellationToken = default); Task>> GetCachedItemsAsync(DictionaryBatchQueryRequest request, CancellationToken cancellationToken = default); } diff --git a/src/Application/TakeoutSaaS.Application/Dictionary/Abstractions/IDictionaryCache.cs b/src/Application/TakeoutSaaS.Application/Dictionary/Abstractions/IDictionaryCache.cs index 4bbf169..ebdc59f 100644 --- a/src/Application/TakeoutSaaS.Application/Dictionary/Abstractions/IDictionaryCache.cs +++ b/src/Application/TakeoutSaaS.Application/Dictionary/Abstractions/IDictionaryCache.cs @@ -13,15 +13,15 @@ public interface IDictionaryCache /// /// 获取缓存。 /// - Task?> GetAsync(Guid tenantId, string code, CancellationToken cancellationToken = default); + Task?> GetAsync(long tenantId, string code, CancellationToken cancellationToken = default); /// /// 写入缓存。 /// - Task SetAsync(Guid tenantId, string code, IReadOnlyList items, CancellationToken cancellationToken = default); + Task SetAsync(long tenantId, string code, IReadOnlyList items, CancellationToken cancellationToken = default); /// /// 移除缓存。 /// - Task RemoveAsync(Guid tenantId, string code, CancellationToken cancellationToken = default); + Task RemoveAsync(long tenantId, string code, CancellationToken cancellationToken = default); } diff --git a/src/Application/TakeoutSaaS.Application/Dictionary/Contracts/CreateDictionaryItemRequest.cs b/src/Application/TakeoutSaaS.Application/Dictionary/Contracts/CreateDictionaryItemRequest.cs index 553401a..668d369 100644 --- a/src/Application/TakeoutSaaS.Application/Dictionary/Contracts/CreateDictionaryItemRequest.cs +++ b/src/Application/TakeoutSaaS.Application/Dictionary/Contracts/CreateDictionaryItemRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; +using TakeoutSaaS.Shared.Abstractions.Serialization; using System.ComponentModel.DataAnnotations; namespace TakeoutSaaS.Application.Dictionary.Contracts; @@ -11,7 +13,8 @@ public sealed class CreateDictionaryItemRequest /// 所属分组 ID。 /// [Required] - public Guid GroupId { get; set; } + [JsonConverter(typeof(SnowflakeIdJsonConverter))] + public long GroupId { get; set; } /// /// 字典项键。 diff --git a/src/Application/TakeoutSaaS.Application/Dictionary/Models/DictionaryGroupDto.cs b/src/Application/TakeoutSaaS.Application/Dictionary/Models/DictionaryGroupDto.cs index 528167f..95a81f0 100644 --- a/src/Application/TakeoutSaaS.Application/Dictionary/Models/DictionaryGroupDto.cs +++ b/src/Application/TakeoutSaaS.Application/Dictionary/Models/DictionaryGroupDto.cs @@ -1,5 +1,8 @@ using TakeoutSaaS.Domain.Dictionary.Enums; +using System.Text.Json.Serialization; +using TakeoutSaaS.Shared.Abstractions.Serialization; + namespace TakeoutSaaS.Application.Dictionary.Models; /// @@ -7,7 +10,8 @@ namespace TakeoutSaaS.Application.Dictionary.Models; /// public sealed class DictionaryGroupDto { - public Guid Id { get; init; } + [JsonConverter(typeof(SnowflakeIdJsonConverter))] + public long Id { get; init; } public string Code { get; init; } = string.Empty; diff --git a/src/Application/TakeoutSaaS.Application/Dictionary/Models/DictionaryItemDto.cs b/src/Application/TakeoutSaaS.Application/Dictionary/Models/DictionaryItemDto.cs index 89faaf7..f154f3e 100644 --- a/src/Application/TakeoutSaaS.Application/Dictionary/Models/DictionaryItemDto.cs +++ b/src/Application/TakeoutSaaS.Application/Dictionary/Models/DictionaryItemDto.cs @@ -1,3 +1,6 @@ +using System.Text.Json.Serialization; +using TakeoutSaaS.Shared.Abstractions.Serialization; + namespace TakeoutSaaS.Application.Dictionary.Models; /// @@ -5,9 +8,11 @@ namespace TakeoutSaaS.Application.Dictionary.Models; /// public sealed class DictionaryItemDto { - public Guid Id { get; init; } + [JsonConverter(typeof(SnowflakeIdJsonConverter))] + public long Id { get; init; } - public Guid GroupId { get; init; } + [JsonConverter(typeof(SnowflakeIdJsonConverter))] + public long GroupId { get; init; } public string Key { get; init; } = string.Empty; diff --git a/src/Application/TakeoutSaaS.Application/Dictionary/Services/DictionaryAppService.cs b/src/Application/TakeoutSaaS.Application/Dictionary/Services/DictionaryAppService.cs index 93d92c2..8ecfc79 100644 --- a/src/Application/TakeoutSaaS.Application/Dictionary/Services/DictionaryAppService.cs +++ b/src/Application/TakeoutSaaS.Application/Dictionary/Services/DictionaryAppService.cs @@ -47,7 +47,7 @@ public sealed class DictionaryAppService : IDictionaryAppService var group = new DictionaryGroup { - Id = Guid.NewGuid(), + Id = 0, TenantId = targetTenant, Code = normalizedCode, Name = request.Name.Trim(), @@ -62,7 +62,7 @@ public sealed class DictionaryAppService : IDictionaryAppService return MapGroup(group, includeItems: false); } - public async Task UpdateGroupAsync(Guid groupId, UpdateDictionaryGroupRequest request, CancellationToken cancellationToken = default) + public async Task UpdateGroupAsync(long groupId, UpdateDictionaryGroupRequest request, CancellationToken cancellationToken = default) { var group = await RequireGroupAsync(groupId, cancellationToken); EnsureScopePermission(group.Scope); @@ -77,7 +77,7 @@ public sealed class DictionaryAppService : IDictionaryAppService return MapGroup(group, includeItems: false); } - public async Task DeleteGroupAsync(Guid groupId, CancellationToken cancellationToken = default) + public async Task DeleteGroupAsync(long groupId, CancellationToken cancellationToken = default) { var group = await RequireGroupAsync(groupId, cancellationToken); EnsureScopePermission(group.Scope); @@ -120,7 +120,7 @@ public sealed class DictionaryAppService : IDictionaryAppService var item = new DictionaryItem { - Id = Guid.NewGuid(), + Id = 0, TenantId = group.TenantId, GroupId = group.Id, Key = request.Key.Trim(), @@ -138,7 +138,7 @@ public sealed class DictionaryAppService : IDictionaryAppService return MapItem(item); } - public async Task UpdateItemAsync(Guid itemId, UpdateDictionaryItemRequest request, CancellationToken cancellationToken = default) + public async Task UpdateItemAsync(long itemId, UpdateDictionaryItemRequest request, CancellationToken cancellationToken = default) { var item = await RequireItemAsync(itemId, cancellationToken); var group = await RequireGroupAsync(item.GroupId, cancellationToken); @@ -156,7 +156,7 @@ public sealed class DictionaryAppService : IDictionaryAppService return MapItem(item); } - public async Task DeleteItemAsync(Guid itemId, CancellationToken cancellationToken = default) + public async Task DeleteItemAsync(long itemId, CancellationToken cancellationToken = default) { var item = await RequireItemAsync(itemId, cancellationToken); var group = await RequireGroupAsync(item.GroupId, cancellationToken); @@ -186,8 +186,8 @@ public sealed class DictionaryAppService : IDictionaryAppService foreach (var code in normalizedCodes) { - var systemItems = await GetOrLoadCacheAsync(Guid.Empty, code, cancellationToken); - if (tenantId == Guid.Empty) + var systemItems = await GetOrLoadCacheAsync(0, code, cancellationToken); + if (tenantId == 0) { result[code] = systemItems; continue; @@ -200,7 +200,7 @@ public sealed class DictionaryAppService : IDictionaryAppService return result; } - private async Task RequireGroupAsync(Guid groupId, CancellationToken cancellationToken) + private async Task RequireGroupAsync(long groupId, CancellationToken cancellationToken) { var group = await _repository.FindGroupByIdAsync(groupId, cancellationToken); if (group == null) @@ -211,7 +211,7 @@ public sealed class DictionaryAppService : IDictionaryAppService return group; } - private async Task RequireItemAsync(Guid itemId, CancellationToken cancellationToken) + private async Task RequireItemAsync(long itemId, CancellationToken cancellationToken) { var item = await _repository.FindItemByIdAsync(itemId, cancellationToken); if (item == null) @@ -222,16 +222,16 @@ public sealed class DictionaryAppService : IDictionaryAppService return item; } - private Guid ResolveTargetTenant(DictionaryScope scope) + private long ResolveTargetTenant(DictionaryScope scope) { var tenantId = _tenantProvider.GetCurrentTenantId(); if (scope == DictionaryScope.System) { EnsurePlatformTenant(tenantId); - return Guid.Empty; + return 0; } - if (tenantId == Guid.Empty) + if (tenantId == 0) { throw new BusinessException(ErrorCodes.BadRequest, "业务参数需指定租户"); } @@ -241,28 +241,28 @@ public sealed class DictionaryAppService : IDictionaryAppService private static string NormalizeCode(string code) => code.Trim().ToLowerInvariant(); - private static DictionaryScope ResolveScopeForQuery(DictionaryScope? requestedScope, Guid tenantId) + private static DictionaryScope ResolveScopeForQuery(DictionaryScope? requestedScope, long tenantId) { if (requestedScope.HasValue) { return requestedScope.Value; } - return tenantId == Guid.Empty ? DictionaryScope.System : DictionaryScope.Business; + return tenantId == 0 ? DictionaryScope.System : DictionaryScope.Business; } private void EnsureScopePermission(DictionaryScope scope) { var tenantId = _tenantProvider.GetCurrentTenantId(); - if (scope == DictionaryScope.System && tenantId != Guid.Empty) + if (scope == DictionaryScope.System && tenantId != 0) { throw new BusinessException(ErrorCodes.Forbidden, "仅平台管理员可操作系统字典"); } } - private void EnsurePlatformTenant(Guid tenantId) + private void EnsurePlatformTenant(long tenantId) { - if (tenantId != Guid.Empty) + if (tenantId != 0) { throw new BusinessException(ErrorCodes.Forbidden, "仅平台管理员可操作系统字典"); } @@ -279,7 +279,7 @@ public sealed class DictionaryAppService : IDictionaryAppService // 系统参数更新需要逐租户重新合并,由调用方在下一次请求时重新加载 } - private async Task> GetOrLoadCacheAsync(Guid tenantId, string code, CancellationToken cancellationToken) + private async Task> GetOrLoadCacheAsync(long tenantId, string code, CancellationToken cancellationToken) { var cached = await _cache.GetAsync(tenantId, code, cancellationToken); if (cached != null) diff --git a/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IAdminAuthService.cs b/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IAdminAuthService.cs index f60dffb..28510e3 100644 --- a/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IAdminAuthService.cs +++ b/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IAdminAuthService.cs @@ -12,5 +12,5 @@ public interface IAdminAuthService { Task LoginAsync(AdminLoginRequest request, CancellationToken cancellationToken = default); Task RefreshTokenAsync(RefreshTokenRequest request, CancellationToken cancellationToken = default); - Task GetProfileAsync(Guid userId, CancellationToken cancellationToken = default); + Task GetProfileAsync(long userId, CancellationToken cancellationToken = default); } diff --git a/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IMiniAuthService.cs b/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IMiniAuthService.cs index 11efdb4..c7a509e 100644 --- a/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IMiniAuthService.cs +++ b/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IMiniAuthService.cs @@ -12,5 +12,5 @@ public interface IMiniAuthService { Task LoginWithWeChatAsync(WeChatLoginRequest request, CancellationToken cancellationToken = default); Task RefreshTokenAsync(RefreshTokenRequest request, CancellationToken cancellationToken = default); - Task GetProfileAsync(Guid userId, CancellationToken cancellationToken = default); + Task GetProfileAsync(long userId, CancellationToken cancellationToken = default); } diff --git a/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IRefreshTokenStore.cs b/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IRefreshTokenStore.cs index d966ca2..29a1bf6 100644 --- a/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IRefreshTokenStore.cs +++ b/src/Application/TakeoutSaaS.Application/Identity/Abstractions/IRefreshTokenStore.cs @@ -10,7 +10,7 @@ namespace TakeoutSaaS.Application.Identity.Abstractions; /// public interface IRefreshTokenStore { - Task IssueAsync(Guid userId, DateTime expiresAt, CancellationToken cancellationToken = default); + Task IssueAsync(long userId, DateTime expiresAt, CancellationToken cancellationToken = default); Task GetAsync(string refreshToken, CancellationToken cancellationToken = default); Task RevokeAsync(string refreshToken, CancellationToken cancellationToken = default); } diff --git a/src/Application/TakeoutSaaS.Application/Identity/Contracts/CurrentUserProfile.cs b/src/Application/TakeoutSaaS.Application/Identity/Contracts/CurrentUserProfile.cs index e93e2bc..922b7d3 100644 --- a/src/Application/TakeoutSaaS.Application/Identity/Contracts/CurrentUserProfile.cs +++ b/src/Application/TakeoutSaaS.Application/Identity/Contracts/CurrentUserProfile.cs @@ -8,7 +8,7 @@ public sealed class CurrentUserProfile /// /// 用户 ID。 /// - public Guid UserId { get; init; } + public long UserId { get; init; } /// /// 登录账号。 @@ -23,12 +23,12 @@ public sealed class CurrentUserProfile /// /// 所属租户 ID。 /// - public Guid TenantId { get; init; } + public long TenantId { get; init; } /// /// 所属商户 ID(平台管理员为空)。 /// - public Guid? MerchantId { get; init; } + public long? MerchantId { get; init; } /// /// 角色集合。 diff --git a/src/Application/TakeoutSaaS.Application/Identity/Models/RefreshTokenDescriptor.cs b/src/Application/TakeoutSaaS.Application/Identity/Models/RefreshTokenDescriptor.cs index 68e07e6..8a968bb 100644 --- a/src/Application/TakeoutSaaS.Application/Identity/Models/RefreshTokenDescriptor.cs +++ b/src/Application/TakeoutSaaS.Application/Identity/Models/RefreshTokenDescriptor.cs @@ -9,6 +9,6 @@ namespace TakeoutSaaS.Application.Identity.Models; /// 是否已撤销 public sealed record RefreshTokenDescriptor( string Token, - Guid UserId, + long UserId, DateTime ExpiresAt, bool Revoked); diff --git a/src/Application/TakeoutSaaS.Application/Identity/Services/AdminAuthService.cs b/src/Application/TakeoutSaaS.Application/Identity/Services/AdminAuthService.cs index ee0fbeb..42418a4 100644 --- a/src/Application/TakeoutSaaS.Application/Identity/Services/AdminAuthService.cs +++ b/src/Application/TakeoutSaaS.Application/Identity/Services/AdminAuthService.cs @@ -77,7 +77,7 @@ public sealed class AdminAuthService( /// 取消令牌 /// 用户档案 /// 用户不存在时抛出 - public async Task GetProfileAsync(Guid userId, CancellationToken cancellationToken = default) + public async Task GetProfileAsync(long userId, CancellationToken cancellationToken = default) { var user = await userRepository.FindByIdAsync(userId, cancellationToken) ?? throw new BusinessException(ErrorCodes.NotFound, "用户不存在"); diff --git a/src/Application/TakeoutSaaS.Application/Identity/Services/MiniAuthService.cs b/src/Application/TakeoutSaaS.Application/Identity/Services/MiniAuthService.cs index 25efbf9..5d83289 100644 --- a/src/Application/TakeoutSaaS.Application/Identity/Services/MiniAuthService.cs +++ b/src/Application/TakeoutSaaS.Application/Identity/Services/MiniAuthService.cs @@ -44,7 +44,7 @@ public sealed class MiniAuthService( // 3. 获取当前租户 ID(多租户支持) var tenantId = tenantProvider.GetCurrentTenantId(); - if (tenantId == Guid.Empty) + if (tenantId == 0) { throw new BusinessException(ErrorCodes.BadRequest, "缺少租户标识"); } @@ -95,7 +95,7 @@ public sealed class MiniAuthService( /// 取消令牌 /// 用户档案 /// 用户不存在时抛出 - public async Task GetProfileAsync(Guid userId, CancellationToken cancellationToken = default) + public async Task GetProfileAsync(long userId, CancellationToken cancellationToken = default) { var user = await miniUserRepository.FindByIdAsync(userId, cancellationToken) ?? throw new BusinessException(ErrorCodes.NotFound, "用户不存在"); @@ -113,7 +113,7 @@ public sealed class MiniAuthService( /// 租户 ID /// 取消令牌 /// 用户实体和是否为新用户的元组 - private async Task<(MiniUser user, bool isNew)> GetOrBindMiniUserAsync(string openId, string? unionId, string? nickname, string? avatar, Guid tenantId, CancellationToken cancellationToken) + private async Task<(MiniUser user, bool isNew)> GetOrBindMiniUserAsync(string openId, string? unionId, string? nickname, string? avatar, long tenantId, CancellationToken cancellationToken) { // 检查用户是否已存在 var existing = await miniUserRepository.FindByOpenIdAsync(openId, cancellationToken); diff --git a/src/Application/TakeoutSaaS.Application/Messaging/Events/OrderCreatedEvent.cs b/src/Application/TakeoutSaaS.Application/Messaging/Events/OrderCreatedEvent.cs index be61584..2a84f05 100644 --- a/src/Application/TakeoutSaaS.Application/Messaging/Events/OrderCreatedEvent.cs +++ b/src/Application/TakeoutSaaS.Application/Messaging/Events/OrderCreatedEvent.cs @@ -8,7 +8,7 @@ public sealed class OrderCreatedEvent /// /// 订单标识。 /// - public Guid OrderId { get; init; } + public long OrderId { get; init; } /// /// 订单编号。 @@ -23,7 +23,7 @@ public sealed class OrderCreatedEvent /// /// 所属租户。 /// - public Guid TenantId { get; init; } + public long TenantId { get; init; } /// /// 创建时间(UTC)。 diff --git a/src/Application/TakeoutSaaS.Application/Messaging/Events/PaymentSucceededEvent.cs b/src/Application/TakeoutSaaS.Application/Messaging/Events/PaymentSucceededEvent.cs index f62a88e..b0094f7 100644 --- a/src/Application/TakeoutSaaS.Application/Messaging/Events/PaymentSucceededEvent.cs +++ b/src/Application/TakeoutSaaS.Application/Messaging/Events/PaymentSucceededEvent.cs @@ -8,7 +8,7 @@ public sealed class PaymentSucceededEvent /// /// 订单标识。 /// - public Guid OrderId { get; init; } + public long OrderId { get; init; } /// /// 支付流水号。 @@ -23,7 +23,7 @@ public sealed class PaymentSucceededEvent /// /// 所属租户。 /// - public Guid TenantId { get; init; } + public long TenantId { get; init; } /// /// 支付时间(UTC)。 diff --git a/src/Application/TakeoutSaaS.Application/Sms/Services/VerificationCodeService.cs b/src/Application/TakeoutSaaS.Application/Sms/Services/VerificationCodeService.cs index 042410a..88806c9 100644 --- a/src/Application/TakeoutSaaS.Application/Sms/Services/VerificationCodeService.cs +++ b/src/Application/TakeoutSaaS.Application/Sms/Services/VerificationCodeService.cs @@ -44,7 +44,7 @@ public sealed class VerificationCodeService( var codeOptions = codeOptionsMonitor.CurrentValue; var templateCode = ResolveTemplate(request.Scene, smsOptions); var phone = NormalizePhoneNumber(request.PhoneNumber); - var tenantKey = tenantProvider.GetCurrentTenantId() == Guid.Empty ? "platform" : tenantProvider.GetCurrentTenantId().ToString("N"); + var tenantKey = tenantProvider.GetCurrentTenantId() == 0 ? "platform" : tenantProvider.GetCurrentTenantId().ToString(); var cacheKey = $"{codeOptions.CachePrefix}:{tenantKey}:{request.Scene}:{phone}"; var cooldownKey = $"{cacheKey}:cooldown"; @@ -90,7 +90,7 @@ public sealed class VerificationCodeService( var codeOptions = codeOptionsMonitor.CurrentValue; var phone = NormalizePhoneNumber(request.PhoneNumber); - var tenantKey = tenantProvider.GetCurrentTenantId() == Guid.Empty ? "platform" : tenantProvider.GetCurrentTenantId().ToString("N"); + var tenantKey = tenantProvider.GetCurrentTenantId() == 0 ? "platform" : tenantProvider.GetCurrentTenantId().ToString(); var cacheKey = $"{codeOptions.CachePrefix}:{tenantKey}:{request.Scene}:{phone}"; var cachedCode = await cache.GetStringAsync(cacheKey, cancellationToken).ConfigureAwait(false); diff --git a/src/Application/TakeoutSaaS.Application/Storage/Services/FileStorageService.cs b/src/Application/TakeoutSaaS.Application/Storage/Services/FileStorageService.cs index 05a02f2..f2105c5 100644 --- a/src/Application/TakeoutSaaS.Application/Storage/Services/FileStorageService.cs +++ b/src/Application/TakeoutSaaS.Application/Storage/Services/FileStorageService.cs @@ -212,7 +212,7 @@ public sealed class FileStorageService( private string BuildObjectKey(UploadFileType type, string extension) { var tenantId = tenantProvider.GetCurrentTenantId(); - var tenantSegment = tenantId == Guid.Empty ? "platform" : tenantId.ToString("N"); + var tenantSegment = tenantId == 0 ? "platform" : tenantId.ToString(); var folder = type.ToFolderName(); var now = DateTime.UtcNow; var fileName = $"{Guid.NewGuid():N}{extension}"; diff --git a/src/Application/TakeoutSaaS.Application/TakeoutSaaS.Application.csproj b/src/Application/TakeoutSaaS.Application/TakeoutSaaS.Application.csproj index 15da3e6..e320f29 100644 --- a/src/Application/TakeoutSaaS.Application/TakeoutSaaS.Application.csproj +++ b/src/Application/TakeoutSaaS.Application/TakeoutSaaS.Application.csproj @@ -8,6 +8,7 @@ + diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/AuditableEntityBase.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/AuditableEntityBase.cs index 3aaedf9..6dbcf9c 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/AuditableEntityBase.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/AuditableEntityBase.cs @@ -23,15 +23,15 @@ public abstract class AuditableEntityBase : EntityBase, IAuditableEntity /// /// 创建人用户标识,匿名或系统操作时为 null。 /// - public Guid? CreatedBy { get; set; } + public long? CreatedBy { get; set; } /// /// 最后更新人用户标识,匿名或系统操作时为 null。 /// - public Guid? UpdatedBy { get; set; } + public long? UpdatedBy { get; set; } /// /// 删除人用户标识(软删除),未删除时为 null。 /// - public Guid? DeletedBy { get; set; } + public long? DeletedBy { get; set; } } diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/EntityBase.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/EntityBase.cs index 1cd539e..e1e2aa4 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/EntityBase.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/EntityBase.cs @@ -8,5 +8,5 @@ public abstract class EntityBase /// /// 实体唯一标识。 /// - public Guid Id { get; set; } + public long Id { get; set; } } diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/IAuditableEntity.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/IAuditableEntity.cs index 7168803..844ad54 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/IAuditableEntity.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/IAuditableEntity.cs @@ -23,15 +23,15 @@ public interface IAuditableEntity : ISoftDeleteEntity /// /// 创建人用户标识,匿名或系统操作时为 null。 /// - Guid? CreatedBy { get; set; } + long? CreatedBy { get; set; } /// /// 最后更新人用户标识,匿名或系统操作时为 null。 /// - Guid? UpdatedBy { get; set; } + long? UpdatedBy { get; set; } /// /// 删除人用户标识(软删除),未删除时为 null。 /// - Guid? DeletedBy { get; set; } + long? DeletedBy { get; set; } } diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/IMultiTenantEntity.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/IMultiTenantEntity.cs index 5ea8f7d..1a0fecd 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/IMultiTenantEntity.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/IMultiTenantEntity.cs @@ -8,5 +8,5 @@ public interface IMultiTenantEntity /// /// 所属租户 ID。 /// - Guid TenantId { get; set; } + long TenantId { get; set; } } diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/MultiTenantEntityBase.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/MultiTenantEntityBase.cs index 59bf1f8..df6417e 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/MultiTenantEntityBase.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Entities/MultiTenantEntityBase.cs @@ -8,5 +8,5 @@ public abstract class MultiTenantEntityBase : AuditableEntityBase, IMultiTenantE /// /// 所属租户 ID。 /// - public Guid TenantId { get; set; } + public long TenantId { get; set; } } diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Ids/IIdGenerator.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Ids/IIdGenerator.cs new file mode 100644 index 0000000..ce8dff4 --- /dev/null +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Ids/IIdGenerator.cs @@ -0,0 +1,13 @@ +namespace TakeoutSaaS.Shared.Abstractions.Ids; + +/// +/// 雪花 ID 生成器接口。 +/// +public interface IIdGenerator +{ + /// + /// 生成下一个唯一长整型 ID。 + /// + /// 雪花 ID。 + long NextId(); +} diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Ids/IdGeneratorOptions.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Ids/IdGeneratorOptions.cs new file mode 100644 index 0000000..6d9b40f --- /dev/null +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Ids/IdGeneratorOptions.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; + +namespace TakeoutSaaS.Shared.Abstractions.Ids; + +/// +/// 雪花 ID 生成器配置。 +/// +public sealed class IdGeneratorOptions +{ + /// + /// 配置节名称。 + /// + public const string SectionName = "IdGenerator"; + + /// + /// 工作节点标识,0-31。 + /// + [Range(0, 31)] + public int WorkerId { get; set; } + + /// + /// 机房标识,0-31。 + /// + [Range(0, 31)] + public int DatacenterId { get; set; } +} diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Results/ApiResponse.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Results/ApiResponse.cs index 50401a7..b49a215 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Results/ApiResponse.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Results/ApiResponse.cs @@ -99,6 +99,65 @@ public sealed record ApiResponse return TraceContext.TraceId; } - return Activity.Current?.Id ?? Guid.NewGuid().ToString("N"); + if (!string.IsNullOrWhiteSpace(TraceContext.TraceId)) + { + return TraceContext.TraceId; + } + + if (Activity.Current?.Id is { } id && !string.IsNullOrWhiteSpace(id)) + { + return id; + } + + return IdFallbackGenerator.Instance.NextId().ToString(); + } +} + +internal sealed class IdFallbackGenerator +{ + private static readonly Lazy Lazy = new(() => new IdFallbackGenerator()); + public static IdFallbackGenerator Instance => Lazy.Value; + + private readonly object _sync = new(); + private long _lastTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + private long _sequence; + + private IdFallbackGenerator() + { + } + + public long NextId() + { + lock (_sync) + { + var timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + if (timestamp == _lastTimestamp) + { + _sequence = (_sequence + 1) & 4095; + if (_sequence == 0) + { + timestamp = WaitNextMillis(_lastTimestamp); + } + } + else + { + _sequence = 0; + } + + _lastTimestamp = timestamp; + return ((timestamp - 1577836800000L) << 22) | _sequence; + } + } + + private static long WaitNextMillis(long lastTimestamp) + { + var timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + while (timestamp <= lastTimestamp) + { + Thread.SpinWait(100); + timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + } + + return timestamp; } } diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Security/ICurrentUserAccessor.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Security/ICurrentUserAccessor.cs index 9b7e7fb..ba0d7e2 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Security/ICurrentUserAccessor.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Security/ICurrentUserAccessor.cs @@ -8,7 +8,7 @@ public interface ICurrentUserAccessor /// /// 当前用户 ID,未登录时为 Guid.Empty。 /// - Guid UserId { get; } + long UserId { get; } /// /// 是否已登录。 diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Serialization/SnowflakeIdJsonConverter.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Serialization/SnowflakeIdJsonConverter.cs new file mode 100644 index 0000000..b7f82a0 --- /dev/null +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Serialization/SnowflakeIdJsonConverter.cs @@ -0,0 +1,52 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace TakeoutSaaS.Shared.Abstractions.Serialization; + +/// +/// 将 long 类型的雪花 ID 以字符串形式序列化/反序列化,避免前端精度丢失。 +/// +public sealed class SnowflakeIdJsonConverter : JsonConverter +{ + /// + public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.Number => reader.GetInt64(), + JsonTokenType.String when long.TryParse(reader.GetString(), out var value) => value, + JsonTokenType.Null => 0, + _ => throw new JsonException("无法解析雪花 ID") + }; + } + + /// + public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options) + { + writer.WriteStringValue(value == 0 ? "0" : value.ToString()); + } +} + +/// +/// 可空雪花 ID 转换器。 +/// +public sealed class NullableSnowflakeIdJsonConverter : JsonConverter +{ + /// + public override long? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.Number => reader.GetInt64(), + JsonTokenType.String when long.TryParse(reader.GetString(), out var value) => value, + JsonTokenType.Null => null, + _ => throw new JsonException("无法解析雪花 ID") + }; + } + + /// + public override void Write(Utf8JsonWriter writer, long? value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.HasValue ? value.Value.ToString() : null); + } +} diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Tenancy/ITenantProvider.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Tenancy/ITenantProvider.cs index 41b999f..02c818a 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Tenancy/ITenantProvider.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Tenancy/ITenantProvider.cs @@ -8,5 +8,5 @@ public interface ITenantProvider /// /// 获取当前租户 ID,未解析时返回 Guid.Empty。 /// - Guid GetCurrentTenantId(); + long GetCurrentTenantId(); } diff --git a/src/Core/TakeoutSaaS.Shared.Abstractions/Tenancy/TenantContext.cs b/src/Core/TakeoutSaaS.Shared.Abstractions/Tenancy/TenantContext.cs index a4686a4..a53b38f 100644 --- a/src/Core/TakeoutSaaS.Shared.Abstractions/Tenancy/TenantContext.cs +++ b/src/Core/TakeoutSaaS.Shared.Abstractions/Tenancy/TenantContext.cs @@ -8,7 +8,7 @@ public sealed class TenantContext /// /// 未解析到租户时的默认上下文。 /// - public static TenantContext Empty { get; } = new(Guid.Empty, null, "unresolved"); + public static TenantContext Empty { get; } = new(0, null, "unresolved"); /// /// 初始化租户上下文。 @@ -16,7 +16,7 @@ public sealed class TenantContext /// 租户 ID /// 租户编码(可选) /// 解析来源 - public TenantContext(Guid tenantId, string? tenantCode, string source) + public TenantContext(long tenantId, string? tenantCode, string source) { TenantId = tenantId; TenantCode = tenantCode; @@ -26,7 +26,7 @@ public sealed class TenantContext /// /// 当前租户 ID,未解析时为 Guid.Empty。 /// - public Guid TenantId { get; } + public long TenantId { get; } /// /// 当前租户编码(例如子域名或业务编码),可为空。 @@ -41,5 +41,5 @@ public sealed class TenantContext /// /// 是否已成功解析到租户。 /// - public bool IsResolved => TenantId != Guid.Empty; + public bool IsResolved => TenantId != 0; } diff --git a/src/Core/TakeoutSaaS.Shared.Kernel/Ids/SnowflakeIdGenerator.cs b/src/Core/TakeoutSaaS.Shared.Kernel/Ids/SnowflakeIdGenerator.cs new file mode 100644 index 0000000..533789d --- /dev/null +++ b/src/Core/TakeoutSaaS.Shared.Kernel/Ids/SnowflakeIdGenerator.cs @@ -0,0 +1,111 @@ +using System.Diagnostics; +using System.Security.Cryptography; +using System.Threading; +using TakeoutSaaS.Shared.Abstractions.Ids; + +namespace TakeoutSaaS.Shared.Kernel.Ids; + +/// +/// 基于雪花算法的长整型 ID 生成器。 +/// +public sealed class SnowflakeIdGenerator : IIdGenerator +{ + private const long Twepoch = 1577836800000L; // 2020-01-01 UTC + private const int WorkerIdBits = 5; + private const int DatacenterIdBits = 5; + private const int SequenceBits = 12; + + private const long MaxWorkerId = -1L ^ (-1L << WorkerIdBits); + private const long MaxDatacenterId = -1L ^ (-1L << DatacenterIdBits); + + private const int WorkerIdShift = SequenceBits; + private const int DatacenterIdShift = SequenceBits + WorkerIdBits; + private const int TimestampLeftShift = SequenceBits + WorkerIdBits + DatacenterIdBits; + private const long SequenceMask = -1L ^ (-1L << SequenceBits); + + private readonly long _workerId; + private readonly long _datacenterId; + private long _lastTimestamp = -1L; + private long _sequence; + private readonly object _syncRoot = new(); + + /// + /// 初始化生成器。 + /// + /// 工作节点 ID。 + /// 机房 ID。 + public SnowflakeIdGenerator(long workerId = 0, long datacenterId = 0) + { + _workerId = Normalize(workerId, MaxWorkerId, nameof(workerId)); + _datacenterId = Normalize(datacenterId, MaxDatacenterId, nameof(datacenterId)); + _sequence = RandomNumberGenerator.GetInt32(0, (int)SequenceMask); + } + + /// + public long NextId() + { + lock (_syncRoot) + { + var timestamp = CurrentTimeMillis(); + + if (timestamp < _lastTimestamp) + { + // 时钟回拨时等待到下一毫秒。 + var wait = _lastTimestamp - timestamp; + Thread.Sleep(TimeSpan.FromMilliseconds(wait)); + timestamp = CurrentTimeMillis(); + if (timestamp < _lastTimestamp) + { + throw new InvalidOperationException($"系统时钟回拨 {_lastTimestamp - timestamp} 毫秒,无法生成 ID。"); + } + } + + if (_lastTimestamp == timestamp) + { + _sequence = (_sequence + 1) & SequenceMask; + if (_sequence == 0) + { + timestamp = WaitNextMillis(_lastTimestamp); + } + } + else + { + _sequence = 0; + } + + _lastTimestamp = timestamp; + + var id = ((timestamp - Twepoch) << TimestampLeftShift) + | (_datacenterId << DatacenterIdShift) + | (_workerId << WorkerIdShift) + | _sequence; + + Debug.Assert(id > 0); + return id; + } + } + + private static long WaitNextMillis(long lastTimestamp) + { + var timestamp = CurrentTimeMillis(); + while (timestamp <= lastTimestamp) + { + Thread.SpinWait(50); + timestamp = CurrentTimeMillis(); + } + + return timestamp; + } + + private static long CurrentTimeMillis() => DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + + private static long Normalize(long value, long max, string name) + { + if (value < 0 || value > max) + { + throw new ArgumentOutOfRangeException(name, value, $"取值范围 0~{max}"); + } + + return value; + } +} diff --git a/src/Core/TakeoutSaaS.Shared.Web/Middleware/CorrelationIdMiddleware.cs b/src/Core/TakeoutSaaS.Shared.Web/Middleware/CorrelationIdMiddleware.cs index b3cf763..ddbed3c 100644 --- a/src/Core/TakeoutSaaS.Shared.Web/Middleware/CorrelationIdMiddleware.cs +++ b/src/Core/TakeoutSaaS.Shared.Web/Middleware/CorrelationIdMiddleware.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using TakeoutSaaS.Shared.Abstractions.Diagnostics; +using TakeoutSaaS.Shared.Abstractions.Ids; namespace TakeoutSaaS.Shared.Web.Middleware; @@ -17,11 +18,13 @@ public sealed class CorrelationIdMiddleware private readonly RequestDelegate _next; private readonly ILogger _logger; + private readonly IIdGenerator _idGenerator; - public CorrelationIdMiddleware(RequestDelegate next, ILogger logger) + public CorrelationIdMiddleware(RequestDelegate next, ILogger logger, IIdGenerator idGenerator) { _next = next; _logger = logger; + _idGenerator = idGenerator; } public async Task InvokeAsync(HttpContext context) @@ -52,7 +55,7 @@ public sealed class CorrelationIdMiddleware } } - private static string ResolveTraceId(HttpContext context) + private string ResolveTraceId(HttpContext context) { if (TryGetHeader(context, TraceHeader, out var traceId)) { @@ -64,7 +67,7 @@ public sealed class CorrelationIdMiddleware return requestId; } - return Guid.NewGuid().ToString("N"); + return _idGenerator.NextId().ToString(); } private static bool TryGetHeader(HttpContext context, string headerName, out string value) diff --git a/src/Core/TakeoutSaaS.Shared.Web/Security/ClaimsPrincipalExtensions.cs b/src/Core/TakeoutSaaS.Shared.Web/Security/ClaimsPrincipalExtensions.cs index 8502109..05a90b2 100644 --- a/src/Core/TakeoutSaaS.Shared.Web/Security/ClaimsPrincipalExtensions.cs +++ b/src/Core/TakeoutSaaS.Shared.Web/Security/ClaimsPrincipalExtensions.cs @@ -9,20 +9,20 @@ namespace TakeoutSaaS.Shared.Web.Security; public static class ClaimsPrincipalExtensions { /// - /// 获取当前用户 Id(不存在时返回 Guid.Empty) + /// 获取当前用户 Id(不存在时返回 0)。 /// - public static Guid GetUserId(this ClaimsPrincipal? principal) + public static long GetUserId(this ClaimsPrincipal? principal) { if (principal == null) { - return Guid.Empty; + return 0; } var identifier = principal.FindFirstValue(ClaimTypes.NameIdentifier) ?? principal.FindFirstValue("sub"); - return Guid.TryParse(identifier, out var userId) + return long.TryParse(identifier, out var userId) ? userId - : Guid.Empty; + : 0; } } diff --git a/src/Core/TakeoutSaaS.Shared.Web/Security/HttpContextCurrentUserAccessor.cs b/src/Core/TakeoutSaaS.Shared.Web/Security/HttpContextCurrentUserAccessor.cs index d73fbbd..6256f05 100644 --- a/src/Core/TakeoutSaaS.Shared.Web/Security/HttpContextCurrentUserAccessor.cs +++ b/src/Core/TakeoutSaaS.Shared.Web/Security/HttpContextCurrentUserAccessor.cs @@ -20,23 +20,23 @@ public sealed class HttpContextCurrentUserAccessor : ICurrentUserAccessor } /// - public Guid UserId + public long UserId { get { var principal = _httpContextAccessor.HttpContext?.User; if (principal == null || !principal.Identity?.IsAuthenticated == true) { - return Guid.Empty; + return 0; } var identifier = principal.FindFirstValue(ClaimTypes.NameIdentifier) ?? principal.FindFirstValue("sub"); - return Guid.TryParse(identifier, out var id) ? id : Guid.Empty; + return long.TryParse(identifier, out var id) ? id : 0; } } /// - public bool IsAuthenticated => UserId != Guid.Empty; + public bool IsAuthenticated => UserId != 0; } diff --git a/src/Domain/TakeoutSaaS.Domain/Analytics/Entities/MetricAlertRule.cs b/src/Domain/TakeoutSaaS.Domain/Analytics/Entities/MetricAlertRule.cs index 694dfca..d5ae3ee 100644 --- a/src/Domain/TakeoutSaaS.Domain/Analytics/Entities/MetricAlertRule.cs +++ b/src/Domain/TakeoutSaaS.Domain/Analytics/Entities/MetricAlertRule.cs @@ -11,7 +11,7 @@ public sealed class MetricAlertRule : MultiTenantEntityBase /// /// 关联指标。 /// - public Guid MetricDefinitionId { get; set; } + public long MetricDefinitionId { get; set; } /// /// 触发条件 JSON。 diff --git a/src/Domain/TakeoutSaaS.Domain/Analytics/Entities/MetricSnapshot.cs b/src/Domain/TakeoutSaaS.Domain/Analytics/Entities/MetricSnapshot.cs index cb0e726..234b0a0 100644 --- a/src/Domain/TakeoutSaaS.Domain/Analytics/Entities/MetricSnapshot.cs +++ b/src/Domain/TakeoutSaaS.Domain/Analytics/Entities/MetricSnapshot.cs @@ -10,7 +10,7 @@ public sealed class MetricSnapshot : MultiTenantEntityBase /// /// 指标定义 ID。 /// - public Guid MetricDefinitionId { get; set; } + public long MetricDefinitionId { get; set; } /// /// 维度键(JSON)。 diff --git a/src/Domain/TakeoutSaaS.Domain/Coupons/Entities/Coupon.cs b/src/Domain/TakeoutSaaS.Domain/Coupons/Entities/Coupon.cs index c327f0b..7c375e1 100644 --- a/src/Domain/TakeoutSaaS.Domain/Coupons/Entities/Coupon.cs +++ b/src/Domain/TakeoutSaaS.Domain/Coupons/Entities/Coupon.cs @@ -11,7 +11,7 @@ public sealed class Coupon : MultiTenantEntityBase /// /// 模板标识。 /// - public Guid CouponTemplateId { get; set; } + public long CouponTemplateId { get; set; } /// /// 券码或序列号。 @@ -21,12 +21,12 @@ public sealed class Coupon : MultiTenantEntityBase /// /// 归属用户。 /// - public Guid UserId { get; set; } + public long UserId { get; set; } /// /// 订单 ID(已使用时记录)。 /// - public Guid? OrderId { get; set; } + public long? OrderId { get; set; } /// /// 状态。 diff --git a/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/ChatMessage.cs b/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/ChatMessage.cs index 56799b5..ba0d3e6 100644 --- a/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/ChatMessage.cs +++ b/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/ChatMessage.cs @@ -11,7 +11,7 @@ public sealed class ChatMessage : MultiTenantEntityBase /// /// 会话标识。 /// - public Guid ChatSessionId { get; set; } + public long ChatSessionId { get; set; } /// /// 发送方类型。 @@ -21,7 +21,7 @@ public sealed class ChatMessage : MultiTenantEntityBase /// /// 发送方用户 ID。 /// - public Guid? SenderUserId { get; set; } + public long? SenderUserId { get; set; } /// /// 消息内容。 diff --git a/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/ChatSession.cs b/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/ChatSession.cs index d2528ea..d9ea66d 100644 --- a/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/ChatSession.cs +++ b/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/ChatSession.cs @@ -16,17 +16,17 @@ public sealed class ChatSession : MultiTenantEntityBase /// /// 顾客用户 ID。 /// - public Guid CustomerUserId { get; set; } + public long CustomerUserId { get; set; } /// /// 当前客服员工 ID。 /// - public Guid? AgentUserId { get; set; } + public long? AgentUserId { get; set; } /// /// 所属门店(可空为平台)。 /// - public Guid? StoreId { get; set; } + public long? StoreId { get; set; } /// /// 会话状态。 diff --git a/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/SupportTicket.cs b/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/SupportTicket.cs index 931727d..39c5ae4 100644 --- a/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/SupportTicket.cs +++ b/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/SupportTicket.cs @@ -16,12 +16,12 @@ public sealed class SupportTicket : MultiTenantEntityBase /// /// 客户用户 ID。 /// - public Guid CustomerUserId { get; set; } + public long CustomerUserId { get; set; } /// /// 关联订单(如有)。 /// - public Guid? OrderId { get; set; } + public long? OrderId { get; set; } /// /// 工单主题。 @@ -46,7 +46,7 @@ public sealed class SupportTicket : MultiTenantEntityBase /// /// 指派的客服。 /// - public Guid? AssignedAgentId { get; set; } + public long? AssignedAgentId { get; set; } /// /// 关闭时间。 diff --git a/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/TicketComment.cs b/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/TicketComment.cs index f6abba6..fd24969 100644 --- a/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/TicketComment.cs +++ b/src/Domain/TakeoutSaaS.Domain/CustomerService/Entities/TicketComment.cs @@ -10,12 +10,12 @@ public sealed class TicketComment : MultiTenantEntityBase /// /// 工单标识。 /// - public Guid SupportTicketId { get; set; } + public long SupportTicketId { get; set; } /// /// 评论人 ID。 /// - public Guid? AuthorUserId { get; set; } + public long? AuthorUserId { get; set; } /// /// 评论内容。 diff --git a/src/Domain/TakeoutSaaS.Domain/Deliveries/Entities/DeliveryEvent.cs b/src/Domain/TakeoutSaaS.Domain/Deliveries/Entities/DeliveryEvent.cs index 771f564..a10fd61 100644 --- a/src/Domain/TakeoutSaaS.Domain/Deliveries/Entities/DeliveryEvent.cs +++ b/src/Domain/TakeoutSaaS.Domain/Deliveries/Entities/DeliveryEvent.cs @@ -11,7 +11,7 @@ public sealed class DeliveryEvent : MultiTenantEntityBase /// /// 配送单标识。 /// - public Guid DeliveryOrderId { get; set; } + public long DeliveryOrderId { get; set; } /// /// 事件类型。 diff --git a/src/Domain/TakeoutSaaS.Domain/Deliveries/Entities/DeliveryOrder.cs b/src/Domain/TakeoutSaaS.Domain/Deliveries/Entities/DeliveryOrder.cs index 31dbfc1..c547d6b 100644 --- a/src/Domain/TakeoutSaaS.Domain/Deliveries/Entities/DeliveryOrder.cs +++ b/src/Domain/TakeoutSaaS.Domain/Deliveries/Entities/DeliveryOrder.cs @@ -8,7 +8,7 @@ namespace TakeoutSaaS.Domain.Deliveries.Entities; /// public sealed class DeliveryOrder : MultiTenantEntityBase { - public Guid OrderId { get; set; } + public long OrderId { get; set; } /// /// 配送服务商。 diff --git a/src/Domain/TakeoutSaaS.Domain/Deliveries/Repositories/IDeliveryRepository.cs b/src/Domain/TakeoutSaaS.Domain/Deliveries/Repositories/IDeliveryRepository.cs new file mode 100644 index 0000000..010793d --- /dev/null +++ b/src/Domain/TakeoutSaaS.Domain/Deliveries/Repositories/IDeliveryRepository.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using TakeoutSaaS.Domain.Deliveries.Entities; + +namespace TakeoutSaaS.Domain.Deliveries.Repositories; + +/// +/// 配送聚合仓储契约。 +/// +public interface IDeliveryRepository +{ + /// + /// 依据标识获取配送单。 + /// + Task FindByIdAsync(long deliveryOrderId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 依据订单标识获取配送单。 + /// + Task FindByOrderIdAsync(long orderId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取配送事件轨迹。 + /// + Task> GetEventsAsync(long deliveryOrderId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 新增配送单。 + /// + Task AddDeliveryOrderAsync(DeliveryOrder deliveryOrder, CancellationToken cancellationToken = default); + + /// + /// 新增配送事件。 + /// + Task AddEventAsync(DeliveryEvent deliveryEvent, CancellationToken cancellationToken = default); + + /// + /// 持久化变更。 + /// + Task SaveChangesAsync(CancellationToken cancellationToken = default); +} diff --git a/src/Domain/TakeoutSaaS.Domain/Dictionary/Entities/DictionaryItem.cs b/src/Domain/TakeoutSaaS.Domain/Dictionary/Entities/DictionaryItem.cs index 4d47912..1a38aba 100644 --- a/src/Domain/TakeoutSaaS.Domain/Dictionary/Entities/DictionaryItem.cs +++ b/src/Domain/TakeoutSaaS.Domain/Dictionary/Entities/DictionaryItem.cs @@ -10,7 +10,7 @@ public sealed class DictionaryItem : MultiTenantEntityBase /// /// 关联分组 ID。 /// - public Guid GroupId { get; set; } + public long GroupId { get; set; } /// /// 字典项键。 diff --git a/src/Domain/TakeoutSaaS.Domain/Dictionary/Repositories/IDictionaryRepository.cs b/src/Domain/TakeoutSaaS.Domain/Dictionary/Repositories/IDictionaryRepository.cs index ee338f2..9a9b427 100644 --- a/src/Domain/TakeoutSaaS.Domain/Dictionary/Repositories/IDictionaryRepository.cs +++ b/src/Domain/TakeoutSaaS.Domain/Dictionary/Repositories/IDictionaryRepository.cs @@ -14,7 +14,7 @@ public interface IDictionaryRepository /// /// 依据 ID 获取分组。 /// - Task FindGroupByIdAsync(Guid id, CancellationToken cancellationToken = default); + Task FindGroupByIdAsync(long id, CancellationToken cancellationToken = default); /// /// 依据编码获取分组。 @@ -39,17 +39,17 @@ public interface IDictionaryRepository /// /// 依据 ID 获取字典项。 /// - Task FindItemByIdAsync(Guid id, CancellationToken cancellationToken = default); + Task FindItemByIdAsync(long id, CancellationToken cancellationToken = default); /// /// 获取某分组下的所有字典项。 /// - Task> GetItemsByGroupIdAsync(Guid groupId, CancellationToken cancellationToken = default); + Task> GetItemsByGroupIdAsync(long groupId, CancellationToken cancellationToken = default); /// /// 按分组编码集合获取字典项(可包含系统参数)。 /// - Task> GetItemsByCodesAsync(IEnumerable codes, Guid tenantId, bool includeSystem, CancellationToken cancellationToken = default); + Task> GetItemsByCodesAsync(IEnumerable codes, long tenantId, bool includeSystem, CancellationToken cancellationToken = default); /// /// 新增字典项。 diff --git a/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliateOrder.cs b/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliateOrder.cs index 0b1bb24..856f922 100644 --- a/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliateOrder.cs +++ b/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliateOrder.cs @@ -11,17 +11,17 @@ public sealed class AffiliateOrder : MultiTenantEntityBase /// /// 推广人标识。 /// - public Guid AffiliatePartnerId { get; set; } + public long AffiliatePartnerId { get; set; } /// /// 关联订单。 /// - public Guid OrderId { get; set; } + public long OrderId { get; set; } /// /// 用户 ID。 /// - public Guid BuyerUserId { get; set; } + public long BuyerUserId { get; set; } /// /// 订单金额。 diff --git a/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliatePartner.cs b/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliatePartner.cs index d9ceaa1..551e39d 100644 --- a/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliatePartner.cs +++ b/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliatePartner.cs @@ -11,7 +11,7 @@ public sealed class AffiliatePartner : MultiTenantEntityBase /// /// 用户 ID(如绑定平台账号)。 /// - public Guid? UserId { get; set; } + public long? UserId { get; set; } /// /// 昵称或渠道名称。 diff --git a/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliatePayout.cs b/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliatePayout.cs index 774c4e4..c9955f9 100644 --- a/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliatePayout.cs +++ b/src/Domain/TakeoutSaaS.Domain/Distribution/Entities/AffiliatePayout.cs @@ -11,7 +11,7 @@ public sealed class AffiliatePayout : MultiTenantEntityBase /// /// 合作伙伴标识。 /// - public Guid AffiliatePartnerId { get; set; } + public long AffiliatePartnerId { get; set; } /// /// 结算周期描述。 diff --git a/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CheckInRecord.cs b/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CheckInRecord.cs index 9f41172..011d048 100644 --- a/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CheckInRecord.cs +++ b/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CheckInRecord.cs @@ -10,12 +10,12 @@ public sealed class CheckInRecord : MultiTenantEntityBase /// /// 活动标识。 /// - public Guid CheckInCampaignId { get; set; } + public long CheckInCampaignId { get; set; } /// /// 用户标识。 /// - public Guid UserId { get; set; } + public long UserId { get; set; } /// /// 签到日期(本地)。 diff --git a/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityComment.cs b/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityComment.cs index 3888bfd..f158121 100644 --- a/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityComment.cs +++ b/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityComment.cs @@ -10,12 +10,12 @@ public sealed class CommunityComment : MultiTenantEntityBase /// /// 动态标识。 /// - public Guid PostId { get; set; } + public long PostId { get; set; } /// /// 评论人。 /// - public Guid AuthorUserId { get; set; } + public long AuthorUserId { get; set; } /// /// 评论内容。 @@ -25,7 +25,7 @@ public sealed class CommunityComment : MultiTenantEntityBase /// /// 父级评论 ID。 /// - public Guid? ParentId { get; set; } + public long? ParentId { get; set; } /// /// 状态。 diff --git a/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityPost.cs b/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityPost.cs index 73c7e21..6b77d38 100644 --- a/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityPost.cs +++ b/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityPost.cs @@ -11,7 +11,7 @@ public sealed class CommunityPost : MultiTenantEntityBase /// /// 作者用户 ID。 /// - public Guid AuthorUserId { get; set; } + public long AuthorUserId { get; set; } /// /// 标题。 diff --git a/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityReaction.cs b/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityReaction.cs index b7d5c19..4d1dbdc 100644 --- a/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityReaction.cs +++ b/src/Domain/TakeoutSaaS.Domain/Engagement/Entities/CommunityReaction.cs @@ -11,12 +11,12 @@ public sealed class CommunityReaction : MultiTenantEntityBase /// /// 动态 ID。 /// - public Guid PostId { get; set; } + public long PostId { get; set; } /// /// 用户 ID。 /// - public Guid UserId { get; set; } + public long UserId { get; set; } /// /// 反应类型。 diff --git a/src/Domain/TakeoutSaaS.Domain/GroupBuying/Entities/GroupOrder.cs b/src/Domain/TakeoutSaaS.Domain/GroupBuying/Entities/GroupOrder.cs index e5412de..86d31e3 100644 --- a/src/Domain/TakeoutSaaS.Domain/GroupBuying/Entities/GroupOrder.cs +++ b/src/Domain/TakeoutSaaS.Domain/GroupBuying/Entities/GroupOrder.cs @@ -11,12 +11,12 @@ public sealed class GroupOrder : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 关联商品或套餐。 /// - public Guid ProductId { get; set; } + public long ProductId { get; set; } /// /// 拼单编号。 @@ -26,7 +26,7 @@ public sealed class GroupOrder : MultiTenantEntityBase /// /// 团长用户 ID。 /// - public Guid LeaderUserId { get; set; } + public long LeaderUserId { get; set; } /// /// 成团需要的人数。 diff --git a/src/Domain/TakeoutSaaS.Domain/GroupBuying/Entities/GroupParticipant.cs b/src/Domain/TakeoutSaaS.Domain/GroupBuying/Entities/GroupParticipant.cs index 61e169a..943ab14 100644 --- a/src/Domain/TakeoutSaaS.Domain/GroupBuying/Entities/GroupParticipant.cs +++ b/src/Domain/TakeoutSaaS.Domain/GroupBuying/Entities/GroupParticipant.cs @@ -11,17 +11,17 @@ public sealed class GroupParticipant : MultiTenantEntityBase /// /// 拼单活动标识。 /// - public Guid GroupOrderId { get; set; } + public long GroupOrderId { get; set; } /// /// 对应订单标识。 /// - public Guid OrderId { get; set; } + public long OrderId { get; set; } /// /// 用户标识。 /// - public Guid UserId { get; set; } + public long UserId { get; set; } /// /// 参与状态。 diff --git a/src/Domain/TakeoutSaaS.Domain/Identity/Entities/IdentityUser.cs b/src/Domain/TakeoutSaaS.Domain/Identity/Entities/IdentityUser.cs index 6ccb304..6080712 100644 --- a/src/Domain/TakeoutSaaS.Domain/Identity/Entities/IdentityUser.cs +++ b/src/Domain/TakeoutSaaS.Domain/Identity/Entities/IdentityUser.cs @@ -25,7 +25,7 @@ public sealed class IdentityUser : MultiTenantEntityBase /// /// 所属商户(平台管理员为空)。 /// - public Guid? MerchantId { get; set; } + public long? MerchantId { get; set; } /// /// 角色集合。 diff --git a/src/Domain/TakeoutSaaS.Domain/Identity/Repositories/IIdentityUserRepository.cs b/src/Domain/TakeoutSaaS.Domain/Identity/Repositories/IIdentityUserRepository.cs index 2d5eae1..cc74343 100644 --- a/src/Domain/TakeoutSaaS.Domain/Identity/Repositories/IIdentityUserRepository.cs +++ b/src/Domain/TakeoutSaaS.Domain/Identity/Repositories/IIdentityUserRepository.cs @@ -18,5 +18,5 @@ public interface IIdentityUserRepository /// /// 根据 ID 获取后台用户。 /// - Task FindByIdAsync(Guid userId, CancellationToken cancellationToken = default); + Task FindByIdAsync(long userId, CancellationToken cancellationToken = default); } diff --git a/src/Domain/TakeoutSaaS.Domain/Identity/Repositories/IMiniUserRepository.cs b/src/Domain/TakeoutSaaS.Domain/Identity/Repositories/IMiniUserRepository.cs index 4688ea6..41594c2 100644 --- a/src/Domain/TakeoutSaaS.Domain/Identity/Repositories/IMiniUserRepository.cs +++ b/src/Domain/TakeoutSaaS.Domain/Identity/Repositories/IMiniUserRepository.cs @@ -21,7 +21,7 @@ public interface IMiniUserRepository /// 用户 ID /// 取消令牌 /// 小程序用户,如果不存在则返回 null - Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default); + Task FindByIdAsync(long id, CancellationToken cancellationToken = default); /// /// 创建或更新小程序用户(如果 OpenId 已存在则更新,否则创建)。 @@ -33,5 +33,5 @@ public interface IMiniUserRepository /// 租户 ID /// 取消令牌 /// 创建或更新后的小程序用户 - Task CreateOrUpdateAsync(string openId, string? unionId, string? nickname, string? avatar, Guid tenantId, CancellationToken cancellationToken = default); + Task CreateOrUpdateAsync(string openId, string? unionId, string? nickname, string? avatar, long tenantId, CancellationToken cancellationToken = default); } diff --git a/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryAdjustment.cs b/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryAdjustment.cs index 36b7d59..ef145fd 100644 --- a/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryAdjustment.cs +++ b/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryAdjustment.cs @@ -11,7 +11,7 @@ public sealed class InventoryAdjustment : MultiTenantEntityBase /// /// 对应的库存记录标识。 /// - public Guid InventoryItemId { get; set; } + public long InventoryItemId { get; set; } /// /// 调整类型。 @@ -31,7 +31,7 @@ public sealed class InventoryAdjustment : MultiTenantEntityBase /// /// 操作人标识。 /// - public Guid? OperatorId { get; set; } + public long? OperatorId { get; set; } /// /// 发生时间。 diff --git a/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryBatch.cs b/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryBatch.cs index 8a764b3..eee47f4 100644 --- a/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryBatch.cs +++ b/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryBatch.cs @@ -10,12 +10,12 @@ public sealed class InventoryBatch : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// SKU 标识。 /// - public Guid ProductSkuId { get; set; } + public long ProductSkuId { get; set; } /// /// 批次编号。 diff --git a/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryItem.cs b/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryItem.cs index 6432253..6aca234 100644 --- a/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryItem.cs +++ b/src/Domain/TakeoutSaaS.Domain/Inventory/Entities/InventoryItem.cs @@ -10,12 +10,12 @@ public sealed class InventoryItem : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// SKU 标识。 /// - public Guid ProductSkuId { get; set; } + public long ProductSkuId { get; set; } /// /// 批次编号,可为空表示混批。 diff --git a/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberGrowthLog.cs b/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberGrowthLog.cs index b06f23f..b65003d 100644 --- a/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberGrowthLog.cs +++ b/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberGrowthLog.cs @@ -10,7 +10,7 @@ public sealed class MemberGrowthLog : MultiTenantEntityBase /// /// 会员标识。 /// - public Guid MemberId { get; set; } + public long MemberId { get; set; } /// /// 变动数量。 diff --git a/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberPointLedger.cs b/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberPointLedger.cs index 07c4fbe..3e4dd07 100644 --- a/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberPointLedger.cs +++ b/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberPointLedger.cs @@ -11,7 +11,7 @@ public sealed class MemberPointLedger : MultiTenantEntityBase /// /// 会员标识。 /// - public Guid MemberId { get; set; } + public long MemberId { get; set; } /// /// 变动数量,可为负值。 @@ -31,7 +31,7 @@ public sealed class MemberPointLedger : MultiTenantEntityBase /// /// 来源 ID(订单、活动等)。 /// - public Guid? SourceId { get; set; } + public long? SourceId { get; set; } /// /// 发生时间。 diff --git a/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberProfile.cs b/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberProfile.cs index 7378ccd..32df115 100644 --- a/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberProfile.cs +++ b/src/Domain/TakeoutSaaS.Domain/Membership/Entities/MemberProfile.cs @@ -11,7 +11,7 @@ public sealed class MemberProfile : MultiTenantEntityBase /// /// 用户标识。 /// - public Guid UserId { get; set; } + public long UserId { get; set; } /// /// 手机号。 @@ -31,7 +31,7 @@ public sealed class MemberProfile : MultiTenantEntityBase /// /// 当前会员等级 ID。 /// - public Guid? MemberTierId { get; set; } + public long? MemberTierId { get; set; } /// /// 会员状态。 diff --git a/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantContract.cs b/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantContract.cs index e8a21bb..cf39793 100644 --- a/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantContract.cs +++ b/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantContract.cs @@ -11,7 +11,7 @@ public sealed class MerchantContract : MultiTenantEntityBase /// /// 所属商户标识。 /// - public Guid MerchantId { get; set; } + public long MerchantId { get; set; } /// /// 合同编号。 diff --git a/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantDocument.cs b/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantDocument.cs index 572f718..433e2df 100644 --- a/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantDocument.cs +++ b/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantDocument.cs @@ -11,7 +11,7 @@ public sealed class MerchantDocument : MultiTenantEntityBase /// /// 所属商户标识。 /// - public Guid MerchantId { get; set; } + public long MerchantId { get; set; } /// /// 证照类型。 diff --git a/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantStaff.cs b/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantStaff.cs index 273054a..50026e5 100644 --- a/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantStaff.cs +++ b/src/Domain/TakeoutSaaS.Domain/Merchants/Entities/MerchantStaff.cs @@ -11,12 +11,12 @@ public sealed class MerchantStaff : MultiTenantEntityBase /// /// 所属商户标识。 /// - public Guid MerchantId { get; set; } + public long MerchantId { get; set; } /// /// 可选的关联门店 ID。 /// - public Guid? StoreId { get; set; } + public long? StoreId { get; set; } /// /// 员工姓名。 @@ -36,7 +36,7 @@ public sealed class MerchantStaff : MultiTenantEntityBase /// /// 登录账号 ID(指向统一身份体系)。 /// - public Guid? IdentityUserId { get; set; } + public long? IdentityUserId { get; set; } /// /// 员工角色类型。 diff --git a/src/Domain/TakeoutSaaS.Domain/Merchants/Repositories/IMerchantRepository.cs b/src/Domain/TakeoutSaaS.Domain/Merchants/Repositories/IMerchantRepository.cs new file mode 100644 index 0000000..a735ff7 --- /dev/null +++ b/src/Domain/TakeoutSaaS.Domain/Merchants/Repositories/IMerchantRepository.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using TakeoutSaaS.Domain.Merchants.Entities; +using TakeoutSaaS.Domain.Merchants.Enums; + +namespace TakeoutSaaS.Domain.Merchants.Repositories; + +/// +/// 商户聚合仓储契约,提供基础 CRUD 与查询能力。 +/// +public interface IMerchantRepository +{ + /// + /// 依据标识获取商户。 + /// + Task FindByIdAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 按状态筛选商户列表。 + /// + Task> SearchAsync(long tenantId, MerchantStatus? status, CancellationToken cancellationToken = default); + + /// + /// 获取指定商户的员工列表。 + /// + Task> GetStaffAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取指定商户的合同列表。 + /// + Task> GetContractsAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取指定商户的资质文件列表。 + /// + Task> GetDocumentsAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 新增商户主体。 + /// + Task AddMerchantAsync(Merchant merchant, CancellationToken cancellationToken = default); + + /// + /// 新增商户员工。 + /// + Task AddStaffAsync(MerchantStaff staff, CancellationToken cancellationToken = default); + + /// + /// 新增商户合同。 + /// + Task AddContractAsync(MerchantContract contract, CancellationToken cancellationToken = default); + + /// + /// 新增商户资质文件。 + /// + Task AddDocumentAsync(MerchantDocument document, CancellationToken cancellationToken = default); + + /// + /// 持久化变更。 + /// + Task SaveChangesAsync(CancellationToken cancellationToken = default); +} diff --git a/src/Domain/TakeoutSaaS.Domain/Navigation/Entities/MapLocation.cs b/src/Domain/TakeoutSaaS.Domain/Navigation/Entities/MapLocation.cs index 74d9e14..54524f9 100644 --- a/src/Domain/TakeoutSaaS.Domain/Navigation/Entities/MapLocation.cs +++ b/src/Domain/TakeoutSaaS.Domain/Navigation/Entities/MapLocation.cs @@ -10,7 +10,7 @@ public sealed class MapLocation : MultiTenantEntityBase /// /// 关联门店 ID,可空表示独立 POI。 /// - public Guid? StoreId { get; set; } + public long? StoreId { get; set; } /// /// 名称。 diff --git a/src/Domain/TakeoutSaaS.Domain/Navigation/Entities/NavigationRequest.cs b/src/Domain/TakeoutSaaS.Domain/Navigation/Entities/NavigationRequest.cs index 284f1a5..f1bdf4b 100644 --- a/src/Domain/TakeoutSaaS.Domain/Navigation/Entities/NavigationRequest.cs +++ b/src/Domain/TakeoutSaaS.Domain/Navigation/Entities/NavigationRequest.cs @@ -11,12 +11,12 @@ public sealed class NavigationRequest : MultiTenantEntityBase /// /// 用户 ID。 /// - public Guid UserId { get; set; } + public long UserId { get; set; } /// /// 门店 ID。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 来源通道(小程序、H5 等)。 diff --git a/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CartItem.cs b/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CartItem.cs index d19d659..655e308 100644 --- a/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CartItem.cs +++ b/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CartItem.cs @@ -11,17 +11,17 @@ public sealed class CartItem : MultiTenantEntityBase /// /// 所属购物车标识。 /// - public Guid ShoppingCartId { get; set; } + public long ShoppingCartId { get; set; } /// /// 商品或 SKU 标识。 /// - public Guid ProductId { get; set; } + public long ProductId { get; set; } /// /// SKU 标识。 /// - public Guid? ProductSkuId { get; set; } + public long? ProductSkuId { get; set; } /// /// 商品名称快照。 diff --git a/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CartItemAddon.cs b/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CartItemAddon.cs index eb99a0d..867c098 100644 --- a/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CartItemAddon.cs +++ b/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CartItemAddon.cs @@ -10,7 +10,7 @@ public sealed class CartItemAddon : MultiTenantEntityBase /// /// 所属购物车条目。 /// - public Guid CartItemId { get; set; } + public long CartItemId { get; set; } /// /// 选项名称。 @@ -25,5 +25,5 @@ public sealed class CartItemAddon : MultiTenantEntityBase /// /// 选项 ID(可对应 ProductAddonOption)。 /// - public Guid? OptionId { get; set; } + public long? OptionId { get; set; } } diff --git a/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CheckoutSession.cs b/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CheckoutSession.cs index a3beb7a..314aaa2 100644 --- a/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CheckoutSession.cs +++ b/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/CheckoutSession.cs @@ -11,12 +11,12 @@ public sealed class CheckoutSession : MultiTenantEntityBase /// /// 用户标识。 /// - public Guid UserId { get; set; } + public long UserId { get; set; } /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 会话 Token。 diff --git a/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/ShoppingCart.cs b/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/ShoppingCart.cs index 7928c1e..6c7e6ff 100644 --- a/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/ShoppingCart.cs +++ b/src/Domain/TakeoutSaaS.Domain/Ordering/Entities/ShoppingCart.cs @@ -11,12 +11,12 @@ public sealed class ShoppingCart : MultiTenantEntityBase /// /// 用户标识。 /// - public Guid UserId { get; set; } + public long UserId { get; set; } /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 购物车状态,包含正常/锁定。 diff --git a/src/Domain/TakeoutSaaS.Domain/Orders/Entities/Order.cs b/src/Domain/TakeoutSaaS.Domain/Orders/Entities/Order.cs index 9a1c295..398f8f6 100644 --- a/src/Domain/TakeoutSaaS.Domain/Orders/Entities/Order.cs +++ b/src/Domain/TakeoutSaaS.Domain/Orders/Entities/Order.cs @@ -17,7 +17,7 @@ public sealed class Order : MultiTenantEntityBase /// /// 门店。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 下单渠道。 @@ -62,7 +62,7 @@ public sealed class Order : MultiTenantEntityBase /// /// 预约 ID。 /// - public Guid? ReservationId { get; set; } + public long? ReservationId { get; set; } /// /// 商品总额。 diff --git a/src/Domain/TakeoutSaaS.Domain/Orders/Entities/OrderItem.cs b/src/Domain/TakeoutSaaS.Domain/Orders/Entities/OrderItem.cs index 83681ca..63c5a67 100644 --- a/src/Domain/TakeoutSaaS.Domain/Orders/Entities/OrderItem.cs +++ b/src/Domain/TakeoutSaaS.Domain/Orders/Entities/OrderItem.cs @@ -10,12 +10,12 @@ public sealed class OrderItem : MultiTenantEntityBase /// /// 订单 ID。 /// - public Guid OrderId { get; set; } + public long OrderId { get; set; } /// /// 商品 ID。 /// - public Guid ProductId { get; set; } + public long ProductId { get; set; } /// /// 商品名称。 diff --git a/src/Domain/TakeoutSaaS.Domain/Orders/Entities/OrderStatusHistory.cs b/src/Domain/TakeoutSaaS.Domain/Orders/Entities/OrderStatusHistory.cs index 26823f2..c9b7a55 100644 --- a/src/Domain/TakeoutSaaS.Domain/Orders/Entities/OrderStatusHistory.cs +++ b/src/Domain/TakeoutSaaS.Domain/Orders/Entities/OrderStatusHistory.cs @@ -11,7 +11,7 @@ public sealed class OrderStatusHistory : MultiTenantEntityBase /// /// 订单标识。 /// - public Guid OrderId { get; set; } + public long OrderId { get; set; } /// /// 变更后的状态。 @@ -21,7 +21,7 @@ public sealed class OrderStatusHistory : MultiTenantEntityBase /// /// 操作人标识(可为空表示系统)。 /// - public Guid? OperatorId { get; set; } + public long? OperatorId { get; set; } /// /// 备注信息。 diff --git a/src/Domain/TakeoutSaaS.Domain/Orders/Entities/RefundRequest.cs b/src/Domain/TakeoutSaaS.Domain/Orders/Entities/RefundRequest.cs index d18d4ab..6b333e9 100644 --- a/src/Domain/TakeoutSaaS.Domain/Orders/Entities/RefundRequest.cs +++ b/src/Domain/TakeoutSaaS.Domain/Orders/Entities/RefundRequest.cs @@ -11,7 +11,7 @@ public sealed class RefundRequest : MultiTenantEntityBase /// /// 关联订单标识。 /// - public Guid OrderId { get; set; } + public long OrderId { get; set; } /// /// 退款单号。 diff --git a/src/Domain/TakeoutSaaS.Domain/Orders/Repositories/IOrderRepository.cs b/src/Domain/TakeoutSaaS.Domain/Orders/Repositories/IOrderRepository.cs new file mode 100644 index 0000000..baba30b --- /dev/null +++ b/src/Domain/TakeoutSaaS.Domain/Orders/Repositories/IOrderRepository.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using TakeoutSaaS.Domain.Orders.Entities; +using TakeoutSaaS.Domain.Orders.Enums; +using TakeoutSaaS.Domain.Payments.Enums; + +namespace TakeoutSaaS.Domain.Orders.Repositories; + +/// +/// 订单聚合仓储契约。 +/// +public interface IOrderRepository +{ + /// + /// 依据标识获取订单。 + /// + Task FindByIdAsync(long orderId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 依据订单号获取订单。 + /// + Task FindByOrderNoAsync(string orderNo, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 按状态筛选订单列表。 + /// + Task> SearchAsync(long tenantId, OrderStatus? status, PaymentStatus? paymentStatus, CancellationToken cancellationToken = default); + + /// + /// 获取订单明细行。 + /// + Task> GetItemsAsync(long orderId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取订单状态流转记录。 + /// + Task> GetStatusHistoryAsync(long orderId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取订单退款申请。 + /// + Task> GetRefundsAsync(long orderId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 新增订单。 + /// + Task AddOrderAsync(Order order, CancellationToken cancellationToken = default); + + /// + /// 新增订单明细。 + /// + Task AddItemsAsync(IEnumerable items, CancellationToken cancellationToken = default); + + /// + /// 新增订单状态记录。 + /// + Task AddStatusHistoryAsync(OrderStatusHistory history, CancellationToken cancellationToken = default); + + /// + /// 新增退款申请。 + /// + Task AddRefundAsync(RefundRequest refund, CancellationToken cancellationToken = default); + + /// + /// 持久化变更。 + /// + Task SaveChangesAsync(CancellationToken cancellationToken = default); +} diff --git a/src/Domain/TakeoutSaaS.Domain/Payments/Entities/PaymentRecord.cs b/src/Domain/TakeoutSaaS.Domain/Payments/Entities/PaymentRecord.cs index 2d0923f..7ba0380 100644 --- a/src/Domain/TakeoutSaaS.Domain/Payments/Entities/PaymentRecord.cs +++ b/src/Domain/TakeoutSaaS.Domain/Payments/Entities/PaymentRecord.cs @@ -11,7 +11,7 @@ public sealed class PaymentRecord : MultiTenantEntityBase /// /// 关联订单。 /// - public Guid OrderId { get; set; } + public long OrderId { get; set; } /// /// 支付方式。 diff --git a/src/Domain/TakeoutSaaS.Domain/Payments/Entities/PaymentRefundRecord.cs b/src/Domain/TakeoutSaaS.Domain/Payments/Entities/PaymentRefundRecord.cs index 9e91973..6fa657b 100644 --- a/src/Domain/TakeoutSaaS.Domain/Payments/Entities/PaymentRefundRecord.cs +++ b/src/Domain/TakeoutSaaS.Domain/Payments/Entities/PaymentRefundRecord.cs @@ -11,12 +11,12 @@ public sealed class PaymentRefundRecord : MultiTenantEntityBase /// /// 原支付记录标识。 /// - public Guid PaymentRecordId { get; set; } + public long PaymentRecordId { get; set; } /// /// 关联订单标识。 /// - public Guid OrderId { get; set; } + public long OrderId { get; set; } /// /// 退款金额。 diff --git a/src/Domain/TakeoutSaaS.Domain/Payments/Repositories/IPaymentRepository.cs b/src/Domain/TakeoutSaaS.Domain/Payments/Repositories/IPaymentRepository.cs new file mode 100644 index 0000000..c217ce2 --- /dev/null +++ b/src/Domain/TakeoutSaaS.Domain/Payments/Repositories/IPaymentRepository.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using TakeoutSaaS.Domain.Payments.Entities; + +namespace TakeoutSaaS.Domain.Payments.Repositories; + +/// +/// 支付记录仓储契约。 +/// +public interface IPaymentRepository +{ + /// + /// 依据标识获取支付记录。 + /// + Task FindByIdAsync(long paymentId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 依据订单标识获取支付记录。 + /// + Task FindByOrderIdAsync(long orderId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取支付对应的退款记录。 + /// + Task> GetRefundsAsync(long paymentId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 新增支付记录。 + /// + Task AddPaymentAsync(PaymentRecord payment, CancellationToken cancellationToken = default); + + /// + /// 新增退款记录。 + /// + Task AddRefundAsync(PaymentRefundRecord refund, CancellationToken cancellationToken = default); + + /// + /// 持久化变更。 + /// + Task SaveChangesAsync(CancellationToken cancellationToken = default); +} diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/Product.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/Product.cs index c9617e2..953a322 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/Product.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/Product.cs @@ -11,12 +11,12 @@ public sealed class Product : MultiTenantEntityBase /// /// 所属门店。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 所属分类。 /// - public Guid CategoryId { get; set; } + public long CategoryId { get; set; } /// /// 商品编码。 diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAddonGroup.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAddonGroup.cs index dfd8dd5..605005a 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAddonGroup.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAddonGroup.cs @@ -11,7 +11,7 @@ public sealed class ProductAddonGroup : MultiTenantEntityBase /// /// 所属商品。 /// - public Guid ProductId { get; set; } + public long ProductId { get; set; } /// /// 分组名称。 diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAddonOption.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAddonOption.cs index 3d27185..3ce3047 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAddonOption.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAddonOption.cs @@ -10,7 +10,7 @@ public sealed class ProductAddonOption : MultiTenantEntityBase /// /// 所属加料分组。 /// - public Guid AddonGroupId { get; set; } + public long AddonGroupId { get; set; } /// /// 选项名称。 diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAttributeGroup.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAttributeGroup.cs index 62a9af1..f9b3269 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAttributeGroup.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAttributeGroup.cs @@ -11,7 +11,12 @@ public sealed class ProductAttributeGroup : MultiTenantEntityBase /// /// 关联门店,可为空表示所有门店共享。 /// - public Guid? StoreId { get; set; } + public long? StoreId { get; set; } + + /// + /// 所属商品标识。 + /// + public long ProductId { get; set; } /// /// 分组名称,例如“辣度”“份量”。 diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAttributeOption.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAttributeOption.cs index 80332d3..1ae3c73 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAttributeOption.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductAttributeOption.cs @@ -10,7 +10,7 @@ public sealed class ProductAttributeOption : MultiTenantEntityBase /// /// 所属规格组。 /// - public Guid AttributeGroupId { get; set; } + public long AttributeGroupId { get; set; } /// /// 选项名称。 diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductCategory.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductCategory.cs index 4d055a2..ab2afb2 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductCategory.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductCategory.cs @@ -10,7 +10,7 @@ public sealed class ProductCategory : MultiTenantEntityBase /// /// 所属门店。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 分类名称。 diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductMediaAsset.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductMediaAsset.cs index c07ef44..a963b26 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductMediaAsset.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductMediaAsset.cs @@ -11,7 +11,7 @@ public sealed class ProductMediaAsset : MultiTenantEntityBase /// /// 商品标识。 /// - public Guid ProductId { get; set; } + public long ProductId { get; set; } /// /// 媒体类型。 diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductPricingRule.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductPricingRule.cs index bace92a..a92c0fe 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductPricingRule.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductPricingRule.cs @@ -11,7 +11,7 @@ public sealed class ProductPricingRule : MultiTenantEntityBase /// /// 所属商品。 /// - public Guid ProductId { get; set; } + public long ProductId { get; set; } /// /// 策略类型。 @@ -42,4 +42,9 @@ public sealed class ProductPricingRule : MultiTenantEntityBase /// 生效星期(JSON 数组)。 /// public string? WeekdaysJson { get; set; } + + /// + /// 排序值。 + /// + public int SortOrder { get; set; } = 100; } diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductSku.cs b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductSku.cs index 1c1e6ce..f20fc17 100644 --- a/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductSku.cs +++ b/src/Domain/TakeoutSaaS.Domain/Products/Entities/ProductSku.cs @@ -10,7 +10,7 @@ public sealed class ProductSku : MultiTenantEntityBase /// /// 所属商品标识。 /// - public Guid ProductId { get; set; } + public long ProductId { get; set; } /// /// SKU 编码。 @@ -46,4 +46,9 @@ public sealed class ProductSku : MultiTenantEntityBase /// 规格属性 JSON(记录选项 ID)。 /// public string AttributesJson { get; set; } = string.Empty; + + /// + /// 排序值。 + /// + public int SortOrder { get; set; } = 100; } diff --git a/src/Domain/TakeoutSaaS.Domain/Products/Repositories/IProductRepository.cs b/src/Domain/TakeoutSaaS.Domain/Products/Repositories/IProductRepository.cs new file mode 100644 index 0000000..093ee81 --- /dev/null +++ b/src/Domain/TakeoutSaaS.Domain/Products/Repositories/IProductRepository.cs @@ -0,0 +1,103 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using TakeoutSaaS.Domain.Products.Entities; +using TakeoutSaaS.Domain.Products.Enums; + +namespace TakeoutSaaS.Domain.Products.Repositories; + +/// +/// 商品聚合仓储契约。 +/// +public interface IProductRepository +{ + /// + /// 依据标识获取商品。 + /// + Task FindByIdAsync(long productId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 按分类与状态筛选商品列表。 + /// + Task> SearchAsync(long tenantId, long? categoryId, ProductStatus? status, CancellationToken cancellationToken = default); + + /// + /// 获取租户下的商品分类。 + /// + Task> GetCategoriesAsync(long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取商品 SKU。 + /// + Task> GetSkusAsync(long productId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取商品加料组与选项。 + /// + Task> GetAddonGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取商品加料选项。 + /// + Task> GetAddonOptionsAsync(long productId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取商品规格组与选项。 + /// + Task> GetAttributeGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取商品规格选项。 + /// + Task> GetAttributeOptionsAsync(long productId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取商品媒资。 + /// + Task> GetMediaAssetsAsync(long productId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取商品定价规则。 + /// + Task> GetPricingRulesAsync(long productId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 新增分类。 + /// + Task AddCategoryAsync(ProductCategory category, CancellationToken cancellationToken = default); + + /// + /// 新增商品。 + /// + Task AddProductAsync(Product product, CancellationToken cancellationToken = default); + + /// + /// 新增 SKU。 + /// + Task AddSkusAsync(IEnumerable skus, CancellationToken cancellationToken = default); + + /// + /// 新增加料组与选项。 + /// + Task AddAddonGroupsAsync(IEnumerable groups, IEnumerable options, CancellationToken cancellationToken = default); + + /// + /// 新增规格组与选项。 + /// + Task AddAttributeGroupsAsync(IEnumerable groups, IEnumerable options, CancellationToken cancellationToken = default); + + /// + /// 新增媒资。 + /// + Task AddMediaAssetsAsync(IEnumerable assets, CancellationToken cancellationToken = default); + + /// + /// 新增定价规则。 + /// + Task AddPricingRulesAsync(IEnumerable rules, CancellationToken cancellationToken = default); + + /// + /// 持久化变更。 + /// + Task SaveChangesAsync(CancellationToken cancellationToken = default); +} diff --git a/src/Domain/TakeoutSaaS.Domain/Queues/Entities/QueueTicket.cs b/src/Domain/TakeoutSaaS.Domain/Queues/Entities/QueueTicket.cs index f09c94e..e235909 100644 --- a/src/Domain/TakeoutSaaS.Domain/Queues/Entities/QueueTicket.cs +++ b/src/Domain/TakeoutSaaS.Domain/Queues/Entities/QueueTicket.cs @@ -8,7 +8,7 @@ namespace TakeoutSaaS.Domain.Queues.Entities; /// public sealed class QueueTicket : MultiTenantEntityBase { - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 排队编号。 diff --git a/src/Domain/TakeoutSaaS.Domain/Reservations/Entities/Reservation.cs b/src/Domain/TakeoutSaaS.Domain/Reservations/Entities/Reservation.cs index 3214ee3..1e846e8 100644 --- a/src/Domain/TakeoutSaaS.Domain/Reservations/Entities/Reservation.cs +++ b/src/Domain/TakeoutSaaS.Domain/Reservations/Entities/Reservation.cs @@ -11,7 +11,7 @@ public sealed class Reservation : MultiTenantEntityBase /// /// 门店。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 预约号。 diff --git a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/Store.cs b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/Store.cs index 5c82a91..f3c8e44 100644 --- a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/Store.cs +++ b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/Store.cs @@ -11,7 +11,7 @@ public sealed class Store : MultiTenantEntityBase /// /// 所属商户标识。 /// - public Guid MerchantId { get; set; } + public long MerchantId { get; set; } /// /// 门店编码,便于扫码及外部对接。 diff --git a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreBusinessHour.cs b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreBusinessHour.cs index a85b0d8..083a46f 100644 --- a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreBusinessHour.cs +++ b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreBusinessHour.cs @@ -11,7 +11,7 @@ public sealed class StoreBusinessHour : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 星期几,0 表示周日。 diff --git a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreDeliveryZone.cs b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreDeliveryZone.cs index e067e1f..9e72e51 100644 --- a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreDeliveryZone.cs +++ b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreDeliveryZone.cs @@ -10,7 +10,7 @@ public sealed class StoreDeliveryZone : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 区域名称。 @@ -36,4 +36,9 @@ public sealed class StoreDeliveryZone : MultiTenantEntityBase /// 预计送达分钟。 /// public int? EstimatedMinutes { get; set; } + + /// + /// 排序值。 + /// + public int SortOrder { get; set; } = 100; } diff --git a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreEmployeeShift.cs b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreEmployeeShift.cs index a1bc39a..a1f0b39 100644 --- a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreEmployeeShift.cs +++ b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreEmployeeShift.cs @@ -11,12 +11,12 @@ public sealed class StoreEmployeeShift : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 员工标识。 /// - public Guid StaffId { get; set; } + public long StaffId { get; set; } /// /// 班次日期。 diff --git a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreHoliday.cs b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreHoliday.cs index c464849..e10edce 100644 --- a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreHoliday.cs +++ b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreHoliday.cs @@ -10,7 +10,7 @@ public sealed class StoreHoliday : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 日期。 diff --git a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreTable.cs b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreTable.cs index 1b55549..97dc86b 100644 --- a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreTable.cs +++ b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreTable.cs @@ -11,12 +11,12 @@ public sealed class StoreTable : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 所在区域 ID。 /// - public Guid? AreaId { get; set; } + public long? AreaId { get; set; } /// /// 桌码。 diff --git a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreTableArea.cs b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreTableArea.cs index 6255266..0fb6fb6 100644 --- a/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreTableArea.cs +++ b/src/Domain/TakeoutSaaS.Domain/Stores/Entities/StoreTableArea.cs @@ -10,7 +10,7 @@ public sealed class StoreTableArea : MultiTenantEntityBase /// /// 门店标识。 /// - public Guid StoreId { get; set; } + public long StoreId { get; set; } /// /// 区域名称。 @@ -21,4 +21,9 @@ public sealed class StoreTableArea : MultiTenantEntityBase /// 区域描述。 /// public string? Description { get; set; } + + /// + /// 排序值。 + /// + public int SortOrder { get; set; } = 100; } diff --git a/src/Domain/TakeoutSaaS.Domain/Stores/Repositories/IStoreRepository.cs b/src/Domain/TakeoutSaaS.Domain/Stores/Repositories/IStoreRepository.cs new file mode 100644 index 0000000..dccde79 --- /dev/null +++ b/src/Domain/TakeoutSaaS.Domain/Stores/Repositories/IStoreRepository.cs @@ -0,0 +1,93 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using TakeoutSaaS.Domain.Stores.Entities; +using TakeoutSaaS.Domain.Stores.Enums; + +namespace TakeoutSaaS.Domain.Stores.Repositories; + +/// +/// 门店聚合仓储契约。 +/// +public interface IStoreRepository +{ + /// + /// 依据标识获取门店。 + /// + Task FindByIdAsync(long storeId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 按租户筛选门店列表。 + /// + Task> SearchAsync(long tenantId, StoreStatus? status, CancellationToken cancellationToken = default); + + /// + /// 获取门店营业时段。 + /// + Task> GetBusinessHoursAsync(long storeId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取门店配送区域配置。 + /// + Task> GetDeliveryZonesAsync(long storeId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取门店节假日配置。 + /// + Task> GetHolidaysAsync(long storeId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取门店桌台区域。 + /// + Task> GetTableAreasAsync(long storeId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取门店桌台列表。 + /// + Task> GetTablesAsync(long storeId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 获取门店员工排班。 + /// + Task> GetShiftsAsync(long storeId, long tenantId, CancellationToken cancellationToken = default); + + /// + /// 新增门店。 + /// + Task AddStoreAsync(Store store, CancellationToken cancellationToken = default); + + /// + /// 新增营业时段。 + /// + Task AddBusinessHoursAsync(IEnumerable hours, CancellationToken cancellationToken = default); + + /// + /// 新增配送区域。 + /// + Task AddDeliveryZonesAsync(IEnumerable zones, CancellationToken cancellationToken = default); + + /// + /// 新增节假日配置。 + /// + Task AddHolidaysAsync(IEnumerable holidays, CancellationToken cancellationToken = default); + + /// + /// 新增桌台区域。 + /// + Task AddTableAreasAsync(IEnumerable areas, CancellationToken cancellationToken = default); + + /// + /// 新增桌台。 + /// + Task AddTablesAsync(IEnumerable tables, CancellationToken cancellationToken = default); + + /// + /// 新增排班。 + /// + Task AddShiftsAsync(IEnumerable shifts, CancellationToken cancellationToken = default); + + /// + /// 持久化变更。 + /// + Task SaveChangesAsync(CancellationToken cancellationToken = default); +} diff --git a/src/Domain/TakeoutSaaS.Domain/Tenants/Entities/Tenant.cs b/src/Domain/TakeoutSaaS.Domain/Tenants/Entities/Tenant.cs index fd65958..b2823e3 100644 --- a/src/Domain/TakeoutSaaS.Domain/Tenants/Entities/Tenant.cs +++ b/src/Domain/TakeoutSaaS.Domain/Tenants/Entities/Tenant.cs @@ -86,7 +86,7 @@ public sealed class Tenant : AuditableEntityBase /// /// 系统内对应的租户所有者账号 ID。 /// - public Guid? PrimaryOwnerUserId { get; set; } + public long? PrimaryOwnerUserId { get; set; } /// /// 租户当前状态,涵盖审核、启用、停用等场景。 diff --git a/src/Domain/TakeoutSaaS.Domain/Tenants/Entities/TenantSubscription.cs b/src/Domain/TakeoutSaaS.Domain/Tenants/Entities/TenantSubscription.cs index a54fce2..3090be2 100644 --- a/src/Domain/TakeoutSaaS.Domain/Tenants/Entities/TenantSubscription.cs +++ b/src/Domain/TakeoutSaaS.Domain/Tenants/Entities/TenantSubscription.cs @@ -11,7 +11,7 @@ public sealed class TenantSubscription : MultiTenantEntityBase /// /// 当前订阅关联的套餐标识。 /// - public Guid TenantPackageId { get; set; } + public long TenantPackageId { get; set; } /// /// 订阅生效时间(UTC)。 @@ -41,7 +41,7 @@ public sealed class TenantSubscription : MultiTenantEntityBase /// /// 若已排期升降配,对应的新套餐 ID。 /// - public Guid? ScheduledPackageId { get; set; } + public long? ScheduledPackageId { get; set; } /// /// 运营备注信息。 diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Extensions/AppServiceCollectionExtensions.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Extensions/AppServiceCollectionExtensions.cs new file mode 100644 index 0000000..02df728 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Extensions/AppServiceCollectionExtensions.cs @@ -0,0 +1,48 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using TakeoutSaaS.Domain.Deliveries.Repositories; +using TakeoutSaaS.Domain.Merchants.Repositories; +using TakeoutSaaS.Domain.Orders.Repositories; +using TakeoutSaaS.Domain.Payments.Repositories; +using TakeoutSaaS.Domain.Products.Repositories; +using TakeoutSaaS.Domain.Stores.Repositories; +using TakeoutSaaS.Infrastructure.App.Options; +using TakeoutSaaS.Infrastructure.App.Persistence; +using TakeoutSaaS.Infrastructure.App.Repositories; +using TakeoutSaaS.Infrastructure.Common.Extensions; +using TakeoutSaaS.Shared.Abstractions.Constants; + +namespace TakeoutSaaS.Infrastructure.App.Extensions; + +/// +/// 业务主库基础设施注册扩展。 +/// +public static class AppServiceCollectionExtensions +{ + /// + /// 注册业务主库 DbContext 与仓储。 + /// + /// 服务集合。 + /// 配置源。 + /// 服务集合。 + public static IServiceCollection AddAppInfrastructure(this IServiceCollection services, IConfiguration configuration) + { + services.AddDatabaseInfrastructure(configuration); + services.AddPostgresDbContext(DatabaseConstants.AppDataSource); + + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + + services.AddOptions() + .Bind(configuration.GetSection(AppSeedOptions.SectionName)) + .ValidateDataAnnotations(); + + services.AddHostedService(); + + return services; + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201044927_InitialApp.Designer.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201044927_InitialApp.Designer.cs deleted file mode 100644 index 56454dc..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201044927_InitialApp.Designer.cs +++ /dev/null @@ -1,949 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using TakeoutSaaS.Infrastructure.App.Persistence; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.App.Migrations -{ - [DbContext(typeof(TakeoutAppDbContext))] - [Migration("20251201044927_InitialApp")] - partial class InitialApp - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryOrder", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CourierName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CourierPhone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeliveryFee") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("DispatchedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FailureReason") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("PickedUpAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Provider") - .HasColumnType("integer"); - - b.Property("ProviderOrderId") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "OrderId") - .IsUnique(); - - b.ToTable("delivery_orders", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.Merchant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BrandAlias") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("BrandName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("BusinessLicenseNumber") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("City") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ContactEmail") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("District") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LegalPerson") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("OnboardedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Province") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ReviewRemarks") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("merchants", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CancelReason") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("CancelledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Channel") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CustomerName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CustomerPhone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveryType") - .HasColumnType("integer"); - - b.Property("DiscountAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("FinishedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ItemsAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("OrderNo") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PaidAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayableAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PaymentStatus") - .HasColumnType("integer"); - - b.Property("QueueNumber") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Remark") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("ReservationId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TableNo") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "OrderNo") - .IsUnique(); - - b.HasIndex("TenantId", "StoreId", "Status"); - - b.ToTable("orders", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AttributesJson") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DiscountAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("ProductName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("SkuName") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("SubTotal") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("Unit") - .HasMaxLength(16) - .HasColumnType("character varying(16)"); - - b.Property("UnitPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("TenantId", "OrderId"); - - b.ToTable("order_items", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Payments.Entities.PaymentRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ChannelTransactionId") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Method") - .HasColumnType("integer"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("PaidAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Payload") - .HasColumnType("text"); - - b.Property("Remark") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("TradeNo") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "OrderId"); - - b.ToTable("payment_records", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("CoverImage") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("EnableDelivery") - .HasColumnType("boolean"); - - b.Property("EnableDineIn") - .HasColumnType("boolean"); - - b.Property("EnablePickup") - .HasColumnType("boolean"); - - b.Property("GalleryImages") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); - - b.Property("IsFeatured") - .HasColumnType("boolean"); - - b.Property("MaxQuantityPerOrder") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("OriginalPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("SpuCode") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StockQuantity") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("Subtitle") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("Unit") - .HasMaxLength(16) - .HasColumnType("character varying(16)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "SpuCode") - .IsUnique(); - - b.HasIndex("TenantId", "StoreId"); - - b.ToTable("products", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("IsEnabled") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId"); - - b.ToTable("product_categories", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Queues.Entities.QueueTicket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CalledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CancelledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EstimatedWaitMinutes") - .HasColumnType("integer"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PartySize") - .HasColumnType("integer"); - - b.Property("Remark") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("TicketNumber") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId"); - - b.HasIndex("TenantId", "StoreId", "TicketNumber") - .IsUnique(); - - b.ToTable("queue_tickets", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Reservations.Entities.Reservation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CancelledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CheckInCode") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CheckedInAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CustomerName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CustomerPhone") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("PeopleCount") - .HasColumnType("integer"); - - b.Property("Remark") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("ReservationNo") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("ReservationTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TablePreference") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ReservationNo") - .IsUnique(); - - b.HasIndex("TenantId", "StoreId"); - - b.ToTable("reservations", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.Store", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Announcement") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("BusinessHours") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("City") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveryRadiusKm") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("District") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Latitude") - .HasColumnType("double precision"); - - b.Property("Longitude") - .HasColumnType("double precision"); - - b.Property("ManagerName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("MerchantId") - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("Phone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Province") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("QueueEnabled") - .HasColumnType("boolean"); - - b.Property("ReservationEnabled") - .HasColumnType("boolean"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("SupportsDelivery") - .HasColumnType("boolean"); - - b.Property("SupportsDineIn") - .HasColumnType("boolean"); - - b.Property("SupportsPickup") - .HasColumnType("boolean"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("MerchantId"); - - b.HasIndex("TenantId", "Code") - .IsUnique(); - - b.HasIndex("TenantId", "MerchantId"); - - b.ToTable("stores", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ContactEmail") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("ContactName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ContactPhone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("Industry") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LogoUrl") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("Remarks") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("ShortName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("tenants", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderItem", b => - { - b.HasOne("TakeoutSaaS.Domain.Orders.Entities.Order", null) - .WithMany() - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.Store", b => - { - b.HasOne("TakeoutSaaS.Domain.Merchants.Entities.Merchant", "Merchant") - .WithMany() - .HasForeignKey("MerchantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Merchant"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201044927_InitialApp.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201044927_InitialApp.cs deleted file mode 100644 index f322c41..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201044927_InitialApp.cs +++ /dev/null @@ -1,497 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.App.Migrations -{ - /// - public partial class InitialApp : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "delivery_orders", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - Provider = table.Column(type: "integer", nullable: false), - ProviderOrderId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - Status = table.Column(type: "integer", nullable: false), - DeliveryFee = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - CourierName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - CourierPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - DispatchedAt = table.Column(type: "timestamp with time zone", nullable: true), - PickedUpAt = table.Column(type: "timestamp with time zone", nullable: true), - DeliveredAt = table.Column(type: "timestamp with time zone", nullable: true), - FailureReason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_delivery_orders", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "merchants", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - BrandName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - BrandAlias = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - LegalPerson = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - BusinessLicenseNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - ContactPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - ContactEmail = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - Province = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - City = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - District = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - Address = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Status = table.Column(type: "integer", nullable: false), - ReviewRemarks = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - OnboardedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_merchants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "orders", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrderNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - Channel = table.Column(type: "integer", nullable: false), - DeliveryType = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "integer", nullable: false), - PaymentStatus = table.Column(type: "integer", nullable: false), - CustomerName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - CustomerPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - TableNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - QueueNumber = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - ReservationId = table.Column(type: "uuid", nullable: true), - ItemsAmount = 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), - PayableAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - PaidAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - PaidAt = table.Column(type: "timestamp with time zone", nullable: true), - FinishedAt = table.Column(type: "timestamp with time zone", nullable: true), - CancelledAt = table.Column(type: "timestamp with time zone", nullable: true), - CancelReason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Remark = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_orders", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "payment_records", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - Method = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "integer", nullable: false), - Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - TradeNo = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - ChannelTransactionId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - PaidAt = table.Column(type: "timestamp with time zone", nullable: true), - Remark = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Payload = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_payment_records", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "product_categories", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Description = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - SortOrder = table.Column(type: "integer", nullable: false), - IsEnabled = table.Column(type: "boolean", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_product_categories", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "products", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - CategoryId = table.Column(type: "uuid", nullable: false), - SpuCode = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Subtitle = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Unit = table.Column(type: "character varying(16)", maxLength: 16, nullable: true), - Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - OriginalPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - StockQuantity = table.Column(type: "integer", nullable: true), - MaxQuantityPerOrder = table.Column(type: "integer", nullable: true), - Status = table.Column(type: "integer", nullable: false), - CoverImage = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - GalleryImages = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - Description = table.Column(type: "text", nullable: true), - EnableDineIn = table.Column(type: "boolean", nullable: false), - EnablePickup = table.Column(type: "boolean", nullable: false), - EnableDelivery = table.Column(type: "boolean", nullable: false), - IsFeatured = table.Column(type: "boolean", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_products", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "queue_tickets", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - TicketNumber = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - PartySize = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "integer", nullable: false), - EstimatedWaitMinutes = table.Column(type: "integer", nullable: true), - CalledAt = table.Column(type: "timestamp with time zone", nullable: true), - ExpiredAt = table.Column(type: "timestamp with time zone", nullable: true), - CancelledAt = table.Column(type: "timestamp with time zone", nullable: true), - Remark = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_queue_tickets", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "reservations", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - ReservationNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - CustomerName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - CustomerPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - PeopleCount = table.Column(type: "integer", nullable: false), - ReservationTime = table.Column(type: "timestamp with time zone", nullable: false), - Status = table.Column(type: "integer", nullable: false), - TablePreference = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - Remark = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - CheckInCode = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - CheckedInAt = table.Column(type: "timestamp with time zone", nullable: true), - CancelledAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_reservations", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "tenants", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Code = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - ShortName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - ContactName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - ContactPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - ContactEmail = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - Industry = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - LogoUrl = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: true), - EffectiveTo = table.Column(type: "timestamp with time zone", nullable: true), - Status = table.Column(type: "integer", nullable: false), - Remarks = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_tenants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "stores", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - MerchantId = table.Column(type: "uuid", nullable: false), - Code = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Phone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - ManagerName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - Status = table.Column(type: "integer", nullable: false), - Province = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - City = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - District = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - Address = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Longitude = table.Column(type: "double precision", nullable: true), - Latitude = table.Column(type: "double precision", nullable: true), - BusinessHours = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - SupportsDineIn = table.Column(type: "boolean", nullable: false), - SupportsPickup = table.Column(type: "boolean", nullable: false), - SupportsDelivery = table.Column(type: "boolean", nullable: false), - DeliveryRadiusKm = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - QueueEnabled = table.Column(type: "boolean", nullable: false), - ReservationEnabled = table.Column(type: "boolean", nullable: false), - Announcement = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_stores", x => x.Id); - table.ForeignKey( - name: "FK_stores_merchants_MerchantId", - column: x => x.MerchantId, - principalTable: "merchants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "order_items", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - ProductName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - SkuName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - Unit = table.Column(type: "character varying(16)", maxLength: 16, nullable: true), - Quantity = table.Column(type: "integer", nullable: false), - UnitPrice = 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), - SubTotal = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - AttributesJson = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_order_items", x => x.Id); - table.ForeignKey( - name: "FK_order_items_orders_OrderId", - column: x => x.OrderId, - principalTable: "orders", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_delivery_orders_TenantId_OrderId", - table: "delivery_orders", - columns: new[] { "TenantId", "OrderId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_merchants_TenantId", - table: "merchants", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "IX_order_items_OrderId", - table: "order_items", - column: "OrderId"); - - migrationBuilder.CreateIndex( - name: "IX_order_items_TenantId_OrderId", - table: "order_items", - columns: new[] { "TenantId", "OrderId" }); - - migrationBuilder.CreateIndex( - name: "IX_orders_TenantId_OrderNo", - table: "orders", - columns: new[] { "TenantId", "OrderNo" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_orders_TenantId_StoreId_Status", - table: "orders", - columns: new[] { "TenantId", "StoreId", "Status" }); - - migrationBuilder.CreateIndex( - name: "IX_payment_records_TenantId_OrderId", - table: "payment_records", - columns: new[] { "TenantId", "OrderId" }); - - migrationBuilder.CreateIndex( - name: "IX_product_categories_TenantId_StoreId", - table: "product_categories", - columns: new[] { "TenantId", "StoreId" }); - - migrationBuilder.CreateIndex( - name: "IX_products_TenantId_SpuCode", - table: "products", - columns: new[] { "TenantId", "SpuCode" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_products_TenantId_StoreId", - table: "products", - columns: new[] { "TenantId", "StoreId" }); - - migrationBuilder.CreateIndex( - name: "IX_queue_tickets_TenantId_StoreId", - table: "queue_tickets", - columns: new[] { "TenantId", "StoreId" }); - - migrationBuilder.CreateIndex( - name: "IX_queue_tickets_TenantId_StoreId_TicketNumber", - table: "queue_tickets", - columns: new[] { "TenantId", "StoreId", "TicketNumber" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_reservations_TenantId_ReservationNo", - table: "reservations", - columns: new[] { "TenantId", "ReservationNo" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_reservations_TenantId_StoreId", - table: "reservations", - columns: new[] { "TenantId", "StoreId" }); - - migrationBuilder.CreateIndex( - name: "IX_stores_MerchantId", - table: "stores", - column: "MerchantId"); - - migrationBuilder.CreateIndex( - name: "IX_stores_TenantId_Code", - table: "stores", - columns: new[] { "TenantId", "Code" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_stores_TenantId_MerchantId", - table: "stores", - columns: new[] { "TenantId", "MerchantId" }); - - migrationBuilder.CreateIndex( - name: "IX_tenants_Code", - table: "tenants", - column: "Code", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "delivery_orders"); - - migrationBuilder.DropTable( - name: "order_items"); - - migrationBuilder.DropTable( - name: "payment_records"); - - migrationBuilder.DropTable( - name: "product_categories"); - - migrationBuilder.DropTable( - name: "products"); - - migrationBuilder.DropTable( - name: "queue_tickets"); - - migrationBuilder.DropTable( - name: "reservations"); - - migrationBuilder.DropTable( - name: "stores"); - - migrationBuilder.DropTable( - name: "tenants"); - - migrationBuilder.DropTable( - name: "orders"); - - migrationBuilder.DropTable( - name: "merchants"); - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201055852_ExpandDomainSchema.Designer.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201055852_ExpandDomainSchema.Designer.cs deleted file mode 100644 index c901204..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201055852_ExpandDomainSchema.Designer.cs +++ /dev/null @@ -1,4330 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using TakeoutSaaS.Infrastructure.App.Persistence; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.App.Migrations -{ - [DbContext(typeof(TakeoutAppDbContext))] - [Migration("20251201055852_ExpandDomainSchema")] - partial class ExpandDomainSchema - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricAlertRule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ConditionJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("MetricDefinitionId") - .HasColumnType("uuid"); - - b.Property("NotificationChannels") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Severity") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "MetricDefinitionId", "Severity"); - - b.ToTable("metric_alert_rules", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DefaultAggregation") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("DimensionsJson") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Code") - .IsUnique(); - - b.ToTable("metric_definitions", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricSnapshot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DimensionKey") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("MetricDefinitionId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WindowEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("WindowStart") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "MetricDefinitionId", "DimensionKey", "WindowStart", "WindowEnd") - .IsUnique(); - - b.ToTable("metric_snapshots", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CouponTemplateId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ExpireAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IssuedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UsedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Code") - .IsUnique(); - - b.ToTable("coupons", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.CouponTemplate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AllowStack") - .HasColumnType("boolean"); - - b.Property("ChannelsJson") - .HasColumnType("text"); - - b.Property("ClaimedQuantity") - .HasColumnType("integer"); - - b.Property("CouponType") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("DiscountCap") - .HasColumnType("numeric"); - - b.Property("MinimumSpend") - .HasColumnType("numeric"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("ProductScopeJson") - .HasColumnType("text"); - - b.Property("RelativeValidDays") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreScopeJson") - .HasColumnType("text"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("TotalQuantity") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("ValidFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("ValidTo") - .HasColumnType("timestamp with time zone"); - - b.Property("Value") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.ToTable("coupon_templates", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.PromotionCampaign", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AudienceDescription") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("BannerUrl") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("Budget") - .HasColumnType("numeric"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("PromotionType") - .HasColumnType("integer"); - - b.Property("RulesJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("promotion_campaigns", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatMessage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ChatSessionId") - .HasColumnType("uuid"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("SenderType") - .HasColumnType("integer"); - - b.Property("SenderUserId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ChatSessionId", "CreatedAt"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatSession", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AgentUserId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CustomerUserId") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsBotActive") - .HasColumnType("boolean"); - - b.Property("SessionCode") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("StartedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "SessionCode") - .IsUnique(); - - b.ToTable("chat_sessions", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.SupportTicket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AssignedAgentId") - .HasColumnType("uuid"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CustomerUserId") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("TicketNo") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "TicketNo") - .IsUnique(); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.TicketComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AttachmentsJson") - .HasColumnType("text"); - - b.Property("AuthorUserId") - .HasColumnType("uuid"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("IsInternal") - .HasColumnType("boolean"); - - b.Property("SupportTicketId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "SupportTicketId"); - - b.ToTable("ticket_comments", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryEvent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveryOrderId") - .HasColumnType("uuid"); - - b.Property("EventType") - .HasColumnType("integer"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("OccurredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Payload") - .HasColumnType("text"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "DeliveryOrderId", "EventType"); - - b.ToTable("delivery_events", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryOrder", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CourierName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CourierPhone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeliveryFee") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("DispatchedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FailureReason") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("PickedUpAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Provider") - .HasColumnType("integer"); - - b.Property("ProviderOrderId") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "OrderId") - .IsUnique(); - - b.ToTable("delivery_orders", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliateOrder", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AffiliatePartnerId") - .HasColumnType("uuid"); - - b.Property("BuyerUserId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EstimatedCommission") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("OrderAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("SettledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "AffiliatePartnerId", "OrderId") - .IsUnique(); - - b.ToTable("affiliate_orders", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePartner", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ChannelType") - .HasColumnType("integer"); - - b.Property("CommissionRate") - .HasColumnType("numeric"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Phone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Remarks") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "DisplayName"); - - b.ToTable("affiliate_partners", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePayout", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AffiliatePartnerId") - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("PaidAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Period") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Remarks") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "AffiliatePartnerId", "Period") - .IsUnique(); - - b.ToTable("affiliate_payouts", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInCampaign", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AllowMakeupCount") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("RewardsJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Name"); - - b.ToTable("checkin_campaigns", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CheckInCampaignId") - .HasColumnType("uuid"); - - b.Property("CheckInDate") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("IsMakeup") - .HasColumnType("boolean"); - - b.Property("RewardJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "CheckInCampaignId", "UserId", "CheckInDate") - .IsUnique(); - - b.ToTable("checkin_records", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AuthorUserId") - .HasColumnType("uuid"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ParentId") - .HasColumnType("uuid"); - - b.Property("PostId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "PostId", "CreatedAt"); - - b.ToTable("community_comments", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityPost", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AuthorUserId") - .HasColumnType("uuid"); - - b.Property("CommentCount") - .HasColumnType("integer"); - - b.Property("Content") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("LikeCount") - .HasColumnType("integer"); - - b.Property("MediaJson") - .HasColumnType("text"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("Title") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "AuthorUserId", "CreatedAt"); - - b.ToTable("community_posts", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("PostId") - .HasColumnType("uuid"); - - b.Property("ReactedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReactionType") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "PostId", "UserId") - .IsUnique(); - - b.ToTable("community_reactions", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.GroupBuying.Entities.GroupOrder", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CancelledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CurrentCount") - .HasColumnType("integer"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GroupOrderNo") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("GroupPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("LeaderUserId") - .HasColumnType("uuid"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("StartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("SucceededAt") - .HasColumnType("timestamp with time zone"); - - b.Property("TargetCount") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "GroupOrderNo") - .IsUnique(); - - b.ToTable("group_orders", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.GroupBuying.Entities.GroupParticipant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("GroupOrderId") - .HasColumnType("uuid"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "GroupOrderId", "UserId") - .IsUnique(); - - b.ToTable("group_participants", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryAdjustment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AdjustmentType") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("InventoryItemId") - .HasColumnType("uuid"); - - b.Property("OccurredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("OperatorId") - .HasColumnType("uuid"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "InventoryItemId", "OccurredAt"); - - b.ToTable("inventory_adjustments", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryBatch", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("BatchNumber") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ExpireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("ProductSkuId") - .HasColumnType("uuid"); - - b.Property("ProductionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("RemainingQuantity") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "ProductSkuId", "BatchNumber") - .IsUnique(); - - b.ToTable("inventory_batches", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("BatchNumber") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ExpireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Location") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ProductSkuId") - .HasColumnType("uuid"); - - b.Property("QuantityOnHand") - .HasColumnType("integer"); - - b.Property("QuantityReserved") - .HasColumnType("integer"); - - b.Property("SafetyStock") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "ProductSkuId", "BatchNumber"); - - b.ToTable("inventory_items", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberGrowthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ChangeValue") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CurrentValue") - .HasColumnType("integer"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("MemberId") - .HasColumnType("uuid"); - - b.Property("Notes") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("OccurredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "MemberId", "OccurredAt"); - - b.ToTable("member_growth_logs", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberPointLedger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("BalanceAfterChange") - .HasColumnType("integer"); - - b.Property("ChangeAmount") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ExpireAt") - .HasColumnType("timestamp with time zone"); - - b.Property("MemberId") - .HasColumnType("uuid"); - - b.Property("OccurredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Reason") - .HasColumnType("integer"); - - b.Property("SourceId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "MemberId", "OccurredAt"); - - b.ToTable("member_point_ledgers", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberProfile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AvatarUrl") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BirthDate") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("GrowthValue") - .HasColumnType("integer"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("MemberTierId") - .HasColumnType("uuid"); - - b.Property("Mobile") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Nickname") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("PointsBalance") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Mobile") - .IsUnique(); - - b.ToTable("member_profiles", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberTier", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("BenefitsJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("RequiredGrowth") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Name") - .IsUnique(); - - b.ToTable("member_tiers", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.Merchant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BrandAlias") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("BrandName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("BusinessLicenseImageUrl") - .HasColumnType("text"); - - b.Property("BusinessLicenseNumber") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Category") - .HasColumnType("text"); - - b.Property("City") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ContactEmail") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("District") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LastReviewedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Latitude") - .HasColumnType("double precision"); - - b.Property("LegalPerson") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LogoUrl") - .HasColumnType("text"); - - b.Property("Longitude") - .HasColumnType("double precision"); - - b.Property("Province") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ReviewRemarks") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("ServicePhone") - .HasColumnType("text"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("SupportEmail") - .HasColumnType("text"); - - b.Property("TaxNumber") - .HasColumnType("text"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("merchants", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantContract", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ContractNumber") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("FileUrl") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("MerchantId") - .HasColumnType("uuid"); - - b.Property("SignedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("TerminatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("TerminationReason") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "MerchantId", "ContractNumber") - .IsUnique(); - - b.ToTable("merchant_contracts", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantDocument", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DocumentNumber") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("DocumentType") - .HasColumnType("integer"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FileUrl") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("IssuedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("MerchantId") - .HasColumnType("uuid"); - - b.Property("Remarks") - .HasColumnType("text"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "MerchantId", "DocumentType"); - - b.ToTable("merchant_documents", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantStaff", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Email") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("IdentityUserId") - .HasColumnType("uuid"); - - b.Property("MerchantId") - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("PermissionsJson") - .HasColumnType("text"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("RoleType") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "MerchantId", "Phone"); - - b.ToTable("merchant_staff", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Navigation.Entities.MapLocation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Landmark") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("Latitude") - .HasColumnType("double precision"); - - b.Property("Longitude") - .HasColumnType("double precision"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId"); - - b.ToTable("map_locations", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Navigation.Entities.NavigationRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Channel") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("RequestedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TargetApp") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "UserId", "StoreId", "RequestedAt"); - - b.ToTable("navigation_requests", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CartItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AttributesJson") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("ProductName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("ProductSkuId") - .HasColumnType("uuid"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Remark") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ShoppingCartId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UnitPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ShoppingCartId"); - - b.ToTable("cart_items", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CartItemAddon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CartItemId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ExtraPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("OptionId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("cart_item_addons", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CheckoutSession", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone"); - - b.Property("SessionToken") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("ValidationResultJson") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "SessionToken") - .IsUnique(); - - b.ToTable("checkout_sessions", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.ShoppingCart", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveryPreference") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("LastModifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TableContext") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "UserId", "StoreId") - .IsUnique(); - - b.ToTable("shopping_carts", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CancelReason") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("CancelledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Channel") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CustomerName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CustomerPhone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveryType") - .HasColumnType("integer"); - - b.Property("DiscountAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("FinishedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ItemsAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("OrderNo") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PaidAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayableAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PaymentStatus") - .HasColumnType("integer"); - - b.Property("QueueNumber") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Remark") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("ReservationId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TableNo") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "OrderNo") - .IsUnique(); - - b.HasIndex("TenantId", "StoreId", "Status"); - - b.ToTable("orders", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AttributesJson") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DiscountAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("ProductName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("SkuName") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("SubTotal") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("Unit") - .HasMaxLength(16) - .HasColumnType("character varying(16)"); - - b.Property("UnitPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("TenantId", "OrderId"); - - b.ToTable("order_items", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderStatusHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Notes") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("OccurredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("OperatorId") - .HasColumnType("uuid"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "OrderId", "OccurredAt"); - - b.ToTable("order_status_histories", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.RefundRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("ProcessedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("RefundNo") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("RequestedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReviewNotes") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "RefundNo") - .IsUnique(); - - b.ToTable("refund_requests", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Payments.Entities.PaymentRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ChannelTransactionId") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Method") - .HasColumnType("integer"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("PaidAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Payload") - .HasColumnType("text"); - - b.Property("Remark") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("TradeNo") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "OrderId"); - - b.ToTable("payment_records", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Payments.Entities.PaymentRefundRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ChannelRefundId") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Payload") - .HasColumnType("text"); - - b.Property("PaymentRecordId") - .HasColumnType("uuid"); - - b.Property("RequestedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "PaymentRecordId"); - - b.ToTable("payment_refund_records", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("CoverImage") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("EnableDelivery") - .HasColumnType("boolean"); - - b.Property("EnableDineIn") - .HasColumnType("boolean"); - - b.Property("EnablePickup") - .HasColumnType("boolean"); - - b.Property("GalleryImages") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); - - b.Property("IsFeatured") - .HasColumnType("boolean"); - - b.Property("MaxQuantityPerOrder") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("OriginalPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("SpuCode") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StockQuantity") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("Subtitle") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("Unit") - .HasMaxLength(16) - .HasColumnType("character varying(16)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "SpuCode") - .IsUnique(); - - b.HasIndex("TenantId", "StoreId"); - - b.ToTable("products", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAddonGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("IsRequired") - .HasColumnType("boolean"); - - b.Property("MaxSelect") - .HasColumnType("integer"); - - b.Property("MinSelect") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("SelectionType") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ProductId", "Name"); - - b.ToTable("product_addon_groups", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAddonOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AddonGroupId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ExtraPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("IsDefault") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("product_addon_options", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAttributeGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("IsRequired") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SelectionType") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "Name"); - - b.ToTable("product_attribute_groups", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAttributeOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AttributeGroupId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("ExtraPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("IsDefault") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "AttributeGroupId", "Name") - .IsUnique(); - - b.ToTable("product_attribute_options", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("IsEnabled") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId"); - - b.ToTable("product_categories", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductMediaAsset", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Caption") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("MediaType") - .HasColumnType("integer"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.HasKey("Id"); - - b.ToTable("product_media_assets", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductPricingRule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ConditionsJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("RuleType") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("WeekdaysJson") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ProductId", "RuleType"); - - b.ToTable("product_pricing_rules", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductSku", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AttributesJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("Barcode") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("OriginalPrice") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("SkuCode") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("StockQuantity") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("Weight") - .HasPrecision(10, 3) - .HasColumnType("numeric(10,3)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "SkuCode") - .IsUnique(); - - b.ToTable("product_skus", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Queues.Entities.QueueTicket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CalledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CancelledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EstimatedWaitMinutes") - .HasColumnType("integer"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PartySize") - .HasColumnType("integer"); - - b.Property("Remark") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("TicketNumber") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId"); - - b.HasIndex("TenantId", "StoreId", "TicketNumber") - .IsUnique(); - - b.ToTable("queue_tickets", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Reservations.Entities.Reservation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CancelledAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CheckInCode") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CheckedInAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CustomerName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CustomerPhone") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("PeopleCount") - .HasColumnType("integer"); - - b.Property("Remark") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("ReservationNo") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("ReservationTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TablePreference") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ReservationNo") - .IsUnique(); - - b.HasIndex("TenantId", "StoreId"); - - b.ToTable("reservations", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.Store", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Announcement") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("BusinessHours") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("City") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CoverImageUrl") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveryRadiusKm") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("District") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Latitude") - .HasColumnType("double precision"); - - b.Property("Longitude") - .HasColumnType("double precision"); - - b.Property("ManagerName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("MerchantId") - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("Phone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Province") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("SupportsDelivery") - .HasColumnType("boolean"); - - b.Property("SupportsDineIn") - .HasColumnType("boolean"); - - b.Property("SupportsPickup") - .HasColumnType("boolean"); - - b.Property("SupportsQueueing") - .HasColumnType("boolean"); - - b.Property("SupportsReservation") - .HasColumnType("boolean"); - - b.Property("Tags") - .HasColumnType("text"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Code") - .IsUnique(); - - b.HasIndex("TenantId", "MerchantId"); - - b.ToTable("stores", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreBusinessHour", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CapacityLimit") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DayOfWeek") - .HasColumnType("integer"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("HourType") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "DayOfWeek"); - - b.ToTable("store_business_hours", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreDeliveryZone", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DeliveryFee") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("MinimumOrderAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PolygonGeoJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("ZoneName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "ZoneName"); - - b.ToTable("store_delivery_zones", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreEmployeeShift", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("Notes") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("RoleType") - .HasColumnType("integer"); - - b.Property("ShiftDate") - .HasColumnType("timestamp with time zone"); - - b.Property("StaffId") - .HasColumnType("uuid"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "ShiftDate", "StaffId") - .IsUnique(); - - b.ToTable("store_employee_shifts", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreHoliday", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("Date") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("IsClosed") - .HasColumnType("boolean"); - - b.Property("Reason") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "Date") - .IsUnique(); - - b.ToTable("store_holidays", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AreaId") - .HasColumnType("uuid"); - - b.Property("Capacity") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("QrCodeUrl") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TableCode") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Tags") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "TableCode") - .IsUnique(); - - b.ToTable("store_tables", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreTableArea", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("StoreId") - .HasColumnType("uuid"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StoreId", "Name") - .IsUnique(); - - b.ToTable("store_table_areas", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("City") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ContactEmail") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("ContactName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ContactPhone") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CoverImageUrl") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("Industry") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LegalEntityName") - .HasColumnType("text"); - - b.Property("LogoUrl") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("PrimaryOwnerUserId") - .HasColumnType("uuid"); - - b.Property("Province") - .HasColumnType("text"); - - b.Property("Remarks") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("ShortName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("SuspendedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("SuspensionReason") - .HasColumnType("text"); - - b.Property("Tags") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("Website") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("tenants", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantBillingStatement", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AmountDue") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("AmountPaid") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LineItemsJson") - .HasColumnType("text"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("StatementNo") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "StatementNo") - .IsUnique(); - - b.ToTable("tenant_billing_statements", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantNotification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Channel") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); - - b.Property("MetadataJson") - .HasColumnType("text"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("SentAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Severity") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Channel", "SentAt"); - - b.ToTable("tenant_notifications", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantPackage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("FeaturePoliciesJson") - .HasColumnType("text"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("MaxAccountCount") - .HasColumnType("integer"); - - b.Property("MaxDeliveryOrders") - .HasColumnType("integer"); - - b.Property("MaxSmsCredits") - .HasColumnType("integer"); - - b.Property("MaxStorageGb") - .HasColumnType("integer"); - - b.Property("MaxStoreCount") - .HasColumnType("integer"); - - b.Property("MonthlyPrice") - .HasColumnType("numeric"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("PackageType") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("YearlyPrice") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.ToTable("tenant_packages", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantQuotaUsage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("LastResetAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LimitValue") - .HasColumnType("numeric"); - - b.Property("QuotaType") - .HasColumnType("integer"); - - b.Property("ResetCycle") - .HasColumnType("text"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("UsedValue") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "QuotaType") - .IsUnique(); - - b.ToTable("tenant_quota_usages", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AutoRenew") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("NextBillingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasColumnType("text"); - - b.Property("ScheduledPackageId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("TenantPackageId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "TenantPackageId"); - - b.ToTable("tenant_subscriptions", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderItem", b => - { - b.HasOne("TakeoutSaaS.Domain.Orders.Entities.Order", null) - .WithMany() - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201055852_ExpandDomainSchema.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201055852_ExpandDomainSchema.cs deleted file mode 100644 index fc4cb04..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201055852_ExpandDomainSchema.cs +++ /dev/null @@ -1,2206 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.App.Migrations -{ - /// - public partial class ExpandDomainSchema : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_stores_merchants_MerchantId", - table: "stores"); - - migrationBuilder.DropIndex( - name: "IX_stores_MerchantId", - table: "stores"); - - migrationBuilder.RenameColumn( - name: "ReservationEnabled", - table: "stores", - newName: "SupportsReservation"); - - migrationBuilder.RenameColumn( - name: "QueueEnabled", - table: "stores", - newName: "SupportsQueueing"); - - migrationBuilder.RenameColumn( - name: "OnboardedAt", - table: "merchants", - newName: "LastReviewedAt"); - - migrationBuilder.AddColumn( - name: "Address", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "City", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Country", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "CoverImageUrl", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "LegalEntityName", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "PrimaryOwnerUserId", - table: "tenants", - type: "uuid", - nullable: true); - - migrationBuilder.AddColumn( - name: "Province", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "SuspendedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "SuspensionReason", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Tags", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Website", - table: "tenants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Country", - table: "stores", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "CoverImageUrl", - table: "stores", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Description", - table: "stores", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Tags", - table: "stores", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "BusinessLicenseImageUrl", - table: "merchants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Category", - table: "merchants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "JoinedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "Latitude", - table: "merchants", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "LogoUrl", - table: "merchants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Longitude", - table: "merchants", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "ServicePhone", - table: "merchants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "SupportEmail", - table: "merchants", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "TaxNumber", - table: "merchants", - type: "text", - nullable: true); - - migrationBuilder.CreateTable( - name: "affiliate_orders", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - AffiliatePartnerId = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - BuyerUserId = table.Column(type: "uuid", nullable: false), - OrderAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - EstimatedCommission = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Status = table.Column(type: "integer", nullable: false), - SettledAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_affiliate_orders", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "affiliate_partners", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: true), - DisplayName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Phone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - ChannelType = table.Column(type: "integer", nullable: false), - CommissionRate = table.Column(type: "numeric", nullable: false), - Status = table.Column(type: "integer", nullable: false), - Remarks = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_affiliate_partners", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "affiliate_payouts", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - AffiliatePartnerId = table.Column(type: "uuid", nullable: false), - Period = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Status = table.Column(type: "integer", nullable: false), - PaidAt = table.Column(type: "timestamp with time zone", nullable: true), - Remarks = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_affiliate_payouts", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "cart_item_addons", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CartItemId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - ExtraPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - OptionId = table.Column(type: "uuid", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_cart_item_addons", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "cart_items", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ShoppingCartId = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - ProductSkuId = table.Column(type: "uuid", nullable: true), - ProductName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - UnitPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Quantity = table.Column(type: "integer", nullable: false), - Remark = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Status = table.Column(type: "integer", nullable: false), - AttributesJson = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_cart_items", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "chat_messages", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ChatSessionId = table.Column(type: "uuid", nullable: false), - SenderType = table.Column(type: "integer", nullable: false), - SenderUserId = table.Column(type: "uuid", nullable: true), - Content = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - ContentType = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - IsRead = table.Column(type: "boolean", nullable: false), - ReadAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_chat_messages", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "chat_sessions", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - SessionCode = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - CustomerUserId = table.Column(type: "uuid", nullable: false), - AgentUserId = table.Column(type: "uuid", nullable: true), - StoreId = table.Column(type: "uuid", nullable: true), - Status = table.Column(type: "integer", nullable: false), - IsBotActive = table.Column(type: "boolean", nullable: false), - StartedAt = table.Column(type: "timestamp with time zone", nullable: false), - EndedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_chat_sessions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "checkin_campaigns", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - StartDate = table.Column(type: "timestamp with time zone", nullable: false), - EndDate = table.Column(type: "timestamp with time zone", nullable: false), - AllowMakeupCount = table.Column(type: "integer", nullable: false), - RewardsJson = table.Column(type: "text", nullable: false), - Status = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_checkin_campaigns", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "checkin_records", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CheckInCampaignId = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - CheckInDate = table.Column(type: "timestamp with time zone", nullable: false), - IsMakeup = table.Column(type: "boolean", nullable: false), - RewardJson = table.Column(type: "text", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_checkin_records", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "checkout_sessions", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - SessionToken = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Status = table.Column(type: "integer", nullable: false), - ValidationResultJson = table.Column(type: "text", nullable: false), - ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_checkout_sessions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "community_comments", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - PostId = table.Column(type: "uuid", nullable: false), - AuthorUserId = table.Column(type: "uuid", nullable: false), - Content = table.Column(type: "character varying(512)", maxLength: 512, nullable: false), - ParentId = table.Column(type: "uuid", nullable: true), - IsDeleted = table.Column(type: "boolean", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_community_comments", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "community_posts", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - AuthorUserId = table.Column(type: "uuid", nullable: false), - Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - Content = table.Column(type: "text", nullable: false), - MediaJson = table.Column(type: "text", nullable: true), - Status = table.Column(type: "integer", nullable: false), - LikeCount = table.Column(type: "integer", nullable: false), - CommentCount = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_community_posts", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "community_reactions", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - PostId = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - ReactionType = table.Column(type: "integer", nullable: false), - ReactedAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_community_reactions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "coupon_templates", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - CouponType = table.Column(type: "integer", nullable: false), - Value = table.Column(type: "numeric", nullable: false), - DiscountCap = table.Column(type: "numeric", nullable: true), - MinimumSpend = table.Column(type: "numeric", nullable: true), - ValidFrom = table.Column(type: "timestamp with time zone", nullable: true), - ValidTo = table.Column(type: "timestamp with time zone", nullable: true), - RelativeValidDays = table.Column(type: "integer", nullable: true), - TotalQuantity = table.Column(type: "integer", nullable: true), - ClaimedQuantity = table.Column(type: "integer", nullable: false), - StoreScopeJson = table.Column(type: "text", nullable: true), - ProductScopeJson = table.Column(type: "text", nullable: true), - ChannelsJson = table.Column(type: "text", nullable: true), - AllowStack = table.Column(type: "boolean", nullable: false), - Status = table.Column(type: "integer", nullable: false), - Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_coupon_templates", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "coupons", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CouponTemplateId = table.Column(type: "uuid", nullable: false), - Code = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: true), - Status = table.Column(type: "integer", nullable: false), - IssuedAt = table.Column(type: "timestamp with time zone", nullable: false), - UsedAt = table.Column(type: "timestamp with time zone", nullable: true), - ExpireAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_coupons", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "delivery_events", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - DeliveryOrderId = table.Column(type: "uuid", nullable: false), - EventType = table.Column(type: "integer", nullable: false), - Message = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - Payload = table.Column(type: "text", nullable: true), - OccurredAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_delivery_events", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "group_orders", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - GroupOrderNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - LeaderUserId = table.Column(type: "uuid", nullable: false), - TargetCount = table.Column(type: "integer", nullable: false), - CurrentCount = table.Column(type: "integer", nullable: false), - GroupPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - StartAt = table.Column(type: "timestamp with time zone", nullable: false), - EndAt = table.Column(type: "timestamp with time zone", nullable: false), - Status = table.Column(type: "integer", nullable: false), - SucceededAt = table.Column(type: "timestamp with time zone", nullable: true), - CancelledAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_group_orders", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "group_participants", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - GroupOrderId = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - Status = table.Column(type: "integer", nullable: false), - JoinedAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_group_participants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "inventory_adjustments", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - InventoryItemId = table.Column(type: "uuid", nullable: false), - AdjustmentType = table.Column(type: "integer", nullable: false), - Quantity = table.Column(type: "integer", nullable: false), - Reason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - OperatorId = table.Column(type: "uuid", nullable: true), - OccurredAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_inventory_adjustments", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "inventory_batches", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - ProductSkuId = table.Column(type: "uuid", nullable: false), - BatchNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - ProductionDate = table.Column(type: "timestamp with time zone", nullable: true), - ExpireDate = table.Column(type: "timestamp with time zone", nullable: true), - Quantity = table.Column(type: "integer", nullable: false), - RemainingQuantity = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_inventory_batches", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "inventory_items", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - ProductSkuId = table.Column(type: "uuid", nullable: false), - BatchNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - QuantityOnHand = table.Column(type: "integer", nullable: false), - QuantityReserved = table.Column(type: "integer", nullable: false), - SafetyStock = table.Column(type: "integer", nullable: true), - Location = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - ExpireDate = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_inventory_items", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "map_locations", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: true), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Address = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - Longitude = table.Column(type: "double precision", nullable: false), - Latitude = table.Column(type: "double precision", nullable: false), - Landmark = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_map_locations", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "member_growth_logs", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - MemberId = table.Column(type: "uuid", nullable: false), - ChangeValue = table.Column(type: "integer", nullable: false), - CurrentValue = table.Column(type: "integer", nullable: false), - Notes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - OccurredAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_member_growth_logs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "member_point_ledgers", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - MemberId = table.Column(type: "uuid", nullable: false), - ChangeAmount = table.Column(type: "integer", nullable: false), - BalanceAfterChange = table.Column(type: "integer", nullable: false), - Reason = table.Column(type: "integer", nullable: false), - SourceId = table.Column(type: "uuid", nullable: true), - OccurredAt = table.Column(type: "timestamp with time zone", nullable: false), - ExpireAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_member_point_ledgers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "member_profiles", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - Mobile = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - Nickname = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - AvatarUrl = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - MemberTierId = table.Column(type: "uuid", nullable: true), - Status = table.Column(type: "integer", nullable: false), - PointsBalance = table.Column(type: "integer", nullable: false), - GrowthValue = table.Column(type: "integer", nullable: false), - BirthDate = table.Column(type: "timestamp with time zone", nullable: true), - JoinedAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_member_profiles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "member_tiers", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - RequiredGrowth = table.Column(type: "integer", nullable: false), - BenefitsJson = table.Column(type: "text", nullable: false), - SortOrder = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_member_tiers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "merchant_contracts", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - MerchantId = table.Column(type: "uuid", nullable: false), - ContractNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Status = table.Column(type: "integer", nullable: false), - StartDate = table.Column(type: "timestamp with time zone", nullable: false), - EndDate = table.Column(type: "timestamp with time zone", nullable: false), - FileUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: false), - SignedAt = table.Column(type: "timestamp with time zone", nullable: true), - TerminatedAt = table.Column(type: "timestamp with time zone", nullable: true), - TerminationReason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_merchant_contracts", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "merchant_documents", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - MerchantId = table.Column(type: "uuid", nullable: false), - DocumentType = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "integer", nullable: false), - FileUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: false), - DocumentNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - IssuedAt = table.Column(type: "timestamp with time zone", nullable: true), - ExpiresAt = table.Column(type: "timestamp with time zone", nullable: true), - Remarks = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_merchant_documents", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "merchant_staff", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - MerchantId = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: true), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Phone = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - Email = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - IdentityUserId = table.Column(type: "uuid", nullable: true), - RoleType = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "integer", nullable: false), - PermissionsJson = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_merchant_staff", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "metric_alert_rules", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - MetricDefinitionId = table.Column(type: "uuid", nullable: false), - ConditionJson = table.Column(type: "text", nullable: false), - Severity = table.Column(type: "integer", nullable: false), - NotificationChannels = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - Enabled = table.Column(type: "boolean", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_metric_alert_rules", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "metric_definitions", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Code = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - DimensionsJson = table.Column(type: "text", nullable: true), - DefaultAggregation = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_metric_definitions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "metric_snapshots", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - MetricDefinitionId = table.Column(type: "uuid", nullable: false), - DimensionKey = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - WindowStart = table.Column(type: "timestamp with time zone", nullable: false), - WindowEnd = table.Column(type: "timestamp with time zone", nullable: false), - Value = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_metric_snapshots", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "navigation_requests", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - Channel = table.Column(type: "integer", nullable: false), - TargetApp = table.Column(type: "integer", nullable: false), - RequestedAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_navigation_requests", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "order_status_histories", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - Status = table.Column(type: "integer", nullable: false), - OperatorId = table.Column(type: "uuid", nullable: true), - Notes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - OccurredAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_order_status_histories", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "payment_refund_records", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - PaymentRecordId = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - ChannelRefundId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - Status = table.Column(type: "integer", nullable: false), - RequestedAt = table.Column(type: "timestamp with time zone", nullable: false), - CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), - Payload = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_payment_refund_records", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "product_addon_groups", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - SelectionType = table.Column(type: "integer", nullable: false), - MinSelect = table.Column(type: "integer", nullable: true), - MaxSelect = table.Column(type: "integer", nullable: true), - IsRequired = table.Column(type: "boolean", nullable: false), - SortOrder = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_product_addon_groups", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "product_addon_options", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - AddonGroupId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - ExtraPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - IsDefault = table.Column(type: "boolean", nullable: false), - SortOrder = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_product_addon_options", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "product_attribute_groups", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: true), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - SelectionType = table.Column(type: "integer", nullable: false), - IsRequired = table.Column(type: "boolean", nullable: false), - SortOrder = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_product_attribute_groups", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "product_attribute_options", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - AttributeGroupId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - ExtraPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - SortOrder = table.Column(type: "integer", nullable: false), - IsDefault = table.Column(type: "boolean", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_product_attribute_options", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "product_media_assets", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - MediaType = table.Column(type: "integer", nullable: false), - Url = table.Column(type: "character varying(512)", maxLength: 512, nullable: false), - Caption = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - SortOrder = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_product_media_assets", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "product_pricing_rules", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - RuleType = table.Column(type: "integer", nullable: false), - ConditionsJson = table.Column(type: "text", nullable: false), - Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - StartTime = table.Column(type: "timestamp with time zone", nullable: true), - EndTime = table.Column(type: "timestamp with time zone", nullable: true), - WeekdaysJson = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_product_pricing_rules", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "product_skus", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - SkuCode = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - Barcode = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - OriginalPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - StockQuantity = table.Column(type: "integer", nullable: true), - Weight = table.Column(type: "numeric(10,3)", precision: 10, scale: 3, nullable: true), - AttributesJson = table.Column(type: "text", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_product_skus", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "promotion_campaigns", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - PromotionType = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "integer", nullable: false), - StartAt = table.Column(type: "timestamp with time zone", nullable: false), - EndAt = table.Column(type: "timestamp with time zone", nullable: false), - Budget = table.Column(type: "numeric", nullable: true), - RulesJson = table.Column(type: "text", nullable: false), - AudienceDescription = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - BannerUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_promotion_campaigns", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "refund_requests", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - RefundNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Reason = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - Status = table.Column(type: "integer", nullable: false), - RequestedAt = table.Column(type: "timestamp with time zone", nullable: false), - ProcessedAt = table.Column(type: "timestamp with time zone", nullable: true), - ReviewNotes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_refund_requests", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "shopping_carts", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - Status = table.Column(type: "integer", nullable: false), - TableContext = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - DeliveryPreference = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - LastModifiedAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_shopping_carts", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "store_business_hours", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - DayOfWeek = table.Column(type: "integer", nullable: false), - HourType = table.Column(type: "integer", nullable: false), - StartTime = table.Column(type: "interval", nullable: false), - EndTime = table.Column(type: "interval", nullable: false), - CapacityLimit = table.Column(type: "integer", nullable: true), - Notes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_store_business_hours", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "store_delivery_zones", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - ZoneName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - PolygonGeoJson = table.Column(type: "text", nullable: false), - MinimumOrderAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - DeliveryFee = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - EstimatedMinutes = table.Column(type: "integer", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_store_delivery_zones", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "store_employee_shifts", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - StaffId = table.Column(type: "uuid", nullable: false), - ShiftDate = table.Column(type: "timestamp with time zone", nullable: false), - StartTime = table.Column(type: "interval", nullable: false), - EndTime = table.Column(type: "interval", nullable: false), - RoleType = table.Column(type: "integer", nullable: false), - Notes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_store_employee_shifts", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "store_holidays", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - Date = table.Column(type: "timestamp with time zone", nullable: false), - IsClosed = table.Column(type: "boolean", nullable: false), - Reason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_store_holidays", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "store_table_areas", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Description = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_store_table_areas", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "store_tables", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StoreId = table.Column(type: "uuid", nullable: false), - AreaId = table.Column(type: "uuid", nullable: true), - TableCode = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - Capacity = table.Column(type: "integer", nullable: false), - Tags = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - Status = table.Column(type: "integer", nullable: false), - QrCodeUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_store_tables", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "support_tickets", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - TicketNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - CustomerUserId = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: true), - Subject = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Description = table.Column(type: "text", nullable: false), - Priority = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "integer", nullable: false), - AssignedAgentId = table.Column(type: "uuid", nullable: true), - ClosedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_support_tickets", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "tenant_billing_statements", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - StatementNo = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - PeriodStart = table.Column(type: "timestamp with time zone", nullable: false), - PeriodEnd = table.Column(type: "timestamp with time zone", nullable: false), - AmountDue = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - AmountPaid = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Status = table.Column(type: "integer", nullable: false), - DueDate = table.Column(type: "timestamp with time zone", nullable: false), - LineItemsJson = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_tenant_billing_statements", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "tenant_notifications", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Message = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - Channel = table.Column(type: "integer", nullable: false), - Severity = table.Column(type: "integer", nullable: false), - SentAt = table.Column(type: "timestamp with time zone", nullable: false), - ReadAt = table.Column(type: "timestamp with time zone", nullable: true), - MetadataJson = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_tenant_notifications", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "tenant_packages", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - PackageType = table.Column(type: "integer", nullable: false), - MonthlyPrice = table.Column(type: "numeric", nullable: true), - YearlyPrice = table.Column(type: "numeric", nullable: true), - MaxStoreCount = table.Column(type: "integer", nullable: true), - MaxAccountCount = table.Column(type: "integer", nullable: true), - MaxStorageGb = table.Column(type: "integer", nullable: true), - MaxSmsCredits = table.Column(type: "integer", nullable: true), - MaxDeliveryOrders = table.Column(type: "integer", nullable: true), - FeaturePoliciesJson = table.Column(type: "text", nullable: true), - IsActive = table.Column(type: "boolean", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_tenant_packages", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "tenant_quota_usages", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - QuotaType = table.Column(type: "integer", nullable: false), - LimitValue = table.Column(type: "numeric", nullable: false), - UsedValue = table.Column(type: "numeric", nullable: false), - ResetCycle = table.Column(type: "text", nullable: true), - LastResetAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_tenant_quota_usages", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "tenant_subscriptions", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - TenantPackageId = table.Column(type: "uuid", nullable: false), - EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: false), - EffectiveTo = table.Column(type: "timestamp with time zone", nullable: false), - NextBillingDate = table.Column(type: "timestamp with time zone", nullable: true), - Status = table.Column(type: "integer", nullable: false), - AutoRenew = table.Column(type: "boolean", nullable: false), - ScheduledPackageId = table.Column(type: "uuid", nullable: true), - Notes = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_tenant_subscriptions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ticket_comments", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - SupportTicketId = table.Column(type: "uuid", nullable: false), - AuthorUserId = table.Column(type: "uuid", nullable: true), - Content = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - IsInternal = table.Column(type: "boolean", nullable: false), - AttachmentsJson = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ticket_comments", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_affiliate_orders_TenantId_AffiliatePartnerId_OrderId", - table: "affiliate_orders", - columns: new[] { "TenantId", "AffiliatePartnerId", "OrderId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_affiliate_partners_TenantId_DisplayName", - table: "affiliate_partners", - columns: new[] { "TenantId", "DisplayName" }); - - migrationBuilder.CreateIndex( - name: "IX_affiliate_payouts_TenantId_AffiliatePartnerId_Period", - table: "affiliate_payouts", - columns: new[] { "TenantId", "AffiliatePartnerId", "Period" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_cart_items_TenantId_ShoppingCartId", - table: "cart_items", - columns: new[] { "TenantId", "ShoppingCartId" }); - - migrationBuilder.CreateIndex( - name: "IX_chat_messages_TenantId_ChatSessionId_CreatedAt", - table: "chat_messages", - columns: new[] { "TenantId", "ChatSessionId", "CreatedAt" }); - - migrationBuilder.CreateIndex( - name: "IX_chat_sessions_TenantId_SessionCode", - table: "chat_sessions", - columns: new[] { "TenantId", "SessionCode" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_checkin_campaigns_TenantId_Name", - table: "checkin_campaigns", - columns: new[] { "TenantId", "Name" }); - - migrationBuilder.CreateIndex( - name: "IX_checkin_records_TenantId_CheckInCampaignId_UserId_CheckInDa~", - table: "checkin_records", - columns: new[] { "TenantId", "CheckInCampaignId", "UserId", "CheckInDate" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_checkout_sessions_TenantId_SessionToken", - table: "checkout_sessions", - columns: new[] { "TenantId", "SessionToken" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_community_comments_TenantId_PostId_CreatedAt", - table: "community_comments", - columns: new[] { "TenantId", "PostId", "CreatedAt" }); - - migrationBuilder.CreateIndex( - name: "IX_community_posts_TenantId_AuthorUserId_CreatedAt", - table: "community_posts", - columns: new[] { "TenantId", "AuthorUserId", "CreatedAt" }); - - migrationBuilder.CreateIndex( - name: "IX_community_reactions_TenantId_PostId_UserId", - table: "community_reactions", - columns: new[] { "TenantId", "PostId", "UserId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_coupons_TenantId_Code", - table: "coupons", - columns: new[] { "TenantId", "Code" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_delivery_events_TenantId_DeliveryOrderId_EventType", - table: "delivery_events", - columns: new[] { "TenantId", "DeliveryOrderId", "EventType" }); - - migrationBuilder.CreateIndex( - name: "IX_group_orders_TenantId_GroupOrderNo", - table: "group_orders", - columns: new[] { "TenantId", "GroupOrderNo" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_group_participants_TenantId_GroupOrderId_UserId", - table: "group_participants", - columns: new[] { "TenantId", "GroupOrderId", "UserId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_inventory_adjustments_TenantId_InventoryItemId_OccurredAt", - table: "inventory_adjustments", - columns: new[] { "TenantId", "InventoryItemId", "OccurredAt" }); - - migrationBuilder.CreateIndex( - name: "IX_inventory_batches_TenantId_StoreId_ProductSkuId_BatchNumber", - table: "inventory_batches", - columns: new[] { "TenantId", "StoreId", "ProductSkuId", "BatchNumber" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_inventory_items_TenantId_StoreId_ProductSkuId_BatchNumber", - table: "inventory_items", - columns: new[] { "TenantId", "StoreId", "ProductSkuId", "BatchNumber" }); - - migrationBuilder.CreateIndex( - name: "IX_map_locations_TenantId_StoreId", - table: "map_locations", - columns: new[] { "TenantId", "StoreId" }); - - migrationBuilder.CreateIndex( - name: "IX_member_growth_logs_TenantId_MemberId_OccurredAt", - table: "member_growth_logs", - columns: new[] { "TenantId", "MemberId", "OccurredAt" }); - - migrationBuilder.CreateIndex( - name: "IX_member_point_ledgers_TenantId_MemberId_OccurredAt", - table: "member_point_ledgers", - columns: new[] { "TenantId", "MemberId", "OccurredAt" }); - - migrationBuilder.CreateIndex( - name: "IX_member_profiles_TenantId_Mobile", - table: "member_profiles", - columns: new[] { "TenantId", "Mobile" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_member_tiers_TenantId_Name", - table: "member_tiers", - columns: new[] { "TenantId", "Name" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_merchant_contracts_TenantId_MerchantId_ContractNumber", - table: "merchant_contracts", - columns: new[] { "TenantId", "MerchantId", "ContractNumber" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_merchant_documents_TenantId_MerchantId_DocumentType", - table: "merchant_documents", - columns: new[] { "TenantId", "MerchantId", "DocumentType" }); - - migrationBuilder.CreateIndex( - name: "IX_merchant_staff_TenantId_MerchantId_Phone", - table: "merchant_staff", - columns: new[] { "TenantId", "MerchantId", "Phone" }); - - migrationBuilder.CreateIndex( - name: "IX_metric_alert_rules_TenantId_MetricDefinitionId_Severity", - table: "metric_alert_rules", - columns: new[] { "TenantId", "MetricDefinitionId", "Severity" }); - - migrationBuilder.CreateIndex( - name: "IX_metric_definitions_TenantId_Code", - table: "metric_definitions", - columns: new[] { "TenantId", "Code" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_metric_snapshots_TenantId_MetricDefinitionId_DimensionKey_W~", - table: "metric_snapshots", - columns: new[] { "TenantId", "MetricDefinitionId", "DimensionKey", "WindowStart", "WindowEnd" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_navigation_requests_TenantId_UserId_StoreId_RequestedAt", - table: "navigation_requests", - columns: new[] { "TenantId", "UserId", "StoreId", "RequestedAt" }); - - migrationBuilder.CreateIndex( - name: "IX_order_status_histories_TenantId_OrderId_OccurredAt", - table: "order_status_histories", - columns: new[] { "TenantId", "OrderId", "OccurredAt" }); - - migrationBuilder.CreateIndex( - name: "IX_payment_refund_records_TenantId_PaymentRecordId", - table: "payment_refund_records", - columns: new[] { "TenantId", "PaymentRecordId" }); - - migrationBuilder.CreateIndex( - name: "IX_product_addon_groups_TenantId_ProductId_Name", - table: "product_addon_groups", - columns: new[] { "TenantId", "ProductId", "Name" }); - - migrationBuilder.CreateIndex( - name: "IX_product_attribute_groups_TenantId_StoreId_Name", - table: "product_attribute_groups", - columns: new[] { "TenantId", "StoreId", "Name" }); - - migrationBuilder.CreateIndex( - name: "IX_product_attribute_options_TenantId_AttributeGroupId_Name", - table: "product_attribute_options", - columns: new[] { "TenantId", "AttributeGroupId", "Name" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_product_pricing_rules_TenantId_ProductId_RuleType", - table: "product_pricing_rules", - columns: new[] { "TenantId", "ProductId", "RuleType" }); - - migrationBuilder.CreateIndex( - name: "IX_product_skus_TenantId_SkuCode", - table: "product_skus", - columns: new[] { "TenantId", "SkuCode" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_refund_requests_TenantId_RefundNo", - table: "refund_requests", - columns: new[] { "TenantId", "RefundNo" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_shopping_carts_TenantId_UserId_StoreId", - table: "shopping_carts", - columns: new[] { "TenantId", "UserId", "StoreId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_store_business_hours_TenantId_StoreId_DayOfWeek", - table: "store_business_hours", - columns: new[] { "TenantId", "StoreId", "DayOfWeek" }); - - migrationBuilder.CreateIndex( - name: "IX_store_delivery_zones_TenantId_StoreId_ZoneName", - table: "store_delivery_zones", - columns: new[] { "TenantId", "StoreId", "ZoneName" }); - - migrationBuilder.CreateIndex( - name: "IX_store_employee_shifts_TenantId_StoreId_ShiftDate_StaffId", - table: "store_employee_shifts", - columns: new[] { "TenantId", "StoreId", "ShiftDate", "StaffId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_store_holidays_TenantId_StoreId_Date", - table: "store_holidays", - columns: new[] { "TenantId", "StoreId", "Date" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_store_table_areas_TenantId_StoreId_Name", - table: "store_table_areas", - columns: new[] { "TenantId", "StoreId", "Name" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_store_tables_TenantId_StoreId_TableCode", - table: "store_tables", - columns: new[] { "TenantId", "StoreId", "TableCode" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_support_tickets_TenantId_TicketNo", - table: "support_tickets", - columns: new[] { "TenantId", "TicketNo" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_tenant_billing_statements_TenantId_StatementNo", - table: "tenant_billing_statements", - columns: new[] { "TenantId", "StatementNo" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_tenant_notifications_TenantId_Channel_SentAt", - table: "tenant_notifications", - columns: new[] { "TenantId", "Channel", "SentAt" }); - - migrationBuilder.CreateIndex( - name: "IX_tenant_quota_usages_TenantId_QuotaType", - table: "tenant_quota_usages", - columns: new[] { "TenantId", "QuotaType" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_tenant_subscriptions_TenantId_TenantPackageId", - table: "tenant_subscriptions", - columns: new[] { "TenantId", "TenantPackageId" }); - - migrationBuilder.CreateIndex( - name: "IX_ticket_comments_TenantId_SupportTicketId", - table: "ticket_comments", - columns: new[] { "TenantId", "SupportTicketId" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "affiliate_orders"); - - migrationBuilder.DropTable( - name: "affiliate_partners"); - - migrationBuilder.DropTable( - name: "affiliate_payouts"); - - migrationBuilder.DropTable( - name: "cart_item_addons"); - - migrationBuilder.DropTable( - name: "cart_items"); - - migrationBuilder.DropTable( - name: "chat_messages"); - - migrationBuilder.DropTable( - name: "chat_sessions"); - - migrationBuilder.DropTable( - name: "checkin_campaigns"); - - migrationBuilder.DropTable( - name: "checkin_records"); - - migrationBuilder.DropTable( - name: "checkout_sessions"); - - migrationBuilder.DropTable( - name: "community_comments"); - - migrationBuilder.DropTable( - name: "community_posts"); - - migrationBuilder.DropTable( - name: "community_reactions"); - - migrationBuilder.DropTable( - name: "coupon_templates"); - - migrationBuilder.DropTable( - name: "coupons"); - - migrationBuilder.DropTable( - name: "delivery_events"); - - migrationBuilder.DropTable( - name: "group_orders"); - - migrationBuilder.DropTable( - name: "group_participants"); - - migrationBuilder.DropTable( - name: "inventory_adjustments"); - - migrationBuilder.DropTable( - name: "inventory_batches"); - - migrationBuilder.DropTable( - name: "inventory_items"); - - migrationBuilder.DropTable( - name: "map_locations"); - - migrationBuilder.DropTable( - name: "member_growth_logs"); - - migrationBuilder.DropTable( - name: "member_point_ledgers"); - - migrationBuilder.DropTable( - name: "member_profiles"); - - migrationBuilder.DropTable( - name: "member_tiers"); - - migrationBuilder.DropTable( - name: "merchant_contracts"); - - migrationBuilder.DropTable( - name: "merchant_documents"); - - migrationBuilder.DropTable( - name: "merchant_staff"); - - migrationBuilder.DropTable( - name: "metric_alert_rules"); - - migrationBuilder.DropTable( - name: "metric_definitions"); - - migrationBuilder.DropTable( - name: "metric_snapshots"); - - migrationBuilder.DropTable( - name: "navigation_requests"); - - migrationBuilder.DropTable( - name: "order_status_histories"); - - migrationBuilder.DropTable( - name: "payment_refund_records"); - - migrationBuilder.DropTable( - name: "product_addon_groups"); - - migrationBuilder.DropTable( - name: "product_addon_options"); - - migrationBuilder.DropTable( - name: "product_attribute_groups"); - - migrationBuilder.DropTable( - name: "product_attribute_options"); - - migrationBuilder.DropTable( - name: "product_media_assets"); - - migrationBuilder.DropTable( - name: "product_pricing_rules"); - - migrationBuilder.DropTable( - name: "product_skus"); - - migrationBuilder.DropTable( - name: "promotion_campaigns"); - - migrationBuilder.DropTable( - name: "refund_requests"); - - migrationBuilder.DropTable( - name: "shopping_carts"); - - migrationBuilder.DropTable( - name: "store_business_hours"); - - migrationBuilder.DropTable( - name: "store_delivery_zones"); - - migrationBuilder.DropTable( - name: "store_employee_shifts"); - - migrationBuilder.DropTable( - name: "store_holidays"); - - migrationBuilder.DropTable( - name: "store_table_areas"); - - migrationBuilder.DropTable( - name: "store_tables"); - - migrationBuilder.DropTable( - name: "support_tickets"); - - migrationBuilder.DropTable( - name: "tenant_billing_statements"); - - migrationBuilder.DropTable( - name: "tenant_notifications"); - - migrationBuilder.DropTable( - name: "tenant_packages"); - - migrationBuilder.DropTable( - name: "tenant_quota_usages"); - - migrationBuilder.DropTable( - name: "tenant_subscriptions"); - - migrationBuilder.DropTable( - name: "ticket_comments"); - - migrationBuilder.DropColumn( - name: "Address", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "City", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "Country", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "CoverImageUrl", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "LegalEntityName", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "PrimaryOwnerUserId", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "Province", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "SuspendedAt", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "SuspensionReason", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "Tags", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "Website", - table: "tenants"); - - migrationBuilder.DropColumn( - name: "Country", - table: "stores"); - - migrationBuilder.DropColumn( - name: "CoverImageUrl", - table: "stores"); - - migrationBuilder.DropColumn( - name: "Description", - table: "stores"); - - migrationBuilder.DropColumn( - name: "Tags", - table: "stores"); - - migrationBuilder.DropColumn( - name: "BusinessLicenseImageUrl", - table: "merchants"); - - migrationBuilder.DropColumn( - name: "Category", - table: "merchants"); - - migrationBuilder.DropColumn( - name: "JoinedAt", - table: "merchants"); - - migrationBuilder.DropColumn( - name: "Latitude", - table: "merchants"); - - migrationBuilder.DropColumn( - name: "LogoUrl", - table: "merchants"); - - migrationBuilder.DropColumn( - name: "Longitude", - table: "merchants"); - - migrationBuilder.DropColumn( - name: "ServicePhone", - table: "merchants"); - - migrationBuilder.DropColumn( - name: "SupportEmail", - table: "merchants"); - - migrationBuilder.DropColumn( - name: "TaxNumber", - table: "merchants"); - - migrationBuilder.RenameColumn( - name: "SupportsReservation", - table: "stores", - newName: "ReservationEnabled"); - - migrationBuilder.RenameColumn( - name: "SupportsQueueing", - table: "stores", - newName: "QueueEnabled"); - - migrationBuilder.RenameColumn( - name: "LastReviewedAt", - table: "merchants", - newName: "OnboardedAt"); - - migrationBuilder.CreateIndex( - name: "IX_stores_MerchantId", - table: "stores", - column: "MerchantId"); - - migrationBuilder.AddForeignKey( - name: "FK_stores_merchants_MerchantId", - table: "stores", - column: "MerchantId", - principalTable: "merchants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201094254_AddEntityComments.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201094254_AddEntityComments.cs deleted file mode 100644 index 38504cd..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201094254_AddEntityComments.cs +++ /dev/null @@ -1,22401 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.App.Migrations -{ - /// - public partial class AddEntityComments : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterTable( - name: "ticket_comments", - comment: "工单评论/流转记录。"); - - migrationBuilder.AlterTable( - name: "tenants", - comment: "平台租户信息,描述租户的生命周期与基础资料。"); - - migrationBuilder.AlterTable( - name: "tenant_subscriptions", - comment: "租户套餐订阅记录。"); - - migrationBuilder.AlterTable( - name: "tenant_quota_usages", - comment: "租户配额使用情况快照。"); - - migrationBuilder.AlterTable( - name: "tenant_packages", - comment: "平台提供的租户套餐定义。"); - - migrationBuilder.AlterTable( - name: "tenant_notifications", - comment: "面向租户的站内通知或消息推送。"); - - migrationBuilder.AlterTable( - name: "tenant_billing_statements", - comment: "租户账单,用于呈现周期性收费。"); - - migrationBuilder.AlterTable( - name: "support_tickets", - comment: "客服工单。"); - - migrationBuilder.AlterTable( - name: "stores", - comment: "门店信息,承载营业配置与能力。"); - - migrationBuilder.AlterTable( - name: "store_tables", - comment: "桌台信息与二维码绑定。"); - - migrationBuilder.AlterTable( - name: "store_table_areas", - comment: "门店桌台区域配置。"); - - migrationBuilder.AlterTable( - name: "store_holidays", - comment: "门店休息日或特殊营业日。"); - - migrationBuilder.AlterTable( - name: "store_employee_shifts", - comment: "门店员工排班记录。"); - - migrationBuilder.AlterTable( - name: "store_delivery_zones", - comment: "门店配送范围配置。"); - - migrationBuilder.AlterTable( - name: "store_business_hours", - comment: "门店营业时段配置。"); - - migrationBuilder.AlterTable( - name: "shopping_carts", - comment: "用户购物车,按租户/门店隔离。"); - - migrationBuilder.AlterTable( - name: "reservations", - comment: "预约/预订记录。"); - - migrationBuilder.AlterTable( - name: "refund_requests", - comment: "售后/退款申请。"); - - migrationBuilder.AlterTable( - name: "queue_tickets", - comment: "排队叫号。"); - - migrationBuilder.AlterTable( - name: "promotion_campaigns", - comment: "营销活动配置。"); - - migrationBuilder.AlterTable( - name: "products", - comment: "商品(SPU)信息。"); - - migrationBuilder.AlterTable( - name: "product_skus", - comment: "商品 SKU,记录具体规格组合价格。"); - - migrationBuilder.AlterTable( - name: "product_pricing_rules", - comment: "商品价格策略,支持会员价/时段价等。"); - - migrationBuilder.AlterTable( - name: "product_media_assets", - comment: "商品媒资素材。"); - - migrationBuilder.AlterTable( - name: "product_categories", - comment: "商品分类。"); - - migrationBuilder.AlterTable( - name: "product_attribute_options", - comment: "商品规格选项。"); - - migrationBuilder.AlterTable( - name: "product_attribute_groups", - comment: "商品规格/属性分组。"); - - migrationBuilder.AlterTable( - name: "product_addon_options", - comment: "加料选项。"); - - migrationBuilder.AlterTable( - name: "product_addon_groups", - comment: "加料/做法分组。"); - - migrationBuilder.AlterTable( - name: "payment_refund_records", - comment: "支付渠道退款流水。"); - - migrationBuilder.AlterTable( - name: "payment_records", - comment: "支付流水。"); - - migrationBuilder.AlterTable( - name: "orders", - comment: "交易订单。"); - - migrationBuilder.AlterTable( - name: "order_status_histories", - comment: "订单状态流转记录。"); - - migrationBuilder.AlterTable( - name: "order_items", - comment: "订单明细。"); - - migrationBuilder.AlterTable( - name: "navigation_requests", - comment: "用户发起的导航请求日志。"); - - migrationBuilder.AlterTable( - name: "metric_snapshots", - comment: "指标快照,用于大盘展示。"); - - migrationBuilder.AlterTable( - name: "metric_definitions", - comment: "指标定义,描述可观测的数据点。"); - - migrationBuilder.AlterTable( - name: "metric_alert_rules", - comment: "指标告警规则。"); - - migrationBuilder.AlterTable( - name: "merchants", - comment: "商户主体信息,承载入驻和资质审核结果。"); - - migrationBuilder.AlterTable( - name: "merchant_staff", - comment: "商户员工账号,支持门店维度分配。"); - - migrationBuilder.AlterTable( - name: "merchant_documents", - comment: "商户提交的资质或证照材料。"); - - migrationBuilder.AlterTable( - name: "merchant_contracts", - comment: "商户合同记录。"); - - migrationBuilder.AlterTable( - name: "member_tiers", - comment: "会员等级定义。"); - - migrationBuilder.AlterTable( - name: "member_profiles", - comment: "会员档案。"); - - migrationBuilder.AlterTable( - name: "member_point_ledgers", - comment: "积分变动流水。"); - - migrationBuilder.AlterTable( - name: "member_growth_logs", - comment: "成长值变动日志。"); - - migrationBuilder.AlterTable( - name: "map_locations", - comment: "地图 POI 信息,用于门店定位和推荐。"); - - migrationBuilder.AlterTable( - name: "inventory_items", - comment: "SKU 在门店的库存信息。"); - - migrationBuilder.AlterTable( - name: "inventory_batches", - comment: "SKU 批次信息。"); - - migrationBuilder.AlterTable( - name: "inventory_adjustments", - comment: "库存调整记录。"); - - migrationBuilder.AlterTable( - name: "group_participants", - comment: "拼单参与者。"); - - migrationBuilder.AlterTable( - name: "group_orders", - comment: "拼单活动。"); - - migrationBuilder.AlterTable( - name: "delivery_orders", - comment: "配送单。"); - - migrationBuilder.AlterTable( - name: "delivery_events", - comment: "配送状态事件流水。"); - - migrationBuilder.AlterTable( - name: "coupons", - comment: "用户领取的券。"); - - migrationBuilder.AlterTable( - name: "coupon_templates", - comment: "优惠券模板。"); - - migrationBuilder.AlterTable( - name: "community_reactions", - comment: "社区互动反馈。"); - - migrationBuilder.AlterTable( - name: "community_posts", - comment: "社区动态。"); - - migrationBuilder.AlterTable( - name: "community_comments", - comment: "社区评论。"); - - migrationBuilder.AlterTable( - name: "checkout_sessions", - comment: "结账会话,记录校验上下文。"); - - migrationBuilder.AlterTable( - name: "checkin_records", - comment: "用户签到记录。"); - - migrationBuilder.AlterTable( - name: "checkin_campaigns", - comment: "签到活动配置。"); - - migrationBuilder.AlterTable( - name: "chat_sessions", - comment: "客服会话。"); - - migrationBuilder.AlterTable( - name: "chat_messages", - comment: "会话消息。"); - - migrationBuilder.AlterTable( - name: "cart_items", - comment: "购物车条目。"); - - migrationBuilder.AlterTable( - name: "cart_item_addons", - comment: "购物车条目的加料/附加项。"); - - migrationBuilder.AlterTable( - name: "affiliate_payouts", - comment: "佣金结算记录。"); - - migrationBuilder.AlterTable( - name: "affiliate_partners", - comment: "分销/推广合作伙伴。"); - - migrationBuilder.AlterTable( - name: "affiliate_orders", - comment: "分销订单记录。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "ticket_comments", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "ticket_comments", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "ticket_comments", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SupportTicketId", - table: "ticket_comments", - type: "uuid", - nullable: false, - comment: "工单标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "IsInternal", - table: "ticket_comments", - type: "boolean", - nullable: false, - comment: "是否内部备注。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "ticket_comments", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "ticket_comments", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "ticket_comments", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "ticket_comments", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Content", - table: "ticket_comments", - type: "character varying(1024)", - maxLength: 1024, - nullable: false, - comment: "评论内容。", - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024); - - migrationBuilder.AlterColumn( - name: "AuthorUserId", - table: "ticket_comments", - type: "uuid", - nullable: true, - comment: "评论人 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AttachmentsJson", - table: "ticket_comments", - type: "text", - nullable: true, - comment: "附件 JSON。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "ticket_comments", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Website", - table: "tenants", - type: "text", - nullable: true, - comment: "官网或主要宣传链接。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenants", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Tags", - table: "tenants", - type: "text", - nullable: true, - comment: "业务标签集合(逗号分隔)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "SuspensionReason", - table: "tenants", - type: "text", - nullable: true, - comment: "暂停或终止的原因说明。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "SuspendedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次暂停服务时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Status", - table: "tenants", - type: "integer", - nullable: false, - comment: "租户当前状态,涵盖审核、启用、停用等场景。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ShortName", - table: "tenants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "对外展示的简称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Remarks", - table: "tenants", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "备注信息,用于运营记录特殊说明。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Province", - table: "tenants", - type: "text", - nullable: true, - comment: "所在省份或州。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "PrimaryOwnerUserId", - table: "tenants", - type: "uuid", - nullable: true, - comment: "系统内对应的租户所有者账号 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Name", - table: "tenants", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "租户全称或品牌名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "LogoUrl", - table: "tenants", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "LOGO 图片地址。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "LegalEntityName", - table: "tenants", - type: "text", - nullable: true, - comment: "法人或公司主体名称。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Industry", - table: "tenants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "所属行业,如餐饮、零售等。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "EffectiveTo", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - comment: "服务到期时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "EffectiveFrom", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - comment: "服务生效时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenants", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenants", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CoverImageUrl", - table: "tenants", - type: "text", - nullable: true, - comment: "品牌海报或封面图。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Country", - table: "tenants", - type: "text", - nullable: true, - comment: "所在国家/地区。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ContactPhone", - table: "tenants", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "主联系人电话。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ContactName", - table: "tenants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "主联系人姓名。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ContactEmail", - table: "tenants", - type: "character varying(128)", - maxLength: 128, - nullable: true, - comment: "主联系人邮箱。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Code", - table: "tenants", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "租户短编码,作为跨系统引用的唯一标识。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "City", - table: "tenants", - type: "text", - nullable: true, - comment: "所在城市。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Address", - table: "tenants", - type: "text", - nullable: true, - comment: "详细地址信息。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenants", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_subscriptions", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantPackageId", - table: "tenant_subscriptions", - type: "uuid", - nullable: false, - comment: "当前订阅关联的套餐标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "tenant_subscriptions", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "tenant_subscriptions", - type: "integer", - nullable: false, - comment: "订阅当前状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ScheduledPackageId", - table: "tenant_subscriptions", - type: "uuid", - nullable: true, - comment: "若已排期升降配,对应的新套餐 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "tenant_subscriptions", - type: "text", - nullable: true, - comment: "运营备注信息。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NextBillingDate", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: true, - comment: "下一个计费时间,配合自动续费使用。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "EffectiveTo", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: false, - comment: "订阅到期时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "EffectiveFrom", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: false, - comment: "订阅生效时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_subscriptions", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_subscriptions", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AutoRenew", - table: "tenant_subscriptions", - type: "boolean", - nullable: false, - comment: "是否开启自动续费。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_subscriptions", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UsedValue", - table: "tenant_quota_usages", - type: "numeric", - nullable: false, - comment: "已消耗的数量。", - oldClrType: typeof(decimal), - oldType: "numeric"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_quota_usages", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_quota_usages", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "tenant_quota_usages", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ResetCycle", - table: "tenant_quota_usages", - type: "text", - nullable: true, - comment: "配额刷新周期描述(如月、年)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "QuotaType", - table: "tenant_quota_usages", - type: "integer", - nullable: false, - comment: "配额类型,例如门店数、短信条数等。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "LimitValue", - table: "tenant_quota_usages", - type: "numeric", - nullable: false, - comment: "当前配额上限。", - oldClrType: typeof(decimal), - oldType: "numeric"); - - migrationBuilder.AlterColumn( - name: "LastResetAt", - table: "tenant_quota_usages", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次重置时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_quota_usages", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_quota_usages", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_quota_usages", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_quota_usages", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_quota_usages", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "YearlyPrice", - table: "tenant_packages", - type: "numeric", - nullable: true, - comment: "年付价格,单位:人民币元。", - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_packages", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_packages", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "PackageType", - table: "tenant_packages", - type: "integer", - nullable: false, - comment: "套餐分类(试用、标准、旗舰等)。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "tenant_packages", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "套餐名称,展示给租户的简称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "MonthlyPrice", - table: "tenant_packages", - type: "numeric", - nullable: true, - comment: "月付价格,单位:人民币元。", - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MaxStoreCount", - table: "tenant_packages", - type: "integer", - nullable: true, - comment: "允许的最大门店数。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MaxStorageGb", - table: "tenant_packages", - type: "integer", - nullable: true, - comment: "存储容量上限(GB)。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MaxSmsCredits", - table: "tenant_packages", - type: "integer", - nullable: true, - comment: "每月短信额度上限。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MaxDeliveryOrders", - table: "tenant_packages", - type: "integer", - nullable: true, - comment: "每月可调用的配送单数量上限。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MaxAccountCount", - table: "tenant_packages", - type: "integer", - nullable: true, - comment: "允许创建的最大账号数。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "IsActive", - table: "tenant_packages", - type: "boolean", - nullable: false, - comment: "是否仍可售卖。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "FeaturePoliciesJson", - table: "tenant_packages", - type: "text", - nullable: true, - comment: "权益明细 JSON,记录自定义特性开关。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Description", - table: "tenant_packages", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "套餐描述,包含适用场景、权益等。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_packages", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_packages", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_packages", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_packages", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_packages", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_notifications", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Title", - table: "tenant_notifications", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "通知标题。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "tenant_notifications", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Severity", - table: "tenant_notifications", - type: "integer", - nullable: false, - comment: "通知重要级别。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "SentAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: false, - comment: "推送时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ReadAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: true, - comment: "租户是否已阅读。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MetadataJson", - table: "tenant_notifications", - type: "text", - nullable: true, - comment: "附加元数据 JSON。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Message", - table: "tenant_notifications", - type: "character varying(1024)", - maxLength: 1024, - nullable: false, - comment: "通知正文。", - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_notifications", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_notifications", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Channel", - table: "tenant_notifications", - type: "integer", - nullable: false, - comment: "发布通道(站内、邮件、短信等)。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_notifications", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_billing_statements", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "tenant_billing_statements", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "tenant_billing_statements", - type: "integer", - nullable: false, - comment: "当前付款状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "StatementNo", - table: "tenant_billing_statements", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "账单编号,供对账查询。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "PeriodStart", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: false, - comment: "账单周期开始时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "PeriodEnd", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: false, - comment: "账单周期结束时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "LineItemsJson", - table: "tenant_billing_statements", - type: "text", - nullable: true, - comment: "账单明细 JSON,记录各项费用。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DueDate", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: false, - comment: "到期日。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_billing_statements", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_billing_statements", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AmountPaid", - table: "tenant_billing_statements", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "实付金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "AmountDue", - table: "tenant_billing_statements", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "应付金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_billing_statements", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "support_tickets", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TicketNo", - table: "support_tickets", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "工单编号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "support_tickets", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Subject", - table: "support_tickets", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "工单主题。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "Status", - table: "support_tickets", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Priority", - table: "support_tickets", - type: "integer", - nullable: false, - comment: "优先级。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "support_tickets", - type: "uuid", - nullable: true, - comment: "关联订单(如有)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Description", - table: "support_tickets", - type: "text", - nullable: false, - comment: "工单详情。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "support_tickets", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CustomerUserId", - table: "support_tickets", - type: "uuid", - nullable: false, - comment: "客户用户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "support_tickets", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ClosedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: true, - comment: "关闭时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AssignedAgentId", - table: "support_tickets", - type: "uuid", - nullable: true, - comment: "指派的客服。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "support_tickets", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "stores", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "stores", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "stores", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Tags", - table: "stores", - type: "text", - nullable: true, - comment: "门店标签(逗号分隔)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "SupportsReservation", - table: "stores", - type: "boolean", - nullable: false, - comment: "支持预约。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "SupportsQueueing", - table: "stores", - type: "boolean", - nullable: false, - comment: "支持排队叫号。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "SupportsPickup", - table: "stores", - type: "boolean", - nullable: false, - comment: "是否支持自提。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "SupportsDineIn", - table: "stores", - type: "boolean", - nullable: false, - comment: "是否支持堂食。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "SupportsDelivery", - table: "stores", - type: "boolean", - nullable: false, - comment: "是否支持配送。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "stores", - type: "integer", - nullable: false, - comment: "门店当前运营状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Province", - table: "stores", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "所在省份。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Phone", - table: "stores", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "联系电话。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Name", - table: "stores", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "门店名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "stores", - type: "uuid", - nullable: false, - comment: "所属商户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ManagerName", - table: "stores", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "门店负责人姓名。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Longitude", - table: "stores", - type: "double precision", - nullable: true, - comment: "高德/腾讯地图经度。", - oldClrType: typeof(double), - oldType: "double precision", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Latitude", - table: "stores", - type: "double precision", - nullable: true, - comment: "纬度。", - oldClrType: typeof(double), - oldType: "double precision", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "District", - table: "stores", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "区县信息。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Description", - table: "stores", - type: "text", - nullable: true, - comment: "门店描述或公告。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeliveryRadiusKm", - table: "stores", - type: "numeric(6,2)", - precision: 6, - scale: 2, - nullable: false, - comment: "默认配送半径(公里)。", - oldClrType: typeof(decimal), - oldType: "numeric(6,2)", - oldPrecision: 6, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "stores", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "stores", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "stores", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "stores", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CoverImageUrl", - table: "stores", - type: "text", - nullable: true, - comment: "门店海报。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Country", - table: "stores", - type: "text", - nullable: true, - comment: "所在国家或地区。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Code", - table: "stores", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "门店编码,便于扫码及外部对接。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "City", - table: "stores", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "所在城市。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "BusinessHours", - table: "stores", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "门店营业时段描述(备用字符串)。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Announcement", - table: "stores", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "门店公告。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Address", - table: "stores", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "详细地址。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "stores", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_tables", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_tables", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_tables", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Tags", - table: "store_tables", - type: "character varying(128)", - maxLength: 128, - nullable: true, - comment: "桌台标签(堂食、快餐等)。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TableCode", - table: "store_tables", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "桌码。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_tables", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "store_tables", - type: "integer", - nullable: false, - comment: "当前桌台状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "QrCodeUrl", - table: "store_tables", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "桌码二维码地址。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_tables", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_tables", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_tables", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_tables", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Capacity", - table: "store_tables", - type: "integer", - nullable: false, - comment: "可容纳人数。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "AreaId", - table: "store_tables", - type: "uuid", - nullable: true, - comment: "所在区域 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_tables", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_table_areas", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_table_areas", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_table_areas", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_table_areas", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "store_table_areas", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "区域名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "Description", - table: "store_table_areas", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "区域描述。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_table_areas", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_table_areas", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_table_areas", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_table_areas", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_table_areas", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_holidays", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_holidays", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_holidays", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_holidays", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Reason", - table: "store_holidays", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "说明内容。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "IsClosed", - table: "store_holidays", - type: "boolean", - nullable: false, - comment: "是否全天闭店。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_holidays", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_holidays", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Date", - table: "store_holidays", - type: "timestamp with time zone", - nullable: false, - comment: "日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_holidays", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_holidays", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_holidays", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_employee_shifts", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_employee_shifts", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_employee_shifts", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_employee_shifts", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StartTime", - table: "store_employee_shifts", - type: "interval", - nullable: false, - comment: "开始时间。", - oldClrType: typeof(TimeSpan), - oldType: "interval"); - - migrationBuilder.AlterColumn( - name: "StaffId", - table: "store_employee_shifts", - type: "uuid", - nullable: false, - comment: "员工标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ShiftDate", - table: "store_employee_shifts", - type: "timestamp with time zone", - nullable: false, - comment: "班次日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "RoleType", - table: "store_employee_shifts", - type: "integer", - nullable: false, - comment: "排班角色。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "store_employee_shifts", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "备注。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "EndTime", - table: "store_employee_shifts", - type: "interval", - nullable: false, - comment: "结束时间。", - oldClrType: typeof(TimeSpan), - oldType: "interval"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_employee_shifts", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_employee_shifts", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_employee_shifts", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_employee_shifts", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_employee_shifts", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ZoneName", - table: "store_delivery_zones", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "区域名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_delivery_zones", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_delivery_zones", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_delivery_zones", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_delivery_zones", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "PolygonGeoJson", - table: "store_delivery_zones", - type: "text", - nullable: false, - comment: "GeoJSON 表示的多边形范围。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "MinimumOrderAmount", - table: "store_delivery_zones", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - comment: "起送价。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "EstimatedMinutes", - table: "store_delivery_zones", - type: "integer", - nullable: true, - comment: "预计送达分钟。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeliveryFee", - table: "store_delivery_zones", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - comment: "配送费。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_delivery_zones", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_delivery_zones", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_delivery_zones", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_delivery_zones", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_delivery_zones", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_business_hours", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_business_hours", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_business_hours", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_business_hours", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StartTime", - table: "store_business_hours", - type: "interval", - nullable: false, - comment: "开始时间(本地时间)。", - oldClrType: typeof(TimeSpan), - oldType: "interval"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "store_business_hours", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "备注。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "HourType", - table: "store_business_hours", - type: "integer", - nullable: false, - comment: "时段类型(正常营业、休息、预约等)。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "EndTime", - table: "store_business_hours", - type: "interval", - nullable: false, - comment: "结束时间(本地时间)。", - oldClrType: typeof(TimeSpan), - oldType: "interval"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_business_hours", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_business_hours", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DayOfWeek", - table: "store_business_hours", - type: "integer", - nullable: false, - comment: "星期几,0 表示周日。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_business_hours", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_business_hours", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CapacityLimit", - table: "store_business_hours", - type: "integer", - nullable: true, - comment: "最大接待容量或单量限制。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_business_hours", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "shopping_carts", - type: "uuid", - nullable: false, - comment: "用户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "shopping_carts", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "shopping_carts", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "shopping_carts", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "TableContext", - table: "shopping_carts", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "桌码或场景标识(扫码点餐)。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "shopping_carts", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "shopping_carts", - type: "integer", - nullable: false, - comment: "购物车状态,包含正常/锁定。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "LastModifiedAt", - table: "shopping_carts", - type: "timestamp with time zone", - nullable: false, - comment: "最近一次修改时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeliveryPreference", - table: "shopping_carts", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "履约方式(堂食/自提/配送)缓存。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "shopping_carts", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "shopping_carts", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "shopping_carts", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "shopping_carts", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "shopping_carts", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "reservations", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "reservations", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "reservations", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "TablePreference", - table: "reservations", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "桌型/标签。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "reservations", - type: "uuid", - nullable: false, - comment: "门店。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "reservations", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ReservationTime", - table: "reservations", - type: "timestamp with time zone", - nullable: false, - comment: "预约时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ReservationNo", - table: "reservations", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "预约号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "reservations", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "备注。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "PeopleCount", - table: "reservations", - type: "integer", - nullable: false, - comment: "用餐人数。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "reservations", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "reservations", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CustomerPhone", - table: "reservations", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "联系电话。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "CustomerName", - table: "reservations", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "客户姓名。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "reservations", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "reservations", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CheckedInAt", - table: "reservations", - type: "timestamp with time zone", - nullable: true, - comment: "实际签到时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CheckInCode", - table: "reservations", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "核销码/到店码。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CancelledAt", - table: "reservations", - type: "timestamp with time zone", - nullable: true, - comment: "取消时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "reservations", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "refund_requests", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "refund_requests", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "refund_requests", - type: "integer", - nullable: false, - comment: "退款状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ReviewNotes", - table: "refund_requests", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "审核备注。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "RequestedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: false, - comment: "用户提交时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "RefundNo", - table: "refund_requests", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "退款单号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "Reason", - table: "refund_requests", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "申请原因。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256); - - migrationBuilder.AlterColumn( - name: "ProcessedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: true, - comment: "审核完成时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "refund_requests", - type: "uuid", - nullable: false, - comment: "关联订单标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "refund_requests", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "refund_requests", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Amount", - table: "refund_requests", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "申请金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "Id", - table: "refund_requests", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "queue_tickets", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TicketNumber", - table: "queue_tickets", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "排队编号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "queue_tickets", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "queue_tickets", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "queue_tickets", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "备注。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "PartySize", - table: "queue_tickets", - type: "integer", - nullable: false, - comment: "就餐人数。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ExpiredAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - comment: "过号时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "EstimatedWaitMinutes", - table: "queue_tickets", - type: "integer", - nullable: true, - comment: "预计等待分钟。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "queue_tickets", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "queue_tickets", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CancelledAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - comment: "取消时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CalledAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - comment: "叫号时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "queue_tickets", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "promotion_campaigns", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "promotion_campaigns", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "promotion_campaigns", - type: "integer", - nullable: false, - comment: "活动状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "StartAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: false, - comment: "开始时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "RulesJson", - table: "promotion_campaigns", - type: "text", - nullable: false, - comment: "活动规则 JSON。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "PromotionType", - table: "promotion_campaigns", - type: "integer", - nullable: false, - comment: "活动类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "promotion_campaigns", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "活动名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "EndAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: false, - comment: "结束时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "promotion_campaigns", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "promotion_campaigns", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Budget", - table: "promotion_campaigns", - type: "numeric", - nullable: true, - comment: "预算金额。", - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "BannerUrl", - table: "promotion_campaigns", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "营销素材(如 banner)。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AudienceDescription", - table: "promotion_campaigns", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "目标人群描述。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "promotion_campaigns", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "products", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "products", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Unit", - table: "products", - type: "character varying(16)", - maxLength: 16, - nullable: true, - comment: "售卖单位(份/杯等)。", - oldClrType: typeof(string), - oldType: "character varying(16)", - oldMaxLength: 16, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "products", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Subtitle", - table: "products", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "副标题/卖点。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "products", - type: "uuid", - nullable: false, - comment: "所属门店。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StockQuantity", - table: "products", - type: "integer", - nullable: true, - comment: "库存数量(可选)。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Status", - table: "products", - type: "integer", - nullable: false, - comment: "商品状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "SpuCode", - table: "products", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "商品编码。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "Price", - table: "products", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "现价。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "OriginalPrice", - table: "products", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - comment: "原价。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Name", - table: "products", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "商品名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "MaxQuantityPerOrder", - table: "products", - type: "integer", - nullable: true, - comment: "最大每单限购。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "IsFeatured", - table: "products", - type: "boolean", - nullable: false, - comment: "是否热门推荐。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "GalleryImages", - table: "products", - type: "character varying(1024)", - maxLength: 1024, - nullable: true, - comment: "Gallery 图片逗号分隔。", - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "EnablePickup", - table: "products", - type: "boolean", - nullable: false, - comment: "支持自提。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "EnableDineIn", - table: "products", - type: "boolean", - nullable: false, - comment: "支持堂食。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "EnableDelivery", - table: "products", - type: "boolean", - nullable: false, - comment: "支持配送。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "products", - type: "text", - nullable: true, - comment: "商品描述。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "products", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "products", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "products", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "products", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CoverImage", - table: "products", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "主图。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CategoryId", - table: "products", - type: "uuid", - nullable: false, - comment: "所属分类。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "products", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Weight", - table: "product_skus", - type: "numeric(10,3)", - precision: 10, - scale: 3, - nullable: true, - comment: "重量(千克)。", - oldClrType: typeof(decimal), - oldType: "numeric(10,3)", - oldPrecision: 10, - oldScale: 3, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_skus", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_skus", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_skus", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StockQuantity", - table: "product_skus", - type: "integer", - nullable: true, - comment: "可售库存。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "SkuCode", - table: "product_skus", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "SKU 编码。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "product_skus", - type: "uuid", - nullable: false, - comment: "所属商品标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Price", - table: "product_skus", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "售价。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "OriginalPrice", - table: "product_skus", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - comment: "原价。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_skus", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_skus", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_skus", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_skus", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Barcode", - table: "product_skus", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "条形码。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AttributesJson", - table: "product_skus", - type: "text", - nullable: false, - comment: "规格属性 JSON(记录选项 ID)。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_skus", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "WeekdaysJson", - table: "product_pricing_rules", - type: "text", - nullable: true, - comment: "生效星期(JSON 数组)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_pricing_rules", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_pricing_rules", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StartTime", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: true, - comment: "生效开始时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "RuleType", - table: "product_pricing_rules", - type: "integer", - nullable: false, - comment: "策略类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "product_pricing_rules", - type: "uuid", - nullable: false, - comment: "所属商品。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Price", - table: "product_pricing_rules", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "特殊价格。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "EndTime", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: true, - comment: "生效结束时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_pricing_rules", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_pricing_rules", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ConditionsJson", - table: "product_pricing_rules", - type: "text", - nullable: false, - comment: "条件描述(JSON),如会员等级、渠道等。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_pricing_rules", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Url", - table: "product_media_assets", - type: "character varying(512)", - maxLength: 512, - nullable: false, - comment: "媒资链接。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_media_assets", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_media_assets", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_media_assets", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_media_assets", - type: "integer", - nullable: false, - comment: "排序。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "product_media_assets", - type: "uuid", - nullable: false, - comment: "商品标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "MediaType", - table: "product_media_assets", - type: "integer", - nullable: false, - comment: "媒体类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_media_assets", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_media_assets", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_media_assets", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_media_assets", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Caption", - table: "product_media_assets", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "描述或标题。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_media_assets", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_categories", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_categories", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_categories", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "product_categories", - type: "uuid", - nullable: false, - comment: "所属门店。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_categories", - type: "integer", - nullable: false, - comment: "排序值。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_categories", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "分类名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "IsEnabled", - table: "product_categories", - type: "boolean", - nullable: false, - comment: "是否启用。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "product_categories", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "分类描述。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_categories", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_categories", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_categories", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_categories", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_categories", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_attribute_options", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_attribute_options", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_attribute_options", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_attribute_options", - type: "integer", - nullable: false, - comment: "排序。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_attribute_options", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "选项名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "IsDefault", - table: "product_attribute_options", - type: "boolean", - nullable: false, - comment: "是否默认选中。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "ExtraPrice", - table: "product_attribute_options", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - comment: "附加价格。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_attribute_options", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_attribute_options", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_attribute_options", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_attribute_options", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AttributeGroupId", - table: "product_attribute_options", - type: "uuid", - nullable: false, - comment: "所属规格组。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_attribute_options", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_attribute_groups", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_attribute_groups", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_attribute_groups", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "product_attribute_groups", - type: "uuid", - nullable: true, - comment: "关联门店,可为空表示所有门店共享。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_attribute_groups", - type: "integer", - nullable: false, - comment: "显示排序。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "SelectionType", - table: "product_attribute_groups", - type: "integer", - nullable: false, - comment: "选择类型(单选/多选)。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_attribute_groups", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "分组名称,例如“辣度”“份量”。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "IsRequired", - table: "product_attribute_groups", - type: "boolean", - nullable: false, - comment: "是否必选。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_attribute_groups", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_attribute_groups", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_attribute_groups", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_attribute_groups", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_attribute_groups", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_addon_options", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_addon_options", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_addon_options", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_addon_options", - type: "integer", - nullable: false, - comment: "排序。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_addon_options", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "选项名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "IsDefault", - table: "product_addon_options", - type: "boolean", - nullable: false, - comment: "是否默认选项。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "ExtraPrice", - table: "product_addon_options", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - comment: "附加价格。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_addon_options", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_addon_options", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_addon_options", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_addon_options", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AddonGroupId", - table: "product_addon_options", - type: "uuid", - nullable: false, - comment: "所属加料分组。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_addon_options", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_addon_groups", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_addon_groups", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_addon_groups", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_addon_groups", - type: "integer", - nullable: false, - comment: "排序值。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "SelectionType", - table: "product_addon_groups", - type: "integer", - nullable: false, - comment: "选择类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "product_addon_groups", - type: "uuid", - nullable: false, - comment: "所属商品。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_addon_groups", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "分组名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "MinSelect", - table: "product_addon_groups", - type: "integer", - nullable: true, - comment: "最小选择数量。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MaxSelect", - table: "product_addon_groups", - type: "integer", - nullable: true, - comment: "最大选择数量。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "IsRequired", - table: "product_addon_groups", - type: "boolean", - nullable: false, - comment: "是否必选。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_addon_groups", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_addon_groups", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_addon_groups", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_addon_groups", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_addon_groups", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "payment_refund_records", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "payment_refund_records", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "payment_refund_records", - type: "integer", - nullable: false, - comment: "退款状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "RequestedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: false, - comment: "退款请求时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "PaymentRecordId", - table: "payment_refund_records", - type: "uuid", - nullable: false, - comment: "原支付记录标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Payload", - table: "payment_refund_records", - type: "text", - nullable: true, - comment: "渠道返回的原始数据 JSON。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "payment_refund_records", - type: "uuid", - nullable: false, - comment: "关联订单标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "payment_refund_records", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "payment_refund_records", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CompletedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: true, - comment: "完成时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ChannelRefundId", - table: "payment_refund_records", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "渠道退款流水号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Amount", - table: "payment_refund_records", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "退款金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "Id", - table: "payment_refund_records", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "payment_records", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "payment_records", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TradeNo", - table: "payment_records", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "平台交易号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "payment_records", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "payment_records", - type: "integer", - nullable: false, - comment: "支付状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "payment_records", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "错误/备注。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Payload", - table: "payment_records", - type: "text", - nullable: true, - comment: "原始回调内容。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "PaidAt", - table: "payment_records", - type: "timestamp with time zone", - nullable: true, - comment: "支付完成时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "payment_records", - type: "uuid", - nullable: false, - comment: "关联订单。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Method", - table: "payment_records", - type: "integer", - nullable: false, - comment: "支付方式。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "payment_records", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "payment_records", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "payment_records", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "payment_records", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ChannelTransactionId", - table: "payment_records", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "第三方渠道单号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Amount", - table: "payment_records", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "支付金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "Id", - table: "payment_records", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "orders", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "orders", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "TableNo", - table: "orders", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "就餐桌号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "orders", - type: "uuid", - nullable: false, - comment: "门店。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "orders", - type: "integer", - nullable: false, - comment: "当前状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ReservationId", - table: "orders", - type: "uuid", - nullable: true, - comment: "预约 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "orders", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "备注。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "QueueNumber", - table: "orders", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "排队号(如有)。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "PaymentStatus", - table: "orders", - type: "integer", - nullable: false, - comment: "支付状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "PayableAmount", - table: "orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "应付金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "PaidAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - comment: "支付时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "PaidAmount", - table: "orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "实付金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "OrderNo", - table: "orders", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "订单号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "ItemsAmount", - table: "orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "商品总额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "FinishedAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - comment: "完成时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DiscountAmount", - table: "orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "优惠金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "DeliveryType", - table: "orders", - type: "integer", - nullable: false, - comment: "履约类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "orders", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CustomerPhone", - table: "orders", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "顾客手机号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CustomerName", - table: "orders", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "顾客姓名。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "orders", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "orders", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Channel", - table: "orders", - type: "integer", - nullable: false, - comment: "下单渠道。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "CancelledAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - comment: "取消时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CancelReason", - table: "orders", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "取消原因。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "orders", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "order_status_histories", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "order_status_histories", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "order_status_histories", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "order_status_histories", - type: "integer", - nullable: false, - comment: "变更后的状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "order_status_histories", - type: "uuid", - nullable: false, - comment: "订单标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "OperatorId", - table: "order_status_histories", - type: "uuid", - nullable: true, - comment: "操作人标识(可为空表示系统)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "order_status_histories", - type: "timestamp with time zone", - nullable: false, - comment: "发生时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "order_status_histories", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "备注信息。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "order_status_histories", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "order_status_histories", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "order_status_histories", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "order_status_histories", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "order_status_histories", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "order_items", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "order_items", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UnitPrice", - table: "order_items", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "单价。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "Unit", - table: "order_items", - type: "character varying(16)", - maxLength: 16, - nullable: true, - comment: "单位。", - oldClrType: typeof(string), - oldType: "character varying(16)", - oldMaxLength: 16, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "order_items", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SubTotal", - table: "order_items", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "小计。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "SkuName", - table: "order_items", - type: "character varying(128)", - maxLength: 128, - nullable: true, - comment: "SKU/规格描述。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Quantity", - table: "order_items", - type: "integer", - nullable: false, - comment: "数量。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ProductName", - table: "order_items", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "商品名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "order_items", - type: "uuid", - nullable: false, - comment: "商品 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "order_items", - type: "uuid", - nullable: false, - comment: "订单 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DiscountAmount", - table: "order_items", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "折扣金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "order_items", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "order_items", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "order_items", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "order_items", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AttributesJson", - table: "order_items", - type: "text", - nullable: true, - comment: "自定义属性 JSON。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "order_items", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "navigation_requests", - type: "uuid", - nullable: false, - comment: "用户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "navigation_requests", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "navigation_requests", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "navigation_requests", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "TargetApp", - table: "navigation_requests", - type: "integer", - nullable: false, - comment: "跳转的地图应用。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "navigation_requests", - type: "uuid", - nullable: false, - comment: "门店 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "RequestedAt", - table: "navigation_requests", - type: "timestamp with time zone", - nullable: false, - comment: "请求时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "navigation_requests", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "navigation_requests", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "navigation_requests", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "navigation_requests", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Channel", - table: "navigation_requests", - type: "integer", - nullable: false, - comment: "来源通道(小程序、H5 等)。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "navigation_requests", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "WindowStart", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: false, - comment: "统计时间窗口开始。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "WindowEnd", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: false, - comment: "统计时间窗口结束。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Value", - table: "metric_snapshots", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: false, - comment: "数值。", - oldClrType: typeof(decimal), - oldType: "numeric(18,4)", - oldPrecision: 18, - oldScale: 4); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "metric_snapshots", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "metric_snapshots", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "MetricDefinitionId", - table: "metric_snapshots", - type: "uuid", - nullable: false, - comment: "指标定义 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DimensionKey", - table: "metric_snapshots", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "维度键(JSON)。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "metric_snapshots", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "metric_snapshots", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "metric_snapshots", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "metric_definitions", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "metric_definitions", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "metric_definitions", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "metric_definitions", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "指标名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "DimensionsJson", - table: "metric_definitions", - type: "text", - nullable: true, - comment: "维度描述 JSON。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Description", - table: "metric_definitions", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "说明。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "metric_definitions", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "metric_definitions", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DefaultAggregation", - table: "metric_definitions", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "默认聚合方式。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "metric_definitions", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "metric_definitions", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "metric_definitions", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "指标编码。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "Id", - table: "metric_definitions", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "metric_alert_rules", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "metric_alert_rules", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "metric_alert_rules", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Severity", - table: "metric_alert_rules", - type: "integer", - nullable: false, - comment: "告警级别。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "NotificationChannels", - table: "metric_alert_rules", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "通知渠道。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256); - - migrationBuilder.AlterColumn( - name: "MetricDefinitionId", - table: "metric_alert_rules", - type: "uuid", - nullable: false, - comment: "关联指标。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Enabled", - table: "metric_alert_rules", - type: "boolean", - nullable: false, - comment: "是否启用。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "metric_alert_rules", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "metric_alert_rules", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "metric_alert_rules", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "metric_alert_rules", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ConditionJson", - table: "metric_alert_rules", - type: "text", - nullable: false, - comment: "触发条件 JSON。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "metric_alert_rules", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "merchants", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "merchants", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "TaxNumber", - table: "merchants", - type: "text", - nullable: true, - comment: "税号/统一社会信用代码。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "SupportEmail", - table: "merchants", - type: "text", - nullable: true, - comment: "客服邮箱。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Status", - table: "merchants", - type: "integer", - nullable: false, - comment: "入驻状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ServicePhone", - table: "merchants", - type: "text", - nullable: true, - comment: "客服电话。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ReviewRemarks", - table: "merchants", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "审核备注或驳回原因。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Province", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "所在省份。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Longitude", - table: "merchants", - type: "double precision", - nullable: true, - comment: "经度信息。", - oldClrType: typeof(double), - oldType: "double precision", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "LogoUrl", - table: "merchants", - type: "text", - nullable: true, - comment: "品牌 Logo。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "LegalPerson", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "法人或负责人姓名。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Latitude", - table: "merchants", - type: "double precision", - nullable: true, - comment: "纬度信息。", - oldClrType: typeof(double), - oldType: "double precision", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "LastReviewedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次审核时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "JoinedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true, - comment: "入驻时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "District", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "所在区县。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "merchants", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "merchants", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ContactPhone", - table: "merchants", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "联系电话。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "ContactEmail", - table: "merchants", - type: "character varying(128)", - maxLength: 128, - nullable: true, - comment: "联系邮箱。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "City", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "所在城市。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Category", - table: "merchants", - type: "text", - nullable: true, - comment: "品牌所属品类,如火锅、咖啡等。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "BusinessLicenseNumber", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "营业执照号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "BusinessLicenseImageUrl", - table: "merchants", - type: "text", - nullable: true, - comment: "营业执照扫描件地址。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "BrandName", - table: "merchants", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "品牌名称(对外展示)。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "BrandAlias", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "品牌简称或别名。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Address", - table: "merchants", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "详细地址。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "merchants", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "merchant_staff", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "merchant_staff", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "merchant_staff", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "merchant_staff", - type: "uuid", - nullable: true, - comment: "可选的关联门店 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Status", - table: "merchant_staff", - type: "integer", - nullable: false, - comment: "员工状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "RoleType", - table: "merchant_staff", - type: "integer", - nullable: false, - comment: "员工角色类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Phone", - table: "merchant_staff", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "手机号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "PermissionsJson", - table: "merchant_staff", - type: "text", - nullable: true, - comment: "自定义权限(JSON)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Name", - table: "merchant_staff", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "员工姓名。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "merchant_staff", - type: "uuid", - nullable: false, - comment: "所属商户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "IdentityUserId", - table: "merchant_staff", - type: "uuid", - nullable: true, - comment: "登录账号 ID(指向统一身份体系)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Email", - table: "merchant_staff", - type: "character varying(128)", - maxLength: 128, - nullable: true, - comment: "邮箱地址。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "merchant_staff", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "merchant_staff", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "merchant_staff", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "merchant_staff", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "merchant_staff", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "merchant_documents", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "merchant_documents", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "merchant_documents", - type: "integer", - nullable: false, - comment: "审核状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Remarks", - table: "merchant_documents", - type: "text", - nullable: true, - comment: "审核备注或驳回原因。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "merchant_documents", - type: "uuid", - nullable: false, - comment: "所属商户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "IssuedAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: true, - comment: "签发日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "FileUrl", - table: "merchant_documents", - type: "character varying(512)", - maxLength: 512, - nullable: false, - comment: "证照文件链接。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512); - - migrationBuilder.AlterColumn( - name: "ExpiresAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: true, - comment: "到期日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DocumentType", - table: "merchant_documents", - type: "integer", - nullable: false, - comment: "证照类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "DocumentNumber", - table: "merchant_documents", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "证照编号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "merchant_documents", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "merchant_documents", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "merchant_documents", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "merchant_contracts", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TerminationReason", - table: "merchant_contracts", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "终止原因。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TerminatedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: true, - comment: "终止时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "merchant_contracts", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "merchant_contracts", - type: "integer", - nullable: false, - comment: "合同状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "StartDate", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: false, - comment: "合同开始时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "SignedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: true, - comment: "签署时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "merchant_contracts", - type: "uuid", - nullable: false, - comment: "所属商户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "FileUrl", - table: "merchant_contracts", - type: "character varying(512)", - maxLength: 512, - nullable: false, - comment: "合同文件存储地址。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512); - - migrationBuilder.AlterColumn( - name: "EndDate", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: false, - comment: "合同结束时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "merchant_contracts", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "merchant_contracts", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ContractNumber", - table: "merchant_contracts", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "合同编号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "Id", - table: "merchant_contracts", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "member_tiers", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "member_tiers", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "member_tiers", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "member_tiers", - type: "integer", - nullable: false, - comment: "排序值。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "RequiredGrowth", - table: "member_tiers", - type: "integer", - nullable: false, - comment: "所需成长值。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "member_tiers", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "等级名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "member_tiers", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "member_tiers", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "member_tiers", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "member_tiers", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "BenefitsJson", - table: "member_tiers", - type: "text", - nullable: false, - comment: "等级权益(JSON)。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "member_tiers", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "member_profiles", - type: "uuid", - nullable: false, - comment: "用户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "member_profiles", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "member_profiles", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "member_profiles", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "member_profiles", - type: "integer", - nullable: false, - comment: "会员状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "PointsBalance", - table: "member_profiles", - type: "integer", - nullable: false, - comment: "会员积分余额。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Nickname", - table: "member_profiles", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "昵称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Mobile", - table: "member_profiles", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "手机号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "MemberTierId", - table: "member_profiles", - type: "uuid", - nullable: true, - comment: "当前会员等级 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "JoinedAt", - table: "member_profiles", - type: "timestamp with time zone", - nullable: false, - comment: "注册时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "GrowthValue", - table: "member_profiles", - type: "integer", - nullable: false, - comment: "成长值/经验值。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "member_profiles", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "member_profiles", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "member_profiles", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "member_profiles", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "BirthDate", - table: "member_profiles", - type: "timestamp with time zone", - nullable: true, - comment: "生日。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AvatarUrl", - table: "member_profiles", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "头像。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "member_profiles", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "member_point_ledgers", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "member_point_ledgers", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SourceId", - table: "member_point_ledgers", - type: "uuid", - nullable: true, - comment: "来源 ID(订单、活动等)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Reason", - table: "member_point_ledgers", - type: "integer", - nullable: false, - comment: "变动原因。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: false, - comment: "发生时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "MemberId", - table: "member_point_ledgers", - type: "uuid", - nullable: false, - comment: "会员标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ExpireAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: true, - comment: "过期时间(如适用)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "member_point_ledgers", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "member_point_ledgers", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ChangeAmount", - table: "member_point_ledgers", - type: "integer", - nullable: false, - comment: "变动数量,可为负值。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "BalanceAfterChange", - table: "member_point_ledgers", - type: "integer", - nullable: false, - comment: "变动后余额。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "member_point_ledgers", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "member_growth_logs", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "member_growth_logs", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "member_growth_logs", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "member_growth_logs", - type: "timestamp with time zone", - nullable: false, - comment: "发生时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "member_growth_logs", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "备注。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MemberId", - table: "member_growth_logs", - type: "uuid", - nullable: false, - comment: "会员标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "member_growth_logs", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "member_growth_logs", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CurrentValue", - table: "member_growth_logs", - type: "integer", - nullable: false, - comment: "当前成长值。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "member_growth_logs", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "member_growth_logs", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ChangeValue", - table: "member_growth_logs", - type: "integer", - nullable: false, - comment: "变动数量。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "member_growth_logs", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "map_locations", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "map_locations", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "map_locations", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "map_locations", - type: "uuid", - nullable: true, - comment: "关联门店 ID,可空表示独立 POI。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Name", - table: "map_locations", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "Longitude", - table: "map_locations", - type: "double precision", - nullable: false, - comment: "经度。", - oldClrType: typeof(double), - oldType: "double precision"); - - migrationBuilder.AlterColumn( - name: "Latitude", - table: "map_locations", - type: "double precision", - nullable: false, - comment: "纬度。", - oldClrType: typeof(double), - oldType: "double precision"); - - migrationBuilder.AlterColumn( - name: "Landmark", - table: "map_locations", - type: "character varying(128)", - maxLength: 128, - nullable: true, - comment: "打车/导航落点描述。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "map_locations", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "map_locations", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "map_locations", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "map_locations", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Address", - table: "map_locations", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "地址。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256); - - migrationBuilder.AlterColumn( - name: "Id", - table: "map_locations", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "inventory_items", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "inventory_items", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "inventory_items", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "inventory_items", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SafetyStock", - table: "inventory_items", - type: "integer", - nullable: true, - comment: "安全库存阈值。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "QuantityReserved", - table: "inventory_items", - type: "integer", - nullable: false, - comment: "已锁定库存(订单占用)。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "QuantityOnHand", - table: "inventory_items", - type: "integer", - nullable: false, - comment: "可用库存。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ProductSkuId", - table: "inventory_items", - type: "uuid", - nullable: false, - comment: "SKU 标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Location", - table: "inventory_items", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "储位或仓位信息。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ExpireDate", - table: "inventory_items", - type: "timestamp with time zone", - nullable: true, - comment: "过期日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "inventory_items", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "inventory_items", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "inventory_items", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "inventory_items", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "BatchNumber", - table: "inventory_items", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "批次编号,可为空表示混批。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "inventory_items", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "inventory_batches", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "inventory_batches", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "inventory_batches", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "RemainingQuantity", - table: "inventory_batches", - type: "integer", - nullable: false, - comment: "剩余数量。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Quantity", - table: "inventory_batches", - type: "integer", - nullable: false, - comment: "入库数量。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ProductionDate", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: true, - comment: "生产日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ProductSkuId", - table: "inventory_batches", - type: "uuid", - nullable: false, - comment: "SKU 标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ExpireDate", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: true, - comment: "过期日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "inventory_batches", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "inventory_batches", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "BatchNumber", - table: "inventory_batches", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "批次编号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "Id", - table: "inventory_batches", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "inventory_adjustments", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "inventory_adjustments", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "inventory_adjustments", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Reason", - table: "inventory_adjustments", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "原因说明。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Quantity", - table: "inventory_adjustments", - type: "integer", - nullable: false, - comment: "调整数量,正数增加,负数减少。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "OperatorId", - table: "inventory_adjustments", - type: "uuid", - nullable: true, - comment: "操作人标识。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "inventory_adjustments", - type: "timestamp with time zone", - nullable: false, - comment: "发生时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "InventoryItemId", - table: "inventory_adjustments", - type: "uuid", - nullable: false, - comment: "对应的库存记录标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "inventory_adjustments", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "inventory_adjustments", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "inventory_adjustments", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "inventory_adjustments", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AdjustmentType", - table: "inventory_adjustments", - type: "integer", - nullable: false, - comment: "调整类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "inventory_adjustments", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "group_participants", - type: "uuid", - nullable: false, - comment: "用户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "group_participants", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "group_participants", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "group_participants", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "group_participants", - type: "integer", - nullable: false, - comment: "参与状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "group_participants", - type: "uuid", - nullable: false, - comment: "对应订单标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "JoinedAt", - table: "group_participants", - type: "timestamp with time zone", - nullable: false, - comment: "参与时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "GroupOrderId", - table: "group_participants", - type: "uuid", - nullable: false, - comment: "拼单活动标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "group_participants", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "group_participants", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "group_participants", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "group_participants", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "group_participants", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "group_orders", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "group_orders", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "TargetCount", - table: "group_orders", - type: "integer", - nullable: false, - comment: "成团需要的人数。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "SucceededAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: true, - comment: "成团时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "group_orders", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "group_orders", - type: "integer", - nullable: false, - comment: "拼团状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "StartAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: false, - comment: "开始时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "group_orders", - type: "uuid", - nullable: false, - comment: "关联商品或套餐。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "LeaderUserId", - table: "group_orders", - type: "uuid", - nullable: false, - comment: "团长用户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "GroupPrice", - table: "group_orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "拼团价格。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "GroupOrderNo", - table: "group_orders", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "拼单编号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "EndAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: false, - comment: "结束时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "group_orders", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CurrentCount", - table: "group_orders", - type: "integer", - nullable: false, - comment: "当前已参与人数。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "group_orders", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CancelledAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: true, - comment: "取消时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "group_orders", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "delivery_orders", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "delivery_orders", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "delivery_orders", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ProviderOrderId", - table: "delivery_orders", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "第三方配送单号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Provider", - table: "delivery_orders", - type: "integer", - nullable: false, - comment: "配送服务商。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "PickedUpAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - comment: "取餐时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "FailureReason", - table: "delivery_orders", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "异常原因。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DispatchedAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - comment: "下发时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeliveryFee", - table: "delivery_orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - comment: "配送费。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeliveredAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - comment: "完成时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "delivery_orders", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "delivery_orders", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CourierPhone", - table: "delivery_orders", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "骑手电话。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CourierName", - table: "delivery_orders", - type: "character varying(64)", - maxLength: 64, - nullable: true, - comment: "骑手姓名。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "delivery_orders", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "delivery_events", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "delivery_events", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "delivery_events", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Payload", - table: "delivery_events", - type: "text", - nullable: true, - comment: "原始数据 JSON。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "delivery_events", - type: "timestamp with time zone", - nullable: false, - comment: "发生时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Message", - table: "delivery_events", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "事件描述。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256); - - migrationBuilder.AlterColumn( - name: "EventType", - table: "delivery_events", - type: "integer", - nullable: false, - comment: "事件类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "DeliveryOrderId", - table: "delivery_events", - type: "uuid", - nullable: false, - comment: "配送单标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "delivery_events", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "delivery_events", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "delivery_events", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "delivery_events", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "delivery_events", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "coupons", - type: "uuid", - nullable: false, - comment: "归属用户。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UsedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: true, - comment: "使用时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "coupons", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "coupons", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "coupons", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "coupons", - type: "uuid", - nullable: true, - comment: "订单 ID(已使用时记录)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "IssuedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: false, - comment: "发放时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ExpireAt", - table: "coupons", - type: "timestamp with time zone", - nullable: false, - comment: "到期时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "coupons", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "coupons", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CouponTemplateId", - table: "coupons", - type: "uuid", - nullable: false, - comment: "模板标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "coupons", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "券码或序列号。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "Id", - table: "coupons", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Value", - table: "coupon_templates", - type: "numeric", - nullable: false, - comment: "面值或折扣额度。", - oldClrType: typeof(decimal), - oldType: "numeric"); - - migrationBuilder.AlterColumn( - name: "ValidTo", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: true, - comment: "可用结束时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ValidFrom", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: true, - comment: "可用开始时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "coupon_templates", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TotalQuantity", - table: "coupon_templates", - type: "integer", - nullable: true, - comment: "总发放数量上限。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "coupon_templates", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreScopeJson", - table: "coupon_templates", - type: "text", - nullable: true, - comment: "适用门店 ID 集合(JSON)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Status", - table: "coupon_templates", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "RelativeValidDays", - table: "coupon_templates", - type: "integer", - nullable: true, - comment: "有效天数(相对发放时间)。", - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ProductScopeJson", - table: "coupon_templates", - type: "text", - nullable: true, - comment: "适用品类或商品范围(JSON)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Name", - table: "coupon_templates", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "模板名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "MinimumSpend", - table: "coupon_templates", - type: "numeric", - nullable: true, - comment: "最低消费门槛。", - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DiscountCap", - table: "coupon_templates", - type: "numeric", - nullable: true, - comment: "折扣上限(针对折扣券)。", - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Description", - table: "coupon_templates", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "备注。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "coupon_templates", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "coupon_templates", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CouponType", - table: "coupon_templates", - type: "integer", - nullable: false, - comment: "券类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ClaimedQuantity", - table: "coupon_templates", - type: "integer", - nullable: false, - comment: "已领取数量。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ChannelsJson", - table: "coupon_templates", - type: "text", - nullable: true, - comment: "发放渠道(JSON)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AllowStack", - table: "coupon_templates", - type: "boolean", - nullable: false, - comment: "是否允许叠加其他优惠。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "coupon_templates", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "community_reactions", - type: "uuid", - nullable: false, - comment: "用户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "community_reactions", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "community_reactions", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "community_reactions", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ReactionType", - table: "community_reactions", - type: "integer", - nullable: false, - comment: "反应类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ReactedAt", - table: "community_reactions", - type: "timestamp with time zone", - nullable: false, - comment: "时间戳。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "PostId", - table: "community_reactions", - type: "uuid", - nullable: false, - comment: "动态 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "community_reactions", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "community_reactions", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "community_reactions", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "community_reactions", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "community_reactions", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "community_posts", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "community_posts", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Title", - table: "community_posts", - type: "character varying(128)", - maxLength: 128, - nullable: true, - comment: "标题。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "community_posts", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "community_posts", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "MediaJson", - table: "community_posts", - type: "text", - nullable: true, - comment: "媒体资源 JSON。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "LikeCount", - table: "community_posts", - type: "integer", - nullable: false, - comment: "点赞数。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "community_posts", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "community_posts", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "community_posts", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "community_posts", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Content", - table: "community_posts", - type: "text", - nullable: false, - comment: "内容。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "CommentCount", - table: "community_posts", - type: "integer", - nullable: false, - comment: "评论数。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "AuthorUserId", - table: "community_posts", - type: "uuid", - nullable: false, - comment: "作者用户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "community_posts", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "community_comments", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "community_comments", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "community_comments", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "PostId", - table: "community_comments", - type: "uuid", - nullable: false, - comment: "动态标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ParentId", - table: "community_comments", - type: "uuid", - nullable: true, - comment: "父级评论 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "IsDeleted", - table: "community_comments", - type: "boolean", - nullable: false, - comment: "状态。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "community_comments", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "community_comments", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "community_comments", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "community_comments", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Content", - table: "community_comments", - type: "character varying(512)", - maxLength: 512, - nullable: false, - comment: "评论内容。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512); - - migrationBuilder.AlterColumn( - name: "AuthorUserId", - table: "community_comments", - type: "uuid", - nullable: false, - comment: "评论人。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "community_comments", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "ValidationResultJson", - table: "checkout_sessions", - type: "text", - nullable: false, - comment: "校验结果明细 JSON。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "checkout_sessions", - type: "uuid", - nullable: false, - comment: "用户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "checkout_sessions", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "checkout_sessions", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "checkout_sessions", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "checkout_sessions", - type: "uuid", - nullable: false, - comment: "门店标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "checkout_sessions", - type: "integer", - nullable: false, - comment: "会话状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "SessionToken", - table: "checkout_sessions", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "会话 Token。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "ExpiresAt", - table: "checkout_sessions", - type: "timestamp with time zone", - nullable: false, - comment: "过期时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "checkout_sessions", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "checkout_sessions", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "checkout_sessions", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "checkout_sessions", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "checkout_sessions", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "checkin_records", - type: "uuid", - nullable: false, - comment: "用户标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "checkin_records", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "checkin_records", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "checkin_records", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "RewardJson", - table: "checkin_records", - type: "text", - nullable: false, - comment: "获得奖励 JSON。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "IsMakeup", - table: "checkin_records", - type: "boolean", - nullable: false, - comment: "是否补签。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "checkin_records", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "checkin_records", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "checkin_records", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "checkin_records", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CheckInDate", - table: "checkin_records", - type: "timestamp with time zone", - nullable: false, - comment: "签到日期(本地)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CheckInCampaignId", - table: "checkin_records", - type: "uuid", - nullable: false, - comment: "活动标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "checkin_records", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "checkin_campaigns", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "checkin_campaigns", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "checkin_campaigns", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "StartDate", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: false, - comment: "开始日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "RewardsJson", - table: "checkin_campaigns", - type: "text", - nullable: false, - comment: "连签奖励 JSON。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "checkin_campaigns", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "活动名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "EndDate", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: false, - comment: "结束日期。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "checkin_campaigns", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "活动描述。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "checkin_campaigns", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "checkin_campaigns", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AllowMakeupCount", - table: "checkin_campaigns", - type: "integer", - nullable: false, - comment: "支持补签次数。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "checkin_campaigns", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "chat_sessions", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "chat_sessions", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "chat_sessions", - type: "uuid", - nullable: true, - comment: "所属门店(可空为平台)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Status", - table: "chat_sessions", - type: "integer", - nullable: false, - comment: "会话状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "StartedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: false, - comment: "开始时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "SessionCode", - table: "chat_sessions", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "会话编号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "IsBotActive", - table: "chat_sessions", - type: "boolean", - nullable: false, - comment: "是否机器人接待中。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "EndedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: true, - comment: "结束时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "chat_sessions", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CustomerUserId", - table: "chat_sessions", - type: "uuid", - nullable: false, - comment: "顾客用户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "chat_sessions", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AgentUserId", - table: "chat_sessions", - type: "uuid", - nullable: true, - comment: "当前客服员工 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "chat_sessions", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "chat_messages", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "chat_messages", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "chat_messages", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SenderUserId", - table: "chat_messages", - type: "uuid", - nullable: true, - comment: "发送方用户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "SenderType", - table: "chat_messages", - type: "integer", - nullable: false, - comment: "发送方类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ReadAt", - table: "chat_messages", - type: "timestamp with time zone", - nullable: true, - comment: "读取时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "IsRead", - table: "chat_messages", - type: "boolean", - nullable: false, - comment: "是否已读。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "chat_messages", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "chat_messages", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "chat_messages", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "chat_messages", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "ContentType", - table: "chat_messages", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "消息类型(文字/图片/语音等)。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "Content", - table: "chat_messages", - type: "character varying(1024)", - maxLength: 1024, - nullable: false, - comment: "消息内容。", - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024); - - migrationBuilder.AlterColumn( - name: "ChatSessionId", - table: "chat_messages", - type: "uuid", - nullable: false, - comment: "会话标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "chat_messages", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "cart_items", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "cart_items", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UnitPrice", - table: "cart_items", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "单价快照。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "cart_items", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "cart_items", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ShoppingCartId", - table: "cart_items", - type: "uuid", - nullable: false, - comment: "所属购物车标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "cart_items", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "自定义备注(口味要求)。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Quantity", - table: "cart_items", - type: "integer", - nullable: false, - comment: "数量。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "ProductSkuId", - table: "cart_items", - type: "uuid", - nullable: true, - comment: "SKU 标识。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ProductName", - table: "cart_items", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "商品名称快照。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "cart_items", - type: "uuid", - nullable: false, - comment: "商品或 SKU 标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "cart_items", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "cart_items", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "cart_items", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "cart_items", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AttributesJson", - table: "cart_items", - type: "text", - nullable: true, - comment: "扩展 JSON(规格、加料选项等)。", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "cart_items", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "cart_item_addons", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "cart_item_addons", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "cart_item_addons", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "OptionId", - table: "cart_item_addons", - type: "uuid", - nullable: true, - comment: "选项 ID(可对应 ProductAddonOption)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Name", - table: "cart_item_addons", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "选项名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "ExtraPrice", - table: "cart_item_addons", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "附加价格。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "cart_item_addons", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "cart_item_addons", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "cart_item_addons", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "cart_item_addons", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CartItemId", - table: "cart_item_addons", - type: "uuid", - nullable: false, - comment: "所属购物车条目。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "cart_item_addons", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "affiliate_payouts", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "affiliate_payouts", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "affiliate_payouts", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "affiliate_payouts", - type: "integer", - nullable: false, - comment: "状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Remarks", - table: "affiliate_payouts", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "备注。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Period", - table: "affiliate_payouts", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "结算周期描述。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AlterColumn( - name: "PaidAt", - table: "affiliate_payouts", - type: "timestamp with time zone", - nullable: true, - comment: "打款时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "affiliate_payouts", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "affiliate_payouts", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "affiliate_payouts", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "affiliate_payouts", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Amount", - table: "affiliate_payouts", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "结算金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "AffiliatePartnerId", - table: "affiliate_payouts", - type: "uuid", - nullable: false, - comment: "合作伙伴标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "affiliate_payouts", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "affiliate_partners", - type: "uuid", - nullable: true, - comment: "用户 ID(如绑定平台账号)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "affiliate_partners", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "affiliate_partners", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "affiliate_partners", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "affiliate_partners", - type: "integer", - nullable: false, - comment: "当前状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Remarks", - table: "affiliate_partners", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "审核备注。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Phone", - table: "affiliate_partners", - type: "character varying(32)", - maxLength: 32, - nullable: true, - comment: "联系电话。", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DisplayName", - table: "affiliate_partners", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "昵称或渠道名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "affiliate_partners", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "affiliate_partners", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "affiliate_partners", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "affiliate_partners", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "CommissionRate", - table: "affiliate_partners", - type: "numeric", - nullable: false, - comment: "分成比例(0-1)。", - oldClrType: typeof(decimal), - oldType: "numeric"); - - migrationBuilder.AlterColumn( - name: "ChannelType", - table: "affiliate_partners", - type: "integer", - nullable: false, - comment: "渠道类型。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "affiliate_partners", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "affiliate_orders", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "affiliate_orders", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "affiliate_orders", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "affiliate_orders", - type: "integer", - nullable: false, - comment: "当前状态。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "SettledAt", - table: "affiliate_orders", - type: "timestamp with time zone", - nullable: true, - comment: "结算完成时间。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "affiliate_orders", - type: "uuid", - nullable: false, - comment: "关联订单。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "OrderAmount", - table: "affiliate_orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "订单金额。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "EstimatedCommission", - table: "affiliate_orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - comment: "预计佣金。", - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "affiliate_orders", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "affiliate_orders", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "affiliate_orders", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "affiliate_orders", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "BuyerUserId", - table: "affiliate_orders", - type: "uuid", - nullable: false, - comment: "用户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "AffiliatePartnerId", - table: "affiliate_orders", - type: "uuid", - nullable: false, - comment: "推广人标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "affiliate_orders", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterTable( - name: "ticket_comments", - oldComment: "工单评论/流转记录。"); - - migrationBuilder.AlterTable( - name: "tenants", - oldComment: "平台租户信息,描述租户的生命周期与基础资料。"); - - migrationBuilder.AlterTable( - name: "tenant_subscriptions", - oldComment: "租户套餐订阅记录。"); - - migrationBuilder.AlterTable( - name: "tenant_quota_usages", - oldComment: "租户配额使用情况快照。"); - - migrationBuilder.AlterTable( - name: "tenant_packages", - oldComment: "平台提供的租户套餐定义。"); - - migrationBuilder.AlterTable( - name: "tenant_notifications", - oldComment: "面向租户的站内通知或消息推送。"); - - migrationBuilder.AlterTable( - name: "tenant_billing_statements", - oldComment: "租户账单,用于呈现周期性收费。"); - - migrationBuilder.AlterTable( - name: "support_tickets", - oldComment: "客服工单。"); - - migrationBuilder.AlterTable( - name: "stores", - oldComment: "门店信息,承载营业配置与能力。"); - - migrationBuilder.AlterTable( - name: "store_tables", - oldComment: "桌台信息与二维码绑定。"); - - migrationBuilder.AlterTable( - name: "store_table_areas", - oldComment: "门店桌台区域配置。"); - - migrationBuilder.AlterTable( - name: "store_holidays", - oldComment: "门店休息日或特殊营业日。"); - - migrationBuilder.AlterTable( - name: "store_employee_shifts", - oldComment: "门店员工排班记录。"); - - migrationBuilder.AlterTable( - name: "store_delivery_zones", - oldComment: "门店配送范围配置。"); - - migrationBuilder.AlterTable( - name: "store_business_hours", - oldComment: "门店营业时段配置。"); - - migrationBuilder.AlterTable( - name: "shopping_carts", - oldComment: "用户购物车,按租户/门店隔离。"); - - migrationBuilder.AlterTable( - name: "reservations", - oldComment: "预约/预订记录。"); - - migrationBuilder.AlterTable( - name: "refund_requests", - oldComment: "售后/退款申请。"); - - migrationBuilder.AlterTable( - name: "queue_tickets", - oldComment: "排队叫号。"); - - migrationBuilder.AlterTable( - name: "promotion_campaigns", - oldComment: "营销活动配置。"); - - migrationBuilder.AlterTable( - name: "products", - oldComment: "商品(SPU)信息。"); - - migrationBuilder.AlterTable( - name: "product_skus", - oldComment: "商品 SKU,记录具体规格组合价格。"); - - migrationBuilder.AlterTable( - name: "product_pricing_rules", - oldComment: "商品价格策略,支持会员价/时段价等。"); - - migrationBuilder.AlterTable( - name: "product_media_assets", - oldComment: "商品媒资素材。"); - - migrationBuilder.AlterTable( - name: "product_categories", - oldComment: "商品分类。"); - - migrationBuilder.AlterTable( - name: "product_attribute_options", - oldComment: "商品规格选项。"); - - migrationBuilder.AlterTable( - name: "product_attribute_groups", - oldComment: "商品规格/属性分组。"); - - migrationBuilder.AlterTable( - name: "product_addon_options", - oldComment: "加料选项。"); - - migrationBuilder.AlterTable( - name: "product_addon_groups", - oldComment: "加料/做法分组。"); - - migrationBuilder.AlterTable( - name: "payment_refund_records", - oldComment: "支付渠道退款流水。"); - - migrationBuilder.AlterTable( - name: "payment_records", - oldComment: "支付流水。"); - - migrationBuilder.AlterTable( - name: "orders", - oldComment: "交易订单。"); - - migrationBuilder.AlterTable( - name: "order_status_histories", - oldComment: "订单状态流转记录。"); - - migrationBuilder.AlterTable( - name: "order_items", - oldComment: "订单明细。"); - - migrationBuilder.AlterTable( - name: "navigation_requests", - oldComment: "用户发起的导航请求日志。"); - - migrationBuilder.AlterTable( - name: "metric_snapshots", - oldComment: "指标快照,用于大盘展示。"); - - migrationBuilder.AlterTable( - name: "metric_definitions", - oldComment: "指标定义,描述可观测的数据点。"); - - migrationBuilder.AlterTable( - name: "metric_alert_rules", - oldComment: "指标告警规则。"); - - migrationBuilder.AlterTable( - name: "merchants", - oldComment: "商户主体信息,承载入驻和资质审核结果。"); - - migrationBuilder.AlterTable( - name: "merchant_staff", - oldComment: "商户员工账号,支持门店维度分配。"); - - migrationBuilder.AlterTable( - name: "merchant_documents", - oldComment: "商户提交的资质或证照材料。"); - - migrationBuilder.AlterTable( - name: "merchant_contracts", - oldComment: "商户合同记录。"); - - migrationBuilder.AlterTable( - name: "member_tiers", - oldComment: "会员等级定义。"); - - migrationBuilder.AlterTable( - name: "member_profiles", - oldComment: "会员档案。"); - - migrationBuilder.AlterTable( - name: "member_point_ledgers", - oldComment: "积分变动流水。"); - - migrationBuilder.AlterTable( - name: "member_growth_logs", - oldComment: "成长值变动日志。"); - - migrationBuilder.AlterTable( - name: "map_locations", - oldComment: "地图 POI 信息,用于门店定位和推荐。"); - - migrationBuilder.AlterTable( - name: "inventory_items", - oldComment: "SKU 在门店的库存信息。"); - - migrationBuilder.AlterTable( - name: "inventory_batches", - oldComment: "SKU 批次信息。"); - - migrationBuilder.AlterTable( - name: "inventory_adjustments", - oldComment: "库存调整记录。"); - - migrationBuilder.AlterTable( - name: "group_participants", - oldComment: "拼单参与者。"); - - migrationBuilder.AlterTable( - name: "group_orders", - oldComment: "拼单活动。"); - - migrationBuilder.AlterTable( - name: "delivery_orders", - oldComment: "配送单。"); - - migrationBuilder.AlterTable( - name: "delivery_events", - oldComment: "配送状态事件流水。"); - - migrationBuilder.AlterTable( - name: "coupons", - oldComment: "用户领取的券。"); - - migrationBuilder.AlterTable( - name: "coupon_templates", - oldComment: "优惠券模板。"); - - migrationBuilder.AlterTable( - name: "community_reactions", - oldComment: "社区互动反馈。"); - - migrationBuilder.AlterTable( - name: "community_posts", - oldComment: "社区动态。"); - - migrationBuilder.AlterTable( - name: "community_comments", - oldComment: "社区评论。"); - - migrationBuilder.AlterTable( - name: "checkout_sessions", - oldComment: "结账会话,记录校验上下文。"); - - migrationBuilder.AlterTable( - name: "checkin_records", - oldComment: "用户签到记录。"); - - migrationBuilder.AlterTable( - name: "checkin_campaigns", - oldComment: "签到活动配置。"); - - migrationBuilder.AlterTable( - name: "chat_sessions", - oldComment: "客服会话。"); - - migrationBuilder.AlterTable( - name: "chat_messages", - oldComment: "会话消息。"); - - migrationBuilder.AlterTable( - name: "cart_items", - oldComment: "购物车条目。"); - - migrationBuilder.AlterTable( - name: "cart_item_addons", - oldComment: "购物车条目的加料/附加项。"); - - migrationBuilder.AlterTable( - name: "affiliate_payouts", - oldComment: "佣金结算记录。"); - - migrationBuilder.AlterTable( - name: "affiliate_partners", - oldComment: "分销/推广合作伙伴。"); - - migrationBuilder.AlterTable( - name: "affiliate_orders", - oldComment: "分销订单记录。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "ticket_comments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "ticket_comments", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "ticket_comments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SupportTicketId", - table: "ticket_comments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "工单标识。"); - - migrationBuilder.AlterColumn( - name: "IsInternal", - table: "ticket_comments", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否内部备注。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "ticket_comments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "ticket_comments", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "ticket_comments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "ticket_comments", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Content", - table: "ticket_comments", - type: "character varying(1024)", - maxLength: 1024, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024, - oldComment: "评论内容。"); - - migrationBuilder.AlterColumn( - name: "AuthorUserId", - table: "ticket_comments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "评论人 ID。"); - - migrationBuilder.AlterColumn( - name: "AttachmentsJson", - table: "ticket_comments", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "附件 JSON。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "ticket_comments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "Website", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "官网或主要宣传链接。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "Tags", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "业务标签集合(逗号分隔)。"); - - migrationBuilder.AlterColumn( - name: "SuspensionReason", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "暂停或终止的原因说明。"); - - migrationBuilder.AlterColumn( - name: "SuspendedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次暂停服务时间。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "tenants", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "租户当前状态,涵盖审核、启用、停用等场景。"); - - migrationBuilder.AlterColumn( - name: "ShortName", - table: "tenants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "对外展示的简称。"); - - migrationBuilder.AlterColumn( - name: "Remarks", - table: "tenants", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "备注信息,用于运营记录特殊说明。"); - - migrationBuilder.AlterColumn( - name: "Province", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "所在省份或州。"); - - migrationBuilder.AlterColumn( - name: "PrimaryOwnerUserId", - table: "tenants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "系统内对应的租户所有者账号 ID。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "tenants", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "租户全称或品牌名称。"); - - migrationBuilder.AlterColumn( - name: "LogoUrl", - table: "tenants", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "LOGO 图片地址。"); - - migrationBuilder.AlterColumn( - name: "LegalEntityName", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "法人或公司主体名称。"); - - migrationBuilder.AlterColumn( - name: "Industry", - table: "tenants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "所属行业,如餐饮、零售等。"); - - migrationBuilder.AlterColumn( - name: "EffectiveTo", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "服务到期时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "EffectiveFrom", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "服务生效时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenants", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CoverImageUrl", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "品牌海报或封面图。"); - - migrationBuilder.AlterColumn( - name: "Country", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "所在国家/地区。"); - - migrationBuilder.AlterColumn( - name: "ContactPhone", - table: "tenants", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "主联系人电话。"); - - migrationBuilder.AlterColumn( - name: "ContactName", - table: "tenants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "主联系人姓名。"); - - migrationBuilder.AlterColumn( - name: "ContactEmail", - table: "tenants", - type: "character varying(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true, - oldComment: "主联系人邮箱。"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "tenants", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "租户短编码,作为跨系统引用的唯一标识。"); - - migrationBuilder.AlterColumn( - name: "City", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "所在城市。"); - - migrationBuilder.AlterColumn( - name: "Address", - table: "tenants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "详细地址信息。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenants", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_subscriptions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantPackageId", - table: "tenant_subscriptions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "当前订阅关联的套餐标识。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "tenant_subscriptions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "tenant_subscriptions", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "订阅当前状态。"); - - migrationBuilder.AlterColumn( - name: "ScheduledPackageId", - table: "tenant_subscriptions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "若已排期升降配,对应的新套餐 ID。"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "tenant_subscriptions", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "运营备注信息。"); - - migrationBuilder.AlterColumn( - name: "NextBillingDate", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "下一个计费时间,配合自动续费使用。"); - - migrationBuilder.AlterColumn( - name: "EffectiveTo", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "订阅到期时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "EffectiveFrom", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "订阅生效时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_subscriptions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_subscriptions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_subscriptions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AutoRenew", - table: "tenant_subscriptions", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否开启自动续费。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_subscriptions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UsedValue", - table: "tenant_quota_usages", - type: "numeric", - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric", - oldComment: "已消耗的数量。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_quota_usages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_quota_usages", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "tenant_quota_usages", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "ResetCycle", - table: "tenant_quota_usages", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "配额刷新周期描述(如月、年)。"); - - migrationBuilder.AlterColumn( - name: "QuotaType", - table: "tenant_quota_usages", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "配额类型,例如门店数、短信条数等。"); - - migrationBuilder.AlterColumn( - name: "LimitValue", - table: "tenant_quota_usages", - type: "numeric", - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric", - oldComment: "当前配额上限。"); - - migrationBuilder.AlterColumn( - name: "LastResetAt", - table: "tenant_quota_usages", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次重置时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_quota_usages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_quota_usages", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_quota_usages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_quota_usages", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_quota_usages", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "YearlyPrice", - table: "tenant_packages", - type: "numeric", - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true, - oldComment: "年付价格,单位:人民币元。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_packages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_packages", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "PackageType", - table: "tenant_packages", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "套餐分类(试用、标准、旗舰等)。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "tenant_packages", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "套餐名称,展示给租户的简称。"); - - migrationBuilder.AlterColumn( - name: "MonthlyPrice", - table: "tenant_packages", - type: "numeric", - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true, - oldComment: "月付价格,单位:人民币元。"); - - migrationBuilder.AlterColumn( - name: "MaxStoreCount", - table: "tenant_packages", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "允许的最大门店数。"); - - migrationBuilder.AlterColumn( - name: "MaxStorageGb", - table: "tenant_packages", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "存储容量上限(GB)。"); - - migrationBuilder.AlterColumn( - name: "MaxSmsCredits", - table: "tenant_packages", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "每月短信额度上限。"); - - migrationBuilder.AlterColumn( - name: "MaxDeliveryOrders", - table: "tenant_packages", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "每月可调用的配送单数量上限。"); - - migrationBuilder.AlterColumn( - name: "MaxAccountCount", - table: "tenant_packages", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "允许创建的最大账号数。"); - - migrationBuilder.AlterColumn( - name: "IsActive", - table: "tenant_packages", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否仍可售卖。"); - - migrationBuilder.AlterColumn( - name: "FeaturePoliciesJson", - table: "tenant_packages", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "权益明细 JSON,记录自定义特性开关。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "tenant_packages", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "套餐描述,包含适用场景、权益等。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_packages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_packages", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_packages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_packages", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_packages", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_notifications", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "Title", - table: "tenant_notifications", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "通知标题。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "tenant_notifications", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Severity", - table: "tenant_notifications", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "通知重要级别。"); - - migrationBuilder.AlterColumn( - name: "SentAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "推送时间。"); - - migrationBuilder.AlterColumn( - name: "ReadAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "租户是否已阅读。"); - - migrationBuilder.AlterColumn( - name: "MetadataJson", - table: "tenant_notifications", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "附加元数据 JSON。"); - - migrationBuilder.AlterColumn( - name: "Message", - table: "tenant_notifications", - type: "character varying(1024)", - maxLength: 1024, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024, - oldComment: "通知正文。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_notifications", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_notifications", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_notifications", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Channel", - table: "tenant_notifications", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "发布通道(站内、邮件、短信等)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_notifications", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "tenant_billing_statements", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "tenant_billing_statements", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "tenant_billing_statements", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "当前付款状态。"); - - migrationBuilder.AlterColumn( - name: "StatementNo", - table: "tenant_billing_statements", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "账单编号,供对账查询。"); - - migrationBuilder.AlterColumn( - name: "PeriodStart", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "账单周期开始时间。"); - - migrationBuilder.AlterColumn( - name: "PeriodEnd", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "账单周期结束时间。"); - - migrationBuilder.AlterColumn( - name: "LineItemsJson", - table: "tenant_billing_statements", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "账单明细 JSON,记录各项费用。"); - - migrationBuilder.AlterColumn( - name: "DueDate", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "到期日。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "tenant_billing_statements", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "tenant_billing_statements", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "tenant_billing_statements", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AmountPaid", - table: "tenant_billing_statements", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "实付金额。"); - - migrationBuilder.AlterColumn( - name: "AmountDue", - table: "tenant_billing_statements", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "应付金额。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "tenant_billing_statements", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "support_tickets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TicketNo", - table: "support_tickets", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "工单编号。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "support_tickets", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Subject", - table: "support_tickets", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "工单主题。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "support_tickets", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "Priority", - table: "support_tickets", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "优先级。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "support_tickets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "关联订单(如有)。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "support_tickets", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "工单详情。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "support_tickets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CustomerUserId", - table: "support_tickets", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "客户用户 ID。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "support_tickets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ClosedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "关闭时间。"); - - migrationBuilder.AlterColumn( - name: "AssignedAgentId", - table: "support_tickets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "指派的客服。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "support_tickets", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "stores", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "stores", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "stores", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Tags", - table: "stores", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "门店标签(逗号分隔)。"); - - migrationBuilder.AlterColumn( - name: "SupportsReservation", - table: "stores", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "支持预约。"); - - migrationBuilder.AlterColumn( - name: "SupportsQueueing", - table: "stores", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "支持排队叫号。"); - - migrationBuilder.AlterColumn( - name: "SupportsPickup", - table: "stores", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否支持自提。"); - - migrationBuilder.AlterColumn( - name: "SupportsDineIn", - table: "stores", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否支持堂食。"); - - migrationBuilder.AlterColumn( - name: "SupportsDelivery", - table: "stores", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否支持配送。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "stores", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "门店当前运营状态。"); - - migrationBuilder.AlterColumn( - name: "Province", - table: "stores", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "所在省份。"); - - migrationBuilder.AlterColumn( - name: "Phone", - table: "stores", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "联系电话。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "stores", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "门店名称。"); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "stores", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属商户标识。"); - - migrationBuilder.AlterColumn( - name: "ManagerName", - table: "stores", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "门店负责人姓名。"); - - migrationBuilder.AlterColumn( - name: "Longitude", - table: "stores", - type: "double precision", - nullable: true, - oldClrType: typeof(double), - oldType: "double precision", - oldNullable: true, - oldComment: "高德/腾讯地图经度。"); - - migrationBuilder.AlterColumn( - name: "Latitude", - table: "stores", - type: "double precision", - nullable: true, - oldClrType: typeof(double), - oldType: "double precision", - oldNullable: true, - oldComment: "纬度。"); - - migrationBuilder.AlterColumn( - name: "District", - table: "stores", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "区县信息。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "stores", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "门店描述或公告。"); - - migrationBuilder.AlterColumn( - name: "DeliveryRadiusKm", - table: "stores", - type: "numeric(6,2)", - precision: 6, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(6,2)", - oldPrecision: 6, - oldScale: 2, - oldComment: "默认配送半径(公里)。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "stores", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "stores", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "stores", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "stores", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CoverImageUrl", - table: "stores", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "门店海报。"); - - migrationBuilder.AlterColumn( - name: "Country", - table: "stores", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "所在国家或地区。"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "stores", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "门店编码,便于扫码及外部对接。"); - - migrationBuilder.AlterColumn( - name: "City", - table: "stores", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "所在城市。"); - - migrationBuilder.AlterColumn( - name: "BusinessHours", - table: "stores", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "门店营业时段描述(备用字符串)。"); - - migrationBuilder.AlterColumn( - name: "Announcement", - table: "stores", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "门店公告。"); - - migrationBuilder.AlterColumn( - name: "Address", - table: "stores", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "详细地址。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "stores", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_tables", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_tables", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_tables", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Tags", - table: "store_tables", - type: "character varying(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true, - oldComment: "桌台标签(堂食、快餐等)。"); - - migrationBuilder.AlterColumn( - name: "TableCode", - table: "store_tables", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "桌码。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_tables", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "store_tables", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "当前桌台状态。"); - - migrationBuilder.AlterColumn( - name: "QrCodeUrl", - table: "store_tables", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "桌码二维码地址。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_tables", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_tables", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_tables", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_tables", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Capacity", - table: "store_tables", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "可容纳人数。"); - - migrationBuilder.AlterColumn( - name: "AreaId", - table: "store_tables", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "所在区域 ID。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_tables", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_table_areas", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_table_areas", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_table_areas", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_table_areas", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "store_table_areas", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "区域名称。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "store_table_areas", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "区域描述。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_table_areas", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_table_areas", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_table_areas", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_table_areas", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_table_areas", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_holidays", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_holidays", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_holidays", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_holidays", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "Reason", - table: "store_holidays", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "说明内容。"); - - migrationBuilder.AlterColumn( - name: "IsClosed", - table: "store_holidays", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否全天闭店。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_holidays", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_holidays", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "Date", - table: "store_holidays", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "日期。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_holidays", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_holidays", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_holidays", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_employee_shifts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_employee_shifts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_employee_shifts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_employee_shifts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "StartTime", - table: "store_employee_shifts", - type: "interval", - nullable: false, - oldClrType: typeof(TimeSpan), - oldType: "interval", - oldComment: "开始时间。"); - - migrationBuilder.AlterColumn( - name: "StaffId", - table: "store_employee_shifts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "员工标识。"); - - migrationBuilder.AlterColumn( - name: "ShiftDate", - table: "store_employee_shifts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "班次日期。"); - - migrationBuilder.AlterColumn( - name: "RoleType", - table: "store_employee_shifts", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "排班角色。"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "store_employee_shifts", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "备注。"); - - migrationBuilder.AlterColumn( - name: "EndTime", - table: "store_employee_shifts", - type: "interval", - nullable: false, - oldClrType: typeof(TimeSpan), - oldType: "interval", - oldComment: "结束时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_employee_shifts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_employee_shifts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_employee_shifts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_employee_shifts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_employee_shifts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "ZoneName", - table: "store_delivery_zones", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "区域名称。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_delivery_zones", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_delivery_zones", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_delivery_zones", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_delivery_zones", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "PolygonGeoJson", - table: "store_delivery_zones", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "GeoJSON 表示的多边形范围。"); - - migrationBuilder.AlterColumn( - name: "MinimumOrderAmount", - table: "store_delivery_zones", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true, - oldComment: "起送价。"); - - migrationBuilder.AlterColumn( - name: "EstimatedMinutes", - table: "store_delivery_zones", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "预计送达分钟。"); - - migrationBuilder.AlterColumn( - name: "DeliveryFee", - table: "store_delivery_zones", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true, - oldComment: "配送费。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_delivery_zones", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_delivery_zones", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_delivery_zones", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_delivery_zones", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_delivery_zones", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "store_business_hours", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "store_business_hours", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "store_business_hours", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "store_business_hours", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "StartTime", - table: "store_business_hours", - type: "interval", - nullable: false, - oldClrType: typeof(TimeSpan), - oldType: "interval", - oldComment: "开始时间(本地时间)。"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "store_business_hours", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "备注。"); - - migrationBuilder.AlterColumn( - name: "HourType", - table: "store_business_hours", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "时段类型(正常营业、休息、预约等)。"); - - migrationBuilder.AlterColumn( - name: "EndTime", - table: "store_business_hours", - type: "interval", - nullable: false, - oldClrType: typeof(TimeSpan), - oldType: "interval", - oldComment: "结束时间(本地时间)。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "store_business_hours", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "store_business_hours", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DayOfWeek", - table: "store_business_hours", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "星期几,0 表示周日。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "store_business_hours", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "store_business_hours", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CapacityLimit", - table: "store_business_hours", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "最大接待容量或单量限制。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "store_business_hours", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "shopping_carts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "用户标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "shopping_carts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "shopping_carts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "shopping_carts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "TableContext", - table: "shopping_carts", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "桌码或场景标识(扫码点餐)。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "shopping_carts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "shopping_carts", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "购物车状态,包含正常/锁定。"); - - migrationBuilder.AlterColumn( - name: "LastModifiedAt", - table: "shopping_carts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "最近一次修改时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "DeliveryPreference", - table: "shopping_carts", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "履约方式(堂食/自提/配送)缓存。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "shopping_carts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "shopping_carts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "shopping_carts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "shopping_carts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "shopping_carts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "reservations", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "reservations", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "reservations", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "TablePreference", - table: "reservations", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "桌型/标签。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "reservations", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "reservations", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "ReservationTime", - table: "reservations", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "预约时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ReservationNo", - table: "reservations", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "预约号。"); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "reservations", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "备注。"); - - migrationBuilder.AlterColumn( - name: "PeopleCount", - table: "reservations", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "用餐人数。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "reservations", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "reservations", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CustomerPhone", - table: "reservations", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "联系电话。"); - - migrationBuilder.AlterColumn( - name: "CustomerName", - table: "reservations", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "客户姓名。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "reservations", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "reservations", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CheckedInAt", - table: "reservations", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "实际签到时间。"); - - migrationBuilder.AlterColumn( - name: "CheckInCode", - table: "reservations", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "核销码/到店码。"); - - migrationBuilder.AlterColumn( - name: "CancelledAt", - table: "reservations", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "取消时间。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "reservations", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "refund_requests", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "refund_requests", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "refund_requests", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "退款状态。"); - - migrationBuilder.AlterColumn( - name: "ReviewNotes", - table: "refund_requests", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "审核备注。"); - - migrationBuilder.AlterColumn( - name: "RequestedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "用户提交时间。"); - - migrationBuilder.AlterColumn( - name: "RefundNo", - table: "refund_requests", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "退款单号。"); - - migrationBuilder.AlterColumn( - name: "Reason", - table: "refund_requests", - type: "character varying(256)", - maxLength: 256, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "申请原因。"); - - migrationBuilder.AlterColumn( - name: "ProcessedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "审核完成时间。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "refund_requests", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "关联订单标识。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "refund_requests", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "refund_requests", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "refund_requests", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Amount", - table: "refund_requests", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "申请金额。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "refund_requests", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "queue_tickets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TicketNumber", - table: "queue_tickets", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "排队编号。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "queue_tickets", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "queue_tickets", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "queue_tickets", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "备注。"); - - migrationBuilder.AlterColumn( - name: "PartySize", - table: "queue_tickets", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "就餐人数。"); - - migrationBuilder.AlterColumn( - name: "ExpiredAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "过号时间。"); - - migrationBuilder.AlterColumn( - name: "EstimatedWaitMinutes", - table: "queue_tickets", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "预计等待分钟。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "queue_tickets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "queue_tickets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CancelledAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "取消时间。"); - - migrationBuilder.AlterColumn( - name: "CalledAt", - table: "queue_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "叫号时间。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "queue_tickets", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "promotion_campaigns", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "promotion_campaigns", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "promotion_campaigns", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "活动状态。"); - - migrationBuilder.AlterColumn( - name: "StartAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "开始时间。"); - - migrationBuilder.AlterColumn( - name: "RulesJson", - table: "promotion_campaigns", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "活动规则 JSON。"); - - migrationBuilder.AlterColumn( - name: "PromotionType", - table: "promotion_campaigns", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "活动类型。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "promotion_campaigns", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "活动名称。"); - - migrationBuilder.AlterColumn( - name: "EndAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "结束时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "promotion_campaigns", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "promotion_campaigns", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "promotion_campaigns", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Budget", - table: "promotion_campaigns", - type: "numeric", - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true, - oldComment: "预算金额。"); - - migrationBuilder.AlterColumn( - name: "BannerUrl", - table: "promotion_campaigns", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "营销素材(如 banner)。"); - - migrationBuilder.AlterColumn( - name: "AudienceDescription", - table: "promotion_campaigns", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "目标人群描述。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "promotion_campaigns", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "products", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "products", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "Unit", - table: "products", - type: "character varying(16)", - maxLength: 16, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(16)", - oldMaxLength: 16, - oldNullable: true, - oldComment: "售卖单位(份/杯等)。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "products", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Subtitle", - table: "products", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "副标题/卖点。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "products", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属门店。"); - - migrationBuilder.AlterColumn( - name: "StockQuantity", - table: "products", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "库存数量(可选)。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "products", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "商品状态。"); - - migrationBuilder.AlterColumn( - name: "SpuCode", - table: "products", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "商品编码。"); - - migrationBuilder.AlterColumn( - name: "Price", - table: "products", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "现价。"); - - migrationBuilder.AlterColumn( - name: "OriginalPrice", - table: "products", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true, - oldComment: "原价。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "products", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "商品名称。"); - - migrationBuilder.AlterColumn( - name: "MaxQuantityPerOrder", - table: "products", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "最大每单限购。"); - - migrationBuilder.AlterColumn( - name: "IsFeatured", - table: "products", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否热门推荐。"); - - migrationBuilder.AlterColumn( - name: "GalleryImages", - table: "products", - type: "character varying(1024)", - maxLength: 1024, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024, - oldNullable: true, - oldComment: "Gallery 图片逗号分隔。"); - - migrationBuilder.AlterColumn( - name: "EnablePickup", - table: "products", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "支持自提。"); - - migrationBuilder.AlterColumn( - name: "EnableDineIn", - table: "products", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "支持堂食。"); - - migrationBuilder.AlterColumn( - name: "EnableDelivery", - table: "products", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "支持配送。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "products", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "商品描述。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "products", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "products", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "products", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "products", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CoverImage", - table: "products", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "主图。"); - - migrationBuilder.AlterColumn( - name: "CategoryId", - table: "products", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属分类。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "products", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "Weight", - table: "product_skus", - type: "numeric(10,3)", - precision: 10, - scale: 3, - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric(10,3)", - oldPrecision: 10, - oldScale: 3, - oldNullable: true, - oldComment: "重量(千克)。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_skus", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_skus", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_skus", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StockQuantity", - table: "product_skus", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "可售库存。"); - - migrationBuilder.AlterColumn( - name: "SkuCode", - table: "product_skus", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "SKU 编码。"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "product_skus", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属商品标识。"); - - migrationBuilder.AlterColumn( - name: "Price", - table: "product_skus", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "售价。"); - - migrationBuilder.AlterColumn( - name: "OriginalPrice", - table: "product_skus", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true, - oldComment: "原价。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_skus", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_skus", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_skus", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_skus", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Barcode", - table: "product_skus", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "条形码。"); - - migrationBuilder.AlterColumn( - name: "AttributesJson", - table: "product_skus", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "规格属性 JSON(记录选项 ID)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_skus", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "WeekdaysJson", - table: "product_pricing_rules", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "生效星期(JSON 数组)。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_pricing_rules", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_pricing_rules", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StartTime", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "生效开始时间。"); - - migrationBuilder.AlterColumn( - name: "RuleType", - table: "product_pricing_rules", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "策略类型。"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "product_pricing_rules", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属商品。"); - - migrationBuilder.AlterColumn( - name: "Price", - table: "product_pricing_rules", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "特殊价格。"); - - migrationBuilder.AlterColumn( - name: "EndTime", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "生效结束时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_pricing_rules", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_pricing_rules", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_pricing_rules", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ConditionsJson", - table: "product_pricing_rules", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "条件描述(JSON),如会员等级、渠道等。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_pricing_rules", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "Url", - table: "product_media_assets", - type: "character varying(512)", - maxLength: 512, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldComment: "媒资链接。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_media_assets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_media_assets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_media_assets", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_media_assets", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "排序。"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "product_media_assets", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "商品标识。"); - - migrationBuilder.AlterColumn( - name: "MediaType", - table: "product_media_assets", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "媒体类型。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_media_assets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_media_assets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_media_assets", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_media_assets", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Caption", - table: "product_media_assets", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "描述或标题。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_media_assets", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_categories", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_categories", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_categories", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "product_categories", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属门店。"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_categories", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "排序值。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_categories", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "分类名称。"); - - migrationBuilder.AlterColumn( - name: "IsEnabled", - table: "product_categories", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否启用。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "product_categories", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "分类描述。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_categories", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_categories", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_categories", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_categories", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_categories", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_attribute_options", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_attribute_options", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_attribute_options", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_attribute_options", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "排序。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_attribute_options", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "选项名称。"); - - migrationBuilder.AlterColumn( - name: "IsDefault", - table: "product_attribute_options", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否默认选中。"); - - migrationBuilder.AlterColumn( - name: "ExtraPrice", - table: "product_attribute_options", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true, - oldComment: "附加价格。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_attribute_options", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_attribute_options", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_attribute_options", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_attribute_options", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AttributeGroupId", - table: "product_attribute_options", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属规格组。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_attribute_options", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_attribute_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_attribute_groups", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_attribute_groups", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "product_attribute_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "关联门店,可为空表示所有门店共享。"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_attribute_groups", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "显示排序。"); - - migrationBuilder.AlterColumn( - name: "SelectionType", - table: "product_attribute_groups", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "选择类型(单选/多选)。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_attribute_groups", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "分组名称,例如“辣度”“份量”。"); - - migrationBuilder.AlterColumn( - name: "IsRequired", - table: "product_attribute_groups", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否必选。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_attribute_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_attribute_groups", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_attribute_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_attribute_groups", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_attribute_groups", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_addon_options", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_addon_options", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_addon_options", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_addon_options", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "排序。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_addon_options", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "选项名称。"); - - migrationBuilder.AlterColumn( - name: "IsDefault", - table: "product_addon_options", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否默认选项。"); - - migrationBuilder.AlterColumn( - name: "ExtraPrice", - table: "product_addon_options", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true, - oldComment: "附加价格。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_addon_options", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_addon_options", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_addon_options", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_addon_options", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AddonGroupId", - table: "product_addon_options", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属加料分组。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_addon_options", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "product_addon_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "product_addon_groups", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "product_addon_groups", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "product_addon_groups", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "排序值。"); - - migrationBuilder.AlterColumn( - name: "SelectionType", - table: "product_addon_groups", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "选择类型。"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "product_addon_groups", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属商品。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "product_addon_groups", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "分组名称。"); - - migrationBuilder.AlterColumn( - name: "MinSelect", - table: "product_addon_groups", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "最小选择数量。"); - - migrationBuilder.AlterColumn( - name: "MaxSelect", - table: "product_addon_groups", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "最大选择数量。"); - - migrationBuilder.AlterColumn( - name: "IsRequired", - table: "product_addon_groups", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否必选。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "product_addon_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "product_addon_groups", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "product_addon_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "product_addon_groups", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "product_addon_groups", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "payment_refund_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "payment_refund_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "payment_refund_records", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "退款状态。"); - - migrationBuilder.AlterColumn( - name: "RequestedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "退款请求时间。"); - - migrationBuilder.AlterColumn( - name: "PaymentRecordId", - table: "payment_refund_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "原支付记录标识。"); - - migrationBuilder.AlterColumn( - name: "Payload", - table: "payment_refund_records", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "渠道返回的原始数据 JSON。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "payment_refund_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "关联订单标识。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "payment_refund_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "payment_refund_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CompletedAt", - table: "payment_refund_records", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "完成时间。"); - - migrationBuilder.AlterColumn( - name: "ChannelRefundId", - table: "payment_refund_records", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "渠道退款流水号。"); - - migrationBuilder.AlterColumn( - name: "Amount", - table: "payment_refund_records", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "退款金额。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "payment_refund_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "payment_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "payment_records", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TradeNo", - table: "payment_records", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "平台交易号。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "payment_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "payment_records", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "支付状态。"); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "payment_records", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "错误/备注。"); - - migrationBuilder.AlterColumn( - name: "Payload", - table: "payment_records", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "原始回调内容。"); - - migrationBuilder.AlterColumn( - name: "PaidAt", - table: "payment_records", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "支付完成时间。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "payment_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "关联订单。"); - - migrationBuilder.AlterColumn( - name: "Method", - table: "payment_records", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "支付方式。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "payment_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "payment_records", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "payment_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "payment_records", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ChannelTransactionId", - table: "payment_records", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "第三方渠道单号。"); - - migrationBuilder.AlterColumn( - name: "Amount", - table: "payment_records", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "支付金额。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "payment_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "TableNo", - table: "orders", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "就餐桌号。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "当前状态。"); - - migrationBuilder.AlterColumn( - name: "ReservationId", - table: "orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "预约 ID。"); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "orders", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "备注。"); - - migrationBuilder.AlterColumn( - name: "QueueNumber", - table: "orders", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "排队号(如有)。"); - - migrationBuilder.AlterColumn( - name: "PaymentStatus", - table: "orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "支付状态。"); - - migrationBuilder.AlterColumn( - name: "PayableAmount", - table: "orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "应付金额。"); - - migrationBuilder.AlterColumn( - name: "PaidAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "支付时间。"); - - migrationBuilder.AlterColumn( - name: "PaidAmount", - table: "orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "实付金额。"); - - migrationBuilder.AlterColumn( - name: "OrderNo", - table: "orders", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "订单号。"); - - migrationBuilder.AlterColumn( - name: "ItemsAmount", - table: "orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "商品总额。"); - - migrationBuilder.AlterColumn( - name: "FinishedAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "完成时间。"); - - migrationBuilder.AlterColumn( - name: "DiscountAmount", - table: "orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "优惠金额。"); - - migrationBuilder.AlterColumn( - name: "DeliveryType", - table: "orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "履约类型。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CustomerPhone", - table: "orders", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "顾客手机号。"); - - migrationBuilder.AlterColumn( - name: "CustomerName", - table: "orders", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "顾客姓名。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "orders", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Channel", - table: "orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "下单渠道。"); - - migrationBuilder.AlterColumn( - name: "CancelledAt", - table: "orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "取消时间。"); - - migrationBuilder.AlterColumn( - name: "CancelReason", - table: "orders", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "取消原因。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "order_status_histories", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "order_status_histories", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "order_status_histories", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "order_status_histories", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "变更后的状态。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "order_status_histories", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "订单标识。"); - - migrationBuilder.AlterColumn( - name: "OperatorId", - table: "order_status_histories", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "操作人标识(可为空表示系统)。"); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "order_status_histories", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "发生时间。"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "order_status_histories", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "备注信息。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "order_status_histories", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "order_status_histories", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "order_status_histories", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "order_status_histories", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "order_status_histories", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "order_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "order_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "UnitPrice", - table: "order_items", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "单价。"); - - migrationBuilder.AlterColumn( - name: "Unit", - table: "order_items", - type: "character varying(16)", - maxLength: 16, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(16)", - oldMaxLength: 16, - oldNullable: true, - oldComment: "单位。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "order_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SubTotal", - table: "order_items", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "小计。"); - - migrationBuilder.AlterColumn( - name: "SkuName", - table: "order_items", - type: "character varying(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true, - oldComment: "SKU/规格描述。"); - - migrationBuilder.AlterColumn( - name: "Quantity", - table: "order_items", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "数量。"); - - migrationBuilder.AlterColumn( - name: "ProductName", - table: "order_items", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "商品名称。"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "order_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "商品 ID。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "order_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "订单 ID。"); - - migrationBuilder.AlterColumn( - name: "DiscountAmount", - table: "order_items", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "折扣金额。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "order_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "order_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "order_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "order_items", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AttributesJson", - table: "order_items", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "自定义属性 JSON。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "order_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "navigation_requests", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "用户 ID。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "navigation_requests", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "navigation_requests", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "navigation_requests", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "TargetApp", - table: "navigation_requests", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "跳转的地图应用。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "navigation_requests", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店 ID。"); - - migrationBuilder.AlterColumn( - name: "RequestedAt", - table: "navigation_requests", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "请求时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "navigation_requests", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "navigation_requests", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "navigation_requests", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "navigation_requests", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Channel", - table: "navigation_requests", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "来源通道(小程序、H5 等)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "navigation_requests", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "WindowStart", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "统计时间窗口开始。"); - - migrationBuilder.AlterColumn( - name: "WindowEnd", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "统计时间窗口结束。"); - - migrationBuilder.AlterColumn( - name: "Value", - table: "metric_snapshots", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,4)", - oldPrecision: 18, - oldScale: 4, - oldComment: "数值。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "metric_snapshots", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "metric_snapshots", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "MetricDefinitionId", - table: "metric_snapshots", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "指标定义 ID。"); - - migrationBuilder.AlterColumn( - name: "DimensionKey", - table: "metric_snapshots", - type: "character varying(256)", - maxLength: 256, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "维度键(JSON)。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "metric_snapshots", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "metric_snapshots", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "metric_snapshots", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "metric_snapshots", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "metric_definitions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "metric_definitions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "metric_definitions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "metric_definitions", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "指标名称。"); - - migrationBuilder.AlterColumn( - name: "DimensionsJson", - table: "metric_definitions", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "维度描述 JSON。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "metric_definitions", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "说明。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "metric_definitions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "metric_definitions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DefaultAggregation", - table: "metric_definitions", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "默认聚合方式。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "metric_definitions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "metric_definitions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "metric_definitions", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "指标编码。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "metric_definitions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "metric_alert_rules", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "metric_alert_rules", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "metric_alert_rules", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Severity", - table: "metric_alert_rules", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "告警级别。"); - - migrationBuilder.AlterColumn( - name: "NotificationChannels", - table: "metric_alert_rules", - type: "character varying(256)", - maxLength: 256, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "通知渠道。"); - - migrationBuilder.AlterColumn( - name: "MetricDefinitionId", - table: "metric_alert_rules", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "关联指标。"); - - migrationBuilder.AlterColumn( - name: "Enabled", - table: "metric_alert_rules", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否启用。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "metric_alert_rules", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "metric_alert_rules", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "metric_alert_rules", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "metric_alert_rules", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ConditionJson", - table: "metric_alert_rules", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "触发条件 JSON。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "metric_alert_rules", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "merchants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "merchants", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "TaxNumber", - table: "merchants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "税号/统一社会信用代码。"); - - migrationBuilder.AlterColumn( - name: "SupportEmail", - table: "merchants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "客服邮箱。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "merchants", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "入驻状态。"); - - migrationBuilder.AlterColumn( - name: "ServicePhone", - table: "merchants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "客服电话。"); - - migrationBuilder.AlterColumn( - name: "ReviewRemarks", - table: "merchants", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "审核备注或驳回原因。"); - - migrationBuilder.AlterColumn( - name: "Province", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "所在省份。"); - - migrationBuilder.AlterColumn( - name: "Longitude", - table: "merchants", - type: "double precision", - nullable: true, - oldClrType: typeof(double), - oldType: "double precision", - oldNullable: true, - oldComment: "经度信息。"); - - migrationBuilder.AlterColumn( - name: "LogoUrl", - table: "merchants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "品牌 Logo。"); - - migrationBuilder.AlterColumn( - name: "LegalPerson", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "法人或负责人姓名。"); - - migrationBuilder.AlterColumn( - name: "Latitude", - table: "merchants", - type: "double precision", - nullable: true, - oldClrType: typeof(double), - oldType: "double precision", - oldNullable: true, - oldComment: "纬度信息。"); - - migrationBuilder.AlterColumn( - name: "LastReviewedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次审核时间。"); - - migrationBuilder.AlterColumn( - name: "JoinedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "入驻时间。"); - - migrationBuilder.AlterColumn( - name: "District", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "所在区县。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "merchants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "merchants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "merchants", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ContactPhone", - table: "merchants", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "联系电话。"); - - migrationBuilder.AlterColumn( - name: "ContactEmail", - table: "merchants", - type: "character varying(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true, - oldComment: "联系邮箱。"); - - migrationBuilder.AlterColumn( - name: "City", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "所在城市。"); - - migrationBuilder.AlterColumn( - name: "Category", - table: "merchants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "品牌所属品类,如火锅、咖啡等。"); - - migrationBuilder.AlterColumn( - name: "BusinessLicenseNumber", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "营业执照号。"); - - migrationBuilder.AlterColumn( - name: "BusinessLicenseImageUrl", - table: "merchants", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "营业执照扫描件地址。"); - - migrationBuilder.AlterColumn( - name: "BrandName", - table: "merchants", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "品牌名称(对外展示)。"); - - migrationBuilder.AlterColumn( - name: "BrandAlias", - table: "merchants", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "品牌简称或别名。"); - - migrationBuilder.AlterColumn( - name: "Address", - table: "merchants", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "详细地址。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "merchants", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "merchant_staff", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "merchant_staff", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "merchant_staff", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "merchant_staff", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "可选的关联门店 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "merchant_staff", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "员工状态。"); - - migrationBuilder.AlterColumn( - name: "RoleType", - table: "merchant_staff", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "员工角色类型。"); - - migrationBuilder.AlterColumn( - name: "Phone", - table: "merchant_staff", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "手机号。"); - - migrationBuilder.AlterColumn( - name: "PermissionsJson", - table: "merchant_staff", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "自定义权限(JSON)。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "merchant_staff", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "员工姓名。"); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "merchant_staff", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属商户标识。"); - - migrationBuilder.AlterColumn( - name: "IdentityUserId", - table: "merchant_staff", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "登录账号 ID(指向统一身份体系)。"); - - migrationBuilder.AlterColumn( - name: "Email", - table: "merchant_staff", - type: "character varying(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true, - oldComment: "邮箱地址。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "merchant_staff", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "merchant_staff", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "merchant_staff", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "merchant_staff", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "merchant_staff", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "merchant_documents", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "merchant_documents", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "merchant_documents", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "审核状态。"); - - migrationBuilder.AlterColumn( - name: "Remarks", - table: "merchant_documents", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "审核备注或驳回原因。"); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "merchant_documents", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属商户标识。"); - - migrationBuilder.AlterColumn( - name: "IssuedAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "签发日期。"); - - migrationBuilder.AlterColumn( - name: "FileUrl", - table: "merchant_documents", - type: "character varying(512)", - maxLength: 512, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldComment: "证照文件链接。"); - - migrationBuilder.AlterColumn( - name: "ExpiresAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "到期日期。"); - - migrationBuilder.AlterColumn( - name: "DocumentType", - table: "merchant_documents", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "证照类型。"); - - migrationBuilder.AlterColumn( - name: "DocumentNumber", - table: "merchant_documents", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "证照编号。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "merchant_documents", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "merchant_documents", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "merchant_documents", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "merchant_documents", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "merchant_contracts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TerminationReason", - table: "merchant_contracts", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "终止原因。"); - - migrationBuilder.AlterColumn( - name: "TerminatedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "终止时间。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "merchant_contracts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "merchant_contracts", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "合同状态。"); - - migrationBuilder.AlterColumn( - name: "StartDate", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "合同开始时间。"); - - migrationBuilder.AlterColumn( - name: "SignedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "签署时间。"); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "merchant_contracts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属商户标识。"); - - migrationBuilder.AlterColumn( - name: "FileUrl", - table: "merchant_contracts", - type: "character varying(512)", - maxLength: 512, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldComment: "合同文件存储地址。"); - - migrationBuilder.AlterColumn( - name: "EndDate", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "合同结束时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "merchant_contracts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "merchant_contracts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "merchant_contracts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ContractNumber", - table: "merchant_contracts", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "合同编号。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "merchant_contracts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "member_tiers", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "member_tiers", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "member_tiers", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "member_tiers", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "排序值。"); - - migrationBuilder.AlterColumn( - name: "RequiredGrowth", - table: "member_tiers", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "所需成长值。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "member_tiers", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "等级名称。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "member_tiers", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "member_tiers", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "member_tiers", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "member_tiers", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "BenefitsJson", - table: "member_tiers", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "等级权益(JSON)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "member_tiers", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "member_profiles", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "用户标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "member_profiles", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "member_profiles", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "member_profiles", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "member_profiles", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "会员状态。"); - - migrationBuilder.AlterColumn( - name: "PointsBalance", - table: "member_profiles", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "会员积分余额。"); - - migrationBuilder.AlterColumn( - name: "Nickname", - table: "member_profiles", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "昵称。"); - - migrationBuilder.AlterColumn( - name: "Mobile", - table: "member_profiles", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "手机号。"); - - migrationBuilder.AlterColumn( - name: "MemberTierId", - table: "member_profiles", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "当前会员等级 ID。"); - - migrationBuilder.AlterColumn( - name: "JoinedAt", - table: "member_profiles", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "注册时间。"); - - migrationBuilder.AlterColumn( - name: "GrowthValue", - table: "member_profiles", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "成长值/经验值。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "member_profiles", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "member_profiles", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "member_profiles", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "member_profiles", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "BirthDate", - table: "member_profiles", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "生日。"); - - migrationBuilder.AlterColumn( - name: "AvatarUrl", - table: "member_profiles", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "头像。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "member_profiles", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "member_point_ledgers", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "member_point_ledgers", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SourceId", - table: "member_point_ledgers", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "来源 ID(订单、活动等)。"); - - migrationBuilder.AlterColumn( - name: "Reason", - table: "member_point_ledgers", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "变动原因。"); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "发生时间。"); - - migrationBuilder.AlterColumn( - name: "MemberId", - table: "member_point_ledgers", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "会员标识。"); - - migrationBuilder.AlterColumn( - name: "ExpireAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "过期时间(如适用)。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "member_point_ledgers", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "member_point_ledgers", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "member_point_ledgers", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ChangeAmount", - table: "member_point_ledgers", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "变动数量,可为负值。"); - - migrationBuilder.AlterColumn( - name: "BalanceAfterChange", - table: "member_point_ledgers", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "变动后余额。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "member_point_ledgers", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "member_growth_logs", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "member_growth_logs", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "member_growth_logs", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "member_growth_logs", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "发生时间。"); - - migrationBuilder.AlterColumn( - name: "Notes", - table: "member_growth_logs", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "备注。"); - - migrationBuilder.AlterColumn( - name: "MemberId", - table: "member_growth_logs", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "会员标识。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "member_growth_logs", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "member_growth_logs", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CurrentValue", - table: "member_growth_logs", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "当前成长值。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "member_growth_logs", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "member_growth_logs", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ChangeValue", - table: "member_growth_logs", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "变动数量。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "member_growth_logs", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "map_locations", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "map_locations", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "map_locations", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "map_locations", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "关联门店 ID,可空表示独立 POI。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "map_locations", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "名称。"); - - migrationBuilder.AlterColumn( - name: "Longitude", - table: "map_locations", - type: "double precision", - nullable: false, - oldClrType: typeof(double), - oldType: "double precision", - oldComment: "经度。"); - - migrationBuilder.AlterColumn( - name: "Latitude", - table: "map_locations", - type: "double precision", - nullable: false, - oldClrType: typeof(double), - oldType: "double precision", - oldComment: "纬度。"); - - migrationBuilder.AlterColumn( - name: "Landmark", - table: "map_locations", - type: "character varying(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true, - oldComment: "打车/导航落点描述。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "map_locations", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "map_locations", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "map_locations", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "map_locations", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Address", - table: "map_locations", - type: "character varying(256)", - maxLength: 256, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "地址。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "map_locations", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "inventory_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "inventory_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "inventory_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "inventory_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "SafetyStock", - table: "inventory_items", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "安全库存阈值。"); - - migrationBuilder.AlterColumn( - name: "QuantityReserved", - table: "inventory_items", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "已锁定库存(订单占用)。"); - - migrationBuilder.AlterColumn( - name: "QuantityOnHand", - table: "inventory_items", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "可用库存。"); - - migrationBuilder.AlterColumn( - name: "ProductSkuId", - table: "inventory_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "SKU 标识。"); - - migrationBuilder.AlterColumn( - name: "Location", - table: "inventory_items", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "储位或仓位信息。"); - - migrationBuilder.AlterColumn( - name: "ExpireDate", - table: "inventory_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "过期日期。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "inventory_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "inventory_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "inventory_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "inventory_items", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "BatchNumber", - table: "inventory_items", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "批次编号,可为空表示混批。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "inventory_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "inventory_batches", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "inventory_batches", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "inventory_batches", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "RemainingQuantity", - table: "inventory_batches", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "剩余数量。"); - - migrationBuilder.AlterColumn( - name: "Quantity", - table: "inventory_batches", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "入库数量。"); - - migrationBuilder.AlterColumn( - name: "ProductionDate", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "生产日期。"); - - migrationBuilder.AlterColumn( - name: "ProductSkuId", - table: "inventory_batches", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "SKU 标识。"); - - migrationBuilder.AlterColumn( - name: "ExpireDate", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "过期日期。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "inventory_batches", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "inventory_batches", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "inventory_batches", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "BatchNumber", - table: "inventory_batches", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "批次编号。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "inventory_batches", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "inventory_adjustments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "inventory_adjustments", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "inventory_adjustments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Reason", - table: "inventory_adjustments", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "原因说明。"); - - migrationBuilder.AlterColumn( - name: "Quantity", - table: "inventory_adjustments", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "调整数量,正数增加,负数减少。"); - - migrationBuilder.AlterColumn( - name: "OperatorId", - table: "inventory_adjustments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "操作人标识。"); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "inventory_adjustments", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "发生时间。"); - - migrationBuilder.AlterColumn( - name: "InventoryItemId", - table: "inventory_adjustments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "对应的库存记录标识。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "inventory_adjustments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "inventory_adjustments", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "inventory_adjustments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "inventory_adjustments", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AdjustmentType", - table: "inventory_adjustments", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "调整类型。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "inventory_adjustments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "group_participants", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "用户标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "group_participants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "group_participants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "group_participants", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "group_participants", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "参与状态。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "group_participants", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "对应订单标识。"); - - migrationBuilder.AlterColumn( - name: "JoinedAt", - table: "group_participants", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "参与时间。"); - - migrationBuilder.AlterColumn( - name: "GroupOrderId", - table: "group_participants", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "拼单活动标识。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "group_participants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "group_participants", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "group_participants", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "group_participants", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "group_participants", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "group_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "group_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "TargetCount", - table: "group_orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "成团需要的人数。"); - - migrationBuilder.AlterColumn( - name: "SucceededAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "成团时间。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "group_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "group_orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "拼团状态。"); - - migrationBuilder.AlterColumn( - name: "StartAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "开始时间。"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "group_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "关联商品或套餐。"); - - migrationBuilder.AlterColumn( - name: "LeaderUserId", - table: "group_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "团长用户 ID。"); - - migrationBuilder.AlterColumn( - name: "GroupPrice", - table: "group_orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "拼团价格。"); - - migrationBuilder.AlterColumn( - name: "GroupOrderNo", - table: "group_orders", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "拼单编号。"); - - migrationBuilder.AlterColumn( - name: "EndAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "结束时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "group_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CurrentCount", - table: "group_orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "当前已参与人数。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "group_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CancelledAt", - table: "group_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "取消时间。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "group_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "delivery_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "delivery_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "delivery_orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "ProviderOrderId", - table: "delivery_orders", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "第三方配送单号。"); - - migrationBuilder.AlterColumn( - name: "Provider", - table: "delivery_orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "配送服务商。"); - - migrationBuilder.AlterColumn( - name: "PickedUpAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "取餐时间。"); - - migrationBuilder.AlterColumn( - name: "FailureReason", - table: "delivery_orders", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "异常原因。"); - - migrationBuilder.AlterColumn( - name: "DispatchedAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "下发时间。"); - - migrationBuilder.AlterColumn( - name: "DeliveryFee", - table: "delivery_orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldNullable: true, - oldComment: "配送费。"); - - migrationBuilder.AlterColumn( - name: "DeliveredAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "完成时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "delivery_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "delivery_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "delivery_orders", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CourierPhone", - table: "delivery_orders", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "骑手电话。"); - - migrationBuilder.AlterColumn( - name: "CourierName", - table: "delivery_orders", - type: "character varying(64)", - maxLength: 64, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldNullable: true, - oldComment: "骑手姓名。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "delivery_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "delivery_events", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "delivery_events", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "delivery_events", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Payload", - table: "delivery_events", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "原始数据 JSON。"); - - migrationBuilder.AlterColumn( - name: "OccurredAt", - table: "delivery_events", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "发生时间。"); - - migrationBuilder.AlterColumn( - name: "Message", - table: "delivery_events", - type: "character varying(256)", - maxLength: 256, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "事件描述。"); - - migrationBuilder.AlterColumn( - name: "EventType", - table: "delivery_events", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "事件类型。"); - - migrationBuilder.AlterColumn( - name: "DeliveryOrderId", - table: "delivery_events", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "配送单标识。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "delivery_events", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "delivery_events", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "delivery_events", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "delivery_events", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "delivery_events", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "coupons", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "归属用户。"); - - migrationBuilder.AlterColumn( - name: "UsedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "使用时间。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "coupons", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "coupons", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "coupons", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "coupons", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "订单 ID(已使用时记录)。"); - - migrationBuilder.AlterColumn( - name: "IssuedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "发放时间。"); - - migrationBuilder.AlterColumn( - name: "ExpireAt", - table: "coupons", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "到期时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "coupons", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "coupons", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "coupons", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CouponTemplateId", - table: "coupons", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "模板标识。"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "coupons", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "券码或序列号。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "coupons", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "Value", - table: "coupon_templates", - type: "numeric", - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric", - oldComment: "面值或折扣额度。"); - - migrationBuilder.AlterColumn( - name: "ValidTo", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "可用结束时间。"); - - migrationBuilder.AlterColumn( - name: "ValidFrom", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "可用开始时间。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "coupon_templates", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TotalQuantity", - table: "coupon_templates", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "总发放数量上限。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "coupon_templates", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreScopeJson", - table: "coupon_templates", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "适用门店 ID 集合(JSON)。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "coupon_templates", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "RelativeValidDays", - table: "coupon_templates", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true, - oldComment: "有效天数(相对发放时间)。"); - - migrationBuilder.AlterColumn( - name: "ProductScopeJson", - table: "coupon_templates", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "适用品类或商品范围(JSON)。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "coupon_templates", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "模板名称。"); - - migrationBuilder.AlterColumn( - name: "MinimumSpend", - table: "coupon_templates", - type: "numeric", - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true, - oldComment: "最低消费门槛。"); - - migrationBuilder.AlterColumn( - name: "DiscountCap", - table: "coupon_templates", - type: "numeric", - nullable: true, - oldClrType: typeof(decimal), - oldType: "numeric", - oldNullable: true, - oldComment: "折扣上限(针对折扣券)。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "coupon_templates", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "备注。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "coupon_templates", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "coupon_templates", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "coupon_templates", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CouponType", - table: "coupon_templates", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "券类型。"); - - migrationBuilder.AlterColumn( - name: "ClaimedQuantity", - table: "coupon_templates", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "已领取数量。"); - - migrationBuilder.AlterColumn( - name: "ChannelsJson", - table: "coupon_templates", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "发放渠道(JSON)。"); - - migrationBuilder.AlterColumn( - name: "AllowStack", - table: "coupon_templates", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否允许叠加其他优惠。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "coupon_templates", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "community_reactions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "用户 ID。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "community_reactions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "community_reactions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "community_reactions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "ReactionType", - table: "community_reactions", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "反应类型。"); - - migrationBuilder.AlterColumn( - name: "ReactedAt", - table: "community_reactions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "时间戳。"); - - migrationBuilder.AlterColumn( - name: "PostId", - table: "community_reactions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "动态 ID。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "community_reactions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "community_reactions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "community_reactions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "community_reactions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "community_reactions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "community_posts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "community_posts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "Title", - table: "community_posts", - type: "character varying(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true, - oldComment: "标题。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "community_posts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "community_posts", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "MediaJson", - table: "community_posts", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "媒体资源 JSON。"); - - migrationBuilder.AlterColumn( - name: "LikeCount", - table: "community_posts", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "点赞数。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "community_posts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "community_posts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "community_posts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "community_posts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Content", - table: "community_posts", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "内容。"); - - migrationBuilder.AlterColumn( - name: "CommentCount", - table: "community_posts", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "评论数。"); - - migrationBuilder.AlterColumn( - name: "AuthorUserId", - table: "community_posts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "作者用户 ID。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "community_posts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "community_comments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "community_comments", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "community_comments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "PostId", - table: "community_comments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "动态标识。"); - - migrationBuilder.AlterColumn( - name: "ParentId", - table: "community_comments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "父级评论 ID。"); - - migrationBuilder.AlterColumn( - name: "IsDeleted", - table: "community_comments", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "community_comments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "community_comments", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "community_comments", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "community_comments", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Content", - table: "community_comments", - type: "character varying(512)", - maxLength: 512, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldComment: "评论内容。"); - - migrationBuilder.AlterColumn( - name: "AuthorUserId", - table: "community_comments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "评论人。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "community_comments", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "ValidationResultJson", - table: "checkout_sessions", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "校验结果明细 JSON。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "checkout_sessions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "用户标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "checkout_sessions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "checkout_sessions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "checkout_sessions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "checkout_sessions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "门店标识。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "checkout_sessions", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "会话状态。"); - - migrationBuilder.AlterColumn( - name: "SessionToken", - table: "checkout_sessions", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "会话 Token。"); - - migrationBuilder.AlterColumn( - name: "ExpiresAt", - table: "checkout_sessions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "过期时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "checkout_sessions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "checkout_sessions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "checkout_sessions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "checkout_sessions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "checkout_sessions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "checkin_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "用户标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "checkin_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "checkin_records", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "checkin_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "RewardJson", - table: "checkin_records", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "获得奖励 JSON。"); - - migrationBuilder.AlterColumn( - name: "IsMakeup", - table: "checkin_records", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否补签。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "checkin_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "checkin_records", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "checkin_records", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "checkin_records", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CheckInDate", - table: "checkin_records", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "签到日期(本地)。"); - - migrationBuilder.AlterColumn( - name: "CheckInCampaignId", - table: "checkin_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "活动标识。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "checkin_records", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "checkin_campaigns", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "checkin_campaigns", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "checkin_campaigns", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "StartDate", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "开始日期。"); - - migrationBuilder.AlterColumn( - name: "RewardsJson", - table: "checkin_campaigns", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "连签奖励 JSON。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "checkin_campaigns", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "活动名称。"); - - migrationBuilder.AlterColumn( - name: "EndDate", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "结束日期。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "checkin_campaigns", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "活动描述。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "checkin_campaigns", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "checkin_campaigns", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "checkin_campaigns", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AllowMakeupCount", - table: "checkin_campaigns", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "支持补签次数。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "checkin_campaigns", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "chat_sessions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "chat_sessions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "StoreId", - table: "chat_sessions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "所属门店(可空为平台)。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "chat_sessions", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "会话状态。"); - - migrationBuilder.AlterColumn( - name: "StartedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "开始时间。"); - - migrationBuilder.AlterColumn( - name: "SessionCode", - table: "chat_sessions", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "会话编号。"); - - migrationBuilder.AlterColumn( - name: "IsBotActive", - table: "chat_sessions", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否机器人接待中。"); - - migrationBuilder.AlterColumn( - name: "EndedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "结束时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "chat_sessions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CustomerUserId", - table: "chat_sessions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "顾客用户 ID。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "chat_sessions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "chat_sessions", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AgentUserId", - table: "chat_sessions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "当前客服员工 ID。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "chat_sessions", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "chat_messages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "chat_messages", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "chat_messages", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SenderUserId", - table: "chat_messages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "发送方用户 ID。"); - - migrationBuilder.AlterColumn( - name: "SenderType", - table: "chat_messages", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "发送方类型。"); - - migrationBuilder.AlterColumn( - name: "ReadAt", - table: "chat_messages", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "读取时间。"); - - migrationBuilder.AlterColumn( - name: "IsRead", - table: "chat_messages", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否已读。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "chat_messages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "chat_messages", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "chat_messages", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "chat_messages", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "ContentType", - table: "chat_messages", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "消息类型(文字/图片/语音等)。"); - - migrationBuilder.AlterColumn( - name: "Content", - table: "chat_messages", - type: "character varying(1024)", - maxLength: 1024, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024, - oldComment: "消息内容。"); - - migrationBuilder.AlterColumn( - name: "ChatSessionId", - table: "chat_messages", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "会话标识。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "chat_messages", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "cart_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "cart_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "UnitPrice", - table: "cart_items", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "单价快照。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "cart_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "cart_items", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "ShoppingCartId", - table: "cart_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属购物车标识。"); - - migrationBuilder.AlterColumn( - name: "Remark", - table: "cart_items", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "自定义备注(口味要求)。"); - - migrationBuilder.AlterColumn( - name: "Quantity", - table: "cart_items", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "数量。"); - - migrationBuilder.AlterColumn( - name: "ProductSkuId", - table: "cart_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "SKU 标识。"); - - migrationBuilder.AlterColumn( - name: "ProductName", - table: "cart_items", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "商品名称快照。"); - - migrationBuilder.AlterColumn( - name: "ProductId", - table: "cart_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "商品或 SKU 标识。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "cart_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "cart_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "cart_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "cart_items", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "AttributesJson", - table: "cart_items", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true, - oldComment: "扩展 JSON(规格、加料选项等)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "cart_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "cart_item_addons", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "cart_item_addons", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "cart_item_addons", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "OptionId", - table: "cart_item_addons", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "选项 ID(可对应 ProductAddonOption)。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "cart_item_addons", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "选项名称。"); - - migrationBuilder.AlterColumn( - name: "ExtraPrice", - table: "cart_item_addons", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "附加价格。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "cart_item_addons", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "cart_item_addons", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "cart_item_addons", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "cart_item_addons", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CartItemId", - table: "cart_item_addons", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属购物车条目。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "cart_item_addons", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "affiliate_payouts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "affiliate_payouts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "affiliate_payouts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "affiliate_payouts", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "状态。"); - - migrationBuilder.AlterColumn( - name: "Remarks", - table: "affiliate_payouts", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "备注。"); - - migrationBuilder.AlterColumn( - name: "Period", - table: "affiliate_payouts", - type: "character varying(32)", - maxLength: 32, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "结算周期描述。"); - - migrationBuilder.AlterColumn( - name: "PaidAt", - table: "affiliate_payouts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "打款时间。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "affiliate_payouts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "affiliate_payouts", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "affiliate_payouts", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "affiliate_payouts", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Amount", - table: "affiliate_payouts", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "结算金额。"); - - migrationBuilder.AlterColumn( - name: "AffiliatePartnerId", - table: "affiliate_payouts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "合作伙伴标识。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "affiliate_payouts", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "affiliate_partners", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "用户 ID(如绑定平台账号)。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "affiliate_partners", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "affiliate_partners", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "affiliate_partners", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "affiliate_partners", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "当前状态。"); - - migrationBuilder.AlterColumn( - name: "Remarks", - table: "affiliate_partners", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "审核备注。"); - - migrationBuilder.AlterColumn( - name: "Phone", - table: "affiliate_partners", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true, - oldComment: "联系电话。"); - - migrationBuilder.AlterColumn( - name: "DisplayName", - table: "affiliate_partners", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "昵称或渠道名称。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "affiliate_partners", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "affiliate_partners", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "affiliate_partners", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "affiliate_partners", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "CommissionRate", - table: "affiliate_partners", - type: "numeric", - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric", - oldComment: "分成比例(0-1)。"); - - migrationBuilder.AlterColumn( - name: "ChannelType", - table: "affiliate_partners", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "渠道类型。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "affiliate_partners", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "affiliate_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "affiliate_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "affiliate_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "affiliate_orders", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "当前状态。"); - - migrationBuilder.AlterColumn( - name: "SettledAt", - table: "affiliate_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "结算完成时间。"); - - migrationBuilder.AlterColumn( - name: "OrderId", - table: "affiliate_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "关联订单。"); - - migrationBuilder.AlterColumn( - name: "OrderAmount", - table: "affiliate_orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "订单金额。"); - - migrationBuilder.AlterColumn( - name: "EstimatedCommission", - table: "affiliate_orders", - type: "numeric(18,2)", - precision: 18, - scale: 2, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,2)", - oldPrecision: 18, - oldScale: 2, - oldComment: "预计佣金。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "affiliate_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "affiliate_orders", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "affiliate_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "affiliate_orders", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "BuyerUserId", - table: "affiliate_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "用户 ID。"); - - migrationBuilder.AlterColumn( - name: "AffiliatePartnerId", - table: "affiliate_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "推广人标识。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "affiliate_orders", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/AppSeedOptions.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/AppSeedOptions.cs new file mode 100644 index 0000000..d5992f7 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/AppSeedOptions.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace TakeoutSaaS.Infrastructure.App.Options; + +/// +/// 业务数据种子配置。 +/// +public sealed class AppSeedOptions +{ + /// + /// 配置节名称。 + /// + public const string SectionName = "App:Seed"; + + /// + /// 是否启用业务数据种子。 + /// + public bool Enabled { get; set; } + + /// + /// 默认租户配置。 + /// + public TenantSeedOptions? DefaultTenant { get; set; } + + /// + /// 基础字典分组。 + /// + public List DictionaryGroups { get; set; } = new(); +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/DictionarySeedGroupOptions.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/DictionarySeedGroupOptions.cs new file mode 100644 index 0000000..2cec142 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/DictionarySeedGroupOptions.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using TakeoutSaaS.Domain.Dictionary.Enums; + +namespace TakeoutSaaS.Infrastructure.App.Options; + +/// +/// 字典分组种子配置。 +/// +public sealed class DictionarySeedGroupOptions +{ + /// + /// 所属租户,不填则使用默认租户或系统租户。 + /// + public long? TenantId { get; set; } + + /// + /// 分组编码。 + /// + [Required] + [MaxLength(64)] + public string Code { get; set; } = string.Empty; + + /// + /// 分组名称。 + /// + [Required] + [MaxLength(128)] + public string Name { get; set; } = string.Empty; + + /// + /// 分组作用域。 + /// + public DictionaryScope Scope { get; set; } = DictionaryScope.Business; + + /// + /// 描述信息。 + /// + [MaxLength(512)] + public string? Description { get; set; } + + /// + /// 是否启用。 + /// + public bool IsEnabled { get; set; } = true; + + /// + /// 字典项集合。 + /// + public List Items { get; set; } = new(); +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/DictionarySeedItemOptions.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/DictionarySeedItemOptions.cs new file mode 100644 index 0000000..6d3ea0b --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/DictionarySeedItemOptions.cs @@ -0,0 +1,39 @@ +using System.ComponentModel.DataAnnotations; + +namespace TakeoutSaaS.Infrastructure.App.Options; + +/// +/// 字典项种子配置。 +/// +public sealed class DictionarySeedItemOptions +{ + /// + /// 字典项键。 + /// + [Required] + [MaxLength(64)] + public string Key { get; set; } = string.Empty; + + /// + /// 字典项值。 + /// + [Required] + [MaxLength(256)] + public string Value { get; set; } = string.Empty; + + /// + /// 描述。 + /// + [MaxLength(512)] + public string? Description { get; set; } + + /// + /// 排序。 + /// + public int SortOrder { get; set; } = 100; + + /// + /// 是否启用。 + /// + public bool IsEnabled { get; set; } = true; +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/TenantSeedOptions.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/TenantSeedOptions.cs new file mode 100644 index 0000000..044e4e6 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Options/TenantSeedOptions.cs @@ -0,0 +1,46 @@ +using System.ComponentModel.DataAnnotations; + +namespace TakeoutSaaS.Infrastructure.App.Options; + +/// +/// 默认租户种子配置。 +/// +public sealed class TenantSeedOptions +{ + /// + /// 自定义租户标识,不填则自动生成。 + /// + public long TenantId { get; set; } + + /// + /// 租户编码。 + /// + [Required] + [MaxLength(64)] + public string Code { get; set; } = string.Empty; + + /// + /// 租户名称。 + /// + [Required] + [MaxLength(128)] + public string Name { get; set; } = string.Empty; + + /// + /// 租户简称。 + /// + [MaxLength(128)] + public string? ShortName { get; set; } + + /// + /// 联系人姓名。 + /// + [MaxLength(64)] + public string? ContactName { get; set; } + + /// + /// 联系电话。 + /// + [MaxLength(32)] + public string? ContactPhone { get; set; } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/AppDataSeeder.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/AppDataSeeder.cs new file mode 100644 index 0000000..eede6a4 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/AppDataSeeder.cs @@ -0,0 +1,301 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using TakeoutSaaS.Domain.Dictionary.Entities; +using TakeoutSaaS.Domain.Tenants.Entities; +using TakeoutSaaS.Domain.Tenants.Enums; +using TakeoutSaaS.Infrastructure.App.Options; +using TakeoutSaaS.Infrastructure.Dictionary.Persistence; + +namespace TakeoutSaaS.Infrastructure.App.Persistence; + +/// +/// 业务数据种子,确保默认租户与基础字典可重复执行。 +/// +public sealed class AppDataSeeder : IHostedService +{ + private readonly IServiceProvider _serviceProvider; + private readonly ILogger _logger; + private readonly AppSeedOptions _options; + + /// + /// 初始化种子服务。 + /// + public AppDataSeeder( + IServiceProvider serviceProvider, + ILogger logger, + IOptions options) + { + _serviceProvider = serviceProvider; + _logger = logger; + _options = options.Value; + } + + /// + public async Task StartAsync(CancellationToken cancellationToken) + { + if (!_options.Enabled) + { + _logger.LogInformation("AppSeed 未启用,跳过业务数据初始化"); + return; + } + + using var scope = _serviceProvider.CreateScope(); + var appDbContext = scope.ServiceProvider.GetRequiredService(); + var dictionaryDbContext = scope.ServiceProvider.GetRequiredService(); + + var defaultTenantId = await EnsureDefaultTenantAsync(appDbContext, cancellationToken); + await EnsureDictionarySeedsAsync(dictionaryDbContext, defaultTenantId, cancellationToken); + + _logger.LogInformation("AppSeed 完成业务数据初始化"); + } + + /// + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + + /// + /// 确保默认租户存在。 + /// + private async Task EnsureDefaultTenantAsync(TakeoutAppDbContext dbContext, CancellationToken cancellationToken) + { + var tenantOptions = _options.DefaultTenant; + if (tenantOptions == null || string.IsNullOrWhiteSpace(tenantOptions.Code) || string.IsNullOrWhiteSpace(tenantOptions.Name)) + { + _logger.LogInformation("AppSeed 未配置默认租户,跳过租户种子"); + return null; + } + + var code = tenantOptions.Code.Trim(); + var existingTenant = await dbContext.Tenants + .IgnoreQueryFilters() + .FirstOrDefaultAsync(x => x.Code == code, cancellationToken); + + if (existingTenant == null) + { + var tenant = new Tenant + { + Id = tenantOptions.TenantId, + Code = code, + Name = tenantOptions.Name.Trim(), + ShortName = tenantOptions.ShortName?.Trim(), + ContactName = tenantOptions.ContactName?.Trim(), + ContactPhone = tenantOptions.ContactPhone?.Trim(), + Status = TenantStatus.Active + }; + + await dbContext.Tenants.AddAsync(tenant, cancellationToken); + await dbContext.SaveChangesAsync(cancellationToken); + _logger.LogInformation("AppSeed 已创建默认租户 {TenantCode}", code); + return tenant.Id; + } + + var updated = false; + + if (!string.Equals(existingTenant.Name, tenantOptions.Name, StringComparison.Ordinal)) + { + existingTenant.Name = tenantOptions.Name.Trim(); + updated = true; + } + + if (!string.Equals(existingTenant.ShortName, tenantOptions.ShortName, StringComparison.Ordinal)) + { + existingTenant.ShortName = tenantOptions.ShortName?.Trim(); + updated = true; + } + + if (!string.Equals(existingTenant.ContactName, tenantOptions.ContactName, StringComparison.Ordinal)) + { + existingTenant.ContactName = tenantOptions.ContactName?.Trim(); + updated = true; + } + + if (!string.Equals(existingTenant.ContactPhone, tenantOptions.ContactPhone, StringComparison.Ordinal)) + { + existingTenant.ContactPhone = tenantOptions.ContactPhone?.Trim(); + updated = true; + } + + if (existingTenant.Status != TenantStatus.Active) + { + existingTenant.Status = TenantStatus.Active; + updated = true; + } + + if (updated) + { + dbContext.Tenants.Update(existingTenant); + await dbContext.SaveChangesAsync(cancellationToken); + _logger.LogInformation("AppSeed 已更新默认租户 {TenantCode}", code); + } + else + { + _logger.LogInformation("AppSeed 默认租户 {TenantCode} 已存在且无需更新", code); + } + + return existingTenant.Id; + } + + /// + /// 确保基础字典存在。 + /// + private async Task EnsureDictionarySeedsAsync(DictionaryDbContext dbContext, long? defaultTenantId, CancellationToken cancellationToken) + { + if (_options.DictionaryGroups == null || _options.DictionaryGroups.Count == 0) + { + _logger.LogInformation("AppSeed 未配置基础字典,跳过字典种子"); + return; + } + + foreach (var groupOptions in _options.DictionaryGroups) + { + if (string.IsNullOrWhiteSpace(groupOptions.Code) || string.IsNullOrWhiteSpace(groupOptions.Name)) + { + _logger.LogWarning("AppSeed 跳过字典分组,Code 或 Name 为空"); + continue; + } + + var tenantId = groupOptions.TenantId ?? defaultTenantId ?? 0; + var code = groupOptions.Code.Trim(); + + var group = await dbContext.DictionaryGroups + .IgnoreQueryFilters() + .FirstOrDefaultAsync(x => x.TenantId == tenantId && x.Code == code, cancellationToken); + + if (group == null) + { + group = new DictionaryGroup + { + Id = 0, + TenantId = tenantId, + Code = code, + Name = groupOptions.Name.Trim(), + Scope = groupOptions.Scope, + Description = groupOptions.Description?.Trim(), + IsEnabled = groupOptions.IsEnabled + }; + + await dbContext.DictionaryGroups.AddAsync(group, cancellationToken); + _logger.LogInformation("AppSeed 创建字典分组 {GroupCode} (Tenant: {TenantId})", code, tenantId); + } + else + { + var groupUpdated = false; + + if (!string.Equals(group.Name, groupOptions.Name, StringComparison.Ordinal)) + { + group.Name = groupOptions.Name.Trim(); + groupUpdated = true; + } + + if (!string.Equals(group.Description, groupOptions.Description, StringComparison.Ordinal)) + { + group.Description = groupOptions.Description?.Trim(); + groupUpdated = true; + } + + if (group.Scope != groupOptions.Scope) + { + group.Scope = groupOptions.Scope; + groupUpdated = true; + } + + if (group.IsEnabled != groupOptions.IsEnabled) + { + group.IsEnabled = groupOptions.IsEnabled; + groupUpdated = true; + } + + if (groupUpdated) + { + dbContext.DictionaryGroups.Update(group); + } + } + + await UpsertDictionaryItemsAsync(dbContext, group, groupOptions.Items, tenantId, cancellationToken); + } + + await dbContext.SaveChangesAsync(cancellationToken); + } + + /// + /// 合并字典项。 + /// + private static async Task UpsertDictionaryItemsAsync( + DictionaryDbContext dbContext, + DictionaryGroup group, + IEnumerable seedItems, + long tenantId, + CancellationToken cancellationToken) + { + var materializedItems = seedItems + .Where(item => !string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value)) + .ToList(); + + if (materializedItems.Count == 0) + { + return; + } + + var existingItems = await dbContext.DictionaryItems + .IgnoreQueryFilters() + .Where(x => x.GroupId == group.Id) + .ToListAsync(cancellationToken); + + foreach (var seed in materializedItems) + { + var key = seed.Key.Trim(); + var existing = existingItems.FirstOrDefault(x => x.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); + + if (existing == null) + { + var newItem = new DictionaryItem + { + Id = 0, + TenantId = tenantId, + GroupId = group.Id, + Key = key, + Value = seed.Value.Trim(), + Description = seed.Description?.Trim(), + SortOrder = seed.SortOrder, + IsEnabled = seed.IsEnabled + }; + + await dbContext.DictionaryItems.AddAsync(newItem, cancellationToken); + continue; + } + + var updated = false; + + if (!string.Equals(existing.Value, seed.Value, StringComparison.Ordinal)) + { + existing.Value = seed.Value.Trim(); + updated = true; + } + + if (!string.Equals(existing.Description, seed.Description, StringComparison.Ordinal)) + { + existing.Description = seed.Description?.Trim(); + updated = true; + } + + if (existing.SortOrder != seed.SortOrder) + { + existing.SortOrder = seed.SortOrder; + updated = true; + } + + if (existing.IsEnabled != seed.IsEnabled) + { + existing.IsEnabled = seed.IsEnabled; + updated = true; + } + + if (updated) + { + dbContext.DictionaryItems.Update(existing); + } + } + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/TakeoutAppDbContext.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/TakeoutAppDbContext.cs index 53474ea..14d4ff7 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/TakeoutAppDbContext.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/TakeoutAppDbContext.cs @@ -20,6 +20,7 @@ using TakeoutSaaS.Domain.Reservations.Entities; using TakeoutSaaS.Domain.Stores.Entities; using TakeoutSaaS.Domain.Tenants.Entities; using TakeoutSaaS.Infrastructure.Common.Persistence; +using TakeoutSaaS.Shared.Abstractions.Ids; using TakeoutSaaS.Shared.Abstractions.Security; using TakeoutSaaS.Shared.Abstractions.Tenancy; @@ -31,8 +32,9 @@ namespace TakeoutSaaS.Infrastructure.App.Persistence; public sealed class TakeoutAppDbContext( DbContextOptions options, ITenantProvider tenantProvider, - ICurrentUserAccessor? currentUserAccessor = null) - : TenantAwareDbContext(options, tenantProvider, currentUserAccessor) + ICurrentUserAccessor? currentUserAccessor = null, + IIdGenerator? idGenerator = null) + : TenantAwareDbContext(options, tenantProvider, currentUserAccessor, idGenerator) { public DbSet Tenants => Set(); public DbSet TenantPackages => Set(); diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfDeliveryRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfDeliveryRepository.cs new file mode 100644 index 0000000..45db052 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfDeliveryRepository.cs @@ -0,0 +1,71 @@ +using System.Linq; +using Microsoft.EntityFrameworkCore; +using TakeoutSaaS.Domain.Deliveries.Entities; +using TakeoutSaaS.Domain.Deliveries.Repositories; +using TakeoutSaaS.Infrastructure.App.Persistence; + +namespace TakeoutSaaS.Infrastructure.App.Repositories; + +/// +/// 配送聚合的 EF Core 仓储实现。 +/// +public sealed class EfDeliveryRepository : IDeliveryRepository +{ + private readonly TakeoutAppDbContext _context; + + /// + /// 初始化仓储。 + /// + public EfDeliveryRepository(TakeoutAppDbContext context) + { + _context = context; + } + + /// + public Task FindByIdAsync(long deliveryOrderId, long tenantId, CancellationToken cancellationToken = default) + { + return _context.DeliveryOrders + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.Id == deliveryOrderId) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public Task FindByOrderIdAsync(long orderId, long tenantId, CancellationToken cancellationToken = default) + { + return _context.DeliveryOrders + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.OrderId == orderId) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public async Task> GetEventsAsync(long deliveryOrderId, long tenantId, CancellationToken cancellationToken = default) + { + var events = await _context.DeliveryEvents + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.DeliveryOrderId == deliveryOrderId) + .OrderBy(x => x.CreatedAt) + .ToListAsync(cancellationToken); + + return events; + } + + /// + public Task AddDeliveryOrderAsync(DeliveryOrder deliveryOrder, CancellationToken cancellationToken = default) + { + return _context.DeliveryOrders.AddAsync(deliveryOrder, cancellationToken).AsTask(); + } + + /// + public Task AddEventAsync(DeliveryEvent deliveryEvent, CancellationToken cancellationToken = default) + { + return _context.DeliveryEvents.AddAsync(deliveryEvent, cancellationToken).AsTask(); + } + + /// + public Task SaveChangesAsync(CancellationToken cancellationToken = default) + { + return _context.SaveChangesAsync(cancellationToken); + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfMerchantRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfMerchantRepository.cs new file mode 100644 index 0000000..a17b212 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfMerchantRepository.cs @@ -0,0 +1,116 @@ +using System.Linq; +using Microsoft.EntityFrameworkCore; +using TakeoutSaaS.Domain.Merchants.Entities; +using TakeoutSaaS.Domain.Merchants.Enums; +using TakeoutSaaS.Domain.Merchants.Repositories; +using TakeoutSaaS.Infrastructure.App.Persistence; + +namespace TakeoutSaaS.Infrastructure.App.Repositories; + +/// +/// 商户聚合的 EF Core 仓储实现。 +/// +public sealed class EfMerchantRepository : IMerchantRepository +{ + private readonly TakeoutAppDbContext _context; + + /// + /// 初始化仓储。 + /// + public EfMerchantRepository(TakeoutAppDbContext context) + { + _context = context; + } + + /// + public Task FindByIdAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default) + { + return _context.Merchants + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.Id == merchantId) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public async Task> SearchAsync(long tenantId, MerchantStatus? status, CancellationToken cancellationToken = default) + { + var query = _context.Merchants + .AsNoTracking() + .Where(x => x.TenantId == tenantId); + + if (status.HasValue) + { + query = query.Where(x => x.Status == status.Value); + } + + return await query + .OrderByDescending(x => x.CreatedAt) + .ToListAsync(cancellationToken); + } + + /// + public async Task> GetStaffAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default) + { + var staffs = await _context.MerchantStaff + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.MerchantId == merchantId) + .OrderBy(x => x.Name) + .ToListAsync(cancellationToken); + + return staffs; + } + + /// + public async Task> GetContractsAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default) + { + var contracts = await _context.MerchantContracts + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.MerchantId == merchantId) + .OrderByDescending(x => x.CreatedAt) + .ToListAsync(cancellationToken); + + return contracts; + } + + /// + public async Task> GetDocumentsAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default) + { + var documents = await _context.MerchantDocuments + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.MerchantId == merchantId) + .OrderBy(x => x.CreatedAt) + .ToListAsync(cancellationToken); + + return documents; + } + + /// + public Task AddMerchantAsync(Merchant merchant, CancellationToken cancellationToken = default) + { + return _context.Merchants.AddAsync(merchant, cancellationToken).AsTask(); + } + + /// + public Task AddStaffAsync(MerchantStaff staff, CancellationToken cancellationToken = default) + { + return _context.MerchantStaff.AddAsync(staff, cancellationToken).AsTask(); + } + + /// + public Task AddContractAsync(MerchantContract contract, CancellationToken cancellationToken = default) + { + return _context.MerchantContracts.AddAsync(contract, cancellationToken).AsTask(); + } + + /// + public Task AddDocumentAsync(MerchantDocument document, CancellationToken cancellationToken = default) + { + return _context.MerchantDocuments.AddAsync(document, cancellationToken).AsTask(); + } + + /// + public Task SaveChangesAsync(CancellationToken cancellationToken = default) + { + return _context.SaveChangesAsync(cancellationToken); + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfOrderRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfOrderRepository.cs new file mode 100644 index 0000000..9517ef9 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfOrderRepository.cs @@ -0,0 +1,133 @@ +using System.Linq; +using Microsoft.EntityFrameworkCore; +using TakeoutSaaS.Domain.Orders.Entities; +using TakeoutSaaS.Domain.Orders.Enums; +using TakeoutSaaS.Domain.Orders.Repositories; +using TakeoutSaaS.Domain.Payments.Enums; +using TakeoutSaaS.Infrastructure.App.Persistence; + +namespace TakeoutSaaS.Infrastructure.App.Repositories; + +/// +/// 订单聚合的 EF Core 仓储实现。 +/// +public sealed class EfOrderRepository : IOrderRepository +{ + private readonly TakeoutAppDbContext _context; + + /// + /// 初始化仓储。 + /// + public EfOrderRepository(TakeoutAppDbContext context) + { + _context = context; + } + + /// + public Task FindByIdAsync(long orderId, long tenantId, CancellationToken cancellationToken = default) + { + return _context.Orders + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.Id == orderId) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public Task FindByOrderNoAsync(string orderNo, long tenantId, CancellationToken cancellationToken = default) + { + return _context.Orders + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.OrderNo == orderNo) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public async Task> SearchAsync(long tenantId, OrderStatus? status, PaymentStatus? paymentStatus, CancellationToken cancellationToken = default) + { + var query = _context.Orders + .AsNoTracking() + .Where(x => x.TenantId == tenantId); + + if (status.HasValue) + { + query = query.Where(x => x.Status == status.Value); + } + + if (paymentStatus.HasValue) + { + query = query.Where(x => x.PaymentStatus == paymentStatus.Value); + } + + var orders = await query + .OrderByDescending(x => x.CreatedAt) + .ToListAsync(cancellationToken); + + return orders; + } + + /// + public async Task> GetItemsAsync(long orderId, long tenantId, CancellationToken cancellationToken = default) + { + var items = await _context.OrderItems + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.OrderId == orderId) + .OrderBy(x => x.Id) + .ToListAsync(cancellationToken); + + return items; + } + + /// + public async Task> GetStatusHistoryAsync(long orderId, long tenantId, CancellationToken cancellationToken = default) + { + var histories = await _context.OrderStatusHistories + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.OrderId == orderId) + .OrderBy(x => x.CreatedAt) + .ToListAsync(cancellationToken); + + return histories; + } + + /// + public async Task> GetRefundsAsync(long orderId, long tenantId, CancellationToken cancellationToken = default) + { + var refunds = await _context.RefundRequests + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.OrderId == orderId) + .OrderByDescending(x => x.CreatedAt) + .ToListAsync(cancellationToken); + + return refunds; + } + + /// + public Task AddOrderAsync(Order order, CancellationToken cancellationToken = default) + { + return _context.Orders.AddAsync(order, cancellationToken).AsTask(); + } + + /// + public Task AddItemsAsync(IEnumerable items, CancellationToken cancellationToken = default) + { + return _context.OrderItems.AddRangeAsync(items, cancellationToken); + } + + /// + public Task AddStatusHistoryAsync(OrderStatusHistory history, CancellationToken cancellationToken = default) + { + return _context.OrderStatusHistories.AddAsync(history, cancellationToken).AsTask(); + } + + /// + public Task AddRefundAsync(RefundRequest refund, CancellationToken cancellationToken = default) + { + return _context.RefundRequests.AddAsync(refund, cancellationToken).AsTask(); + } + + /// + public Task SaveChangesAsync(CancellationToken cancellationToken = default) + { + return _context.SaveChangesAsync(cancellationToken); + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfPaymentRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfPaymentRepository.cs new file mode 100644 index 0000000..af5034d --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfPaymentRepository.cs @@ -0,0 +1,71 @@ +using System.Linq; +using Microsoft.EntityFrameworkCore; +using TakeoutSaaS.Domain.Payments.Entities; +using TakeoutSaaS.Domain.Payments.Repositories; +using TakeoutSaaS.Infrastructure.App.Persistence; + +namespace TakeoutSaaS.Infrastructure.App.Repositories; + +/// +/// 支付记录的 EF Core 仓储实现。 +/// +public sealed class EfPaymentRepository : IPaymentRepository +{ + private readonly TakeoutAppDbContext _context; + + /// + /// 初始化仓储。 + /// + public EfPaymentRepository(TakeoutAppDbContext context) + { + _context = context; + } + + /// + public Task FindByIdAsync(long paymentId, long tenantId, CancellationToken cancellationToken = default) + { + return _context.PaymentRecords + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.Id == paymentId) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public Task FindByOrderIdAsync(long orderId, long tenantId, CancellationToken cancellationToken = default) + { + return _context.PaymentRecords + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.OrderId == orderId) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public async Task> GetRefundsAsync(long paymentId, long tenantId, CancellationToken cancellationToken = default) + { + var refunds = await _context.PaymentRefundRecords + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.PaymentRecordId == paymentId) + .OrderByDescending(x => x.CreatedAt) + .ToListAsync(cancellationToken); + + return refunds; + } + + /// + public Task AddPaymentAsync(PaymentRecord payment, CancellationToken cancellationToken = default) + { + return _context.PaymentRecords.AddAsync(payment, cancellationToken).AsTask(); + } + + /// + public Task AddRefundAsync(PaymentRefundRecord refund, CancellationToken cancellationToken = default) + { + return _context.PaymentRefundRecords.AddAsync(refund, cancellationToken).AsTask(); + } + + /// + public Task SaveChangesAsync(CancellationToken cancellationToken = default) + { + return _context.SaveChangesAsync(cancellationToken); + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfProductRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfProductRepository.cs new file mode 100644 index 0000000..fde29fe --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfProductRepository.cs @@ -0,0 +1,227 @@ +using System.Linq; +using Microsoft.EntityFrameworkCore; +using TakeoutSaaS.Domain.Products.Entities; +using TakeoutSaaS.Domain.Products.Enums; +using TakeoutSaaS.Domain.Products.Repositories; +using TakeoutSaaS.Infrastructure.App.Persistence; + +namespace TakeoutSaaS.Infrastructure.App.Repositories; + +/// +/// 商品聚合的 EF Core 仓储实现。 +/// +public sealed class EfProductRepository : IProductRepository +{ + private readonly TakeoutAppDbContext _context; + + /// + /// 初始化仓储。 + /// + public EfProductRepository(TakeoutAppDbContext context) + { + _context = context; + } + + /// + public Task FindByIdAsync(long productId, long tenantId, CancellationToken cancellationToken = default) + { + return _context.Products + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.Id == productId) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public async Task> SearchAsync(long tenantId, long? categoryId, ProductStatus? status, CancellationToken cancellationToken = default) + { + var query = _context.Products + .AsNoTracking() + .Where(x => x.TenantId == tenantId); + + if (categoryId.HasValue) + { + query = query.Where(x => x.CategoryId == categoryId.Value); + } + + if (status.HasValue) + { + query = query.Where(x => x.Status == status.Value); + } + + var products = await query + .OrderBy(x => x.Name) + .ToListAsync(cancellationToken); + + return products; + } + + /// + public async Task> GetCategoriesAsync(long tenantId, CancellationToken cancellationToken = default) + { + var categories = await _context.ProductCategories + .AsNoTracking() + .Where(x => x.TenantId == tenantId) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return categories; + } + + /// + public async Task> GetSkusAsync(long productId, long tenantId, CancellationToken cancellationToken = default) + { + var skus = await _context.ProductSkus + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.ProductId == productId) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return skus; + } + + /// + public async Task> GetAddonGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default) + { + var groups = await _context.ProductAddonGroups + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.ProductId == productId) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return groups; + } + + /// + public async Task> GetAddonOptionsAsync(long productId, long tenantId, CancellationToken cancellationToken = default) + { + var groupIds = await _context.ProductAddonGroups + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.ProductId == productId) + .Select(x => x.Id) + .ToListAsync(cancellationToken); + + if (groupIds.Count == 0) + { + return Array.Empty(); + } + + var options = await _context.ProductAddonOptions + .AsNoTracking() + .Where(x => x.TenantId == tenantId && groupIds.Contains(x.AddonGroupId)) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return options; + } + + /// + public async Task> GetAttributeGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default) + { + var groups = await _context.ProductAttributeGroups + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.ProductId == productId) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return groups; + } + + /// + public async Task> GetAttributeOptionsAsync(long productId, long tenantId, CancellationToken cancellationToken = default) + { + var groupIds = await _context.ProductAttributeGroups + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.ProductId == productId) + .Select(x => x.Id) + .ToListAsync(cancellationToken); + + if (groupIds.Count == 0) + { + return Array.Empty(); + } + + var options = await _context.ProductAttributeOptions + .AsNoTracking() + .Where(x => x.TenantId == tenantId && groupIds.Contains(x.AttributeGroupId)) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return options; + } + + /// + public async Task> GetMediaAssetsAsync(long productId, long tenantId, CancellationToken cancellationToken = default) + { + var assets = await _context.ProductMediaAssets + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.ProductId == productId) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return assets; + } + + /// + public async Task> GetPricingRulesAsync(long productId, long tenantId, CancellationToken cancellationToken = default) + { + var rules = await _context.ProductPricingRules + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.ProductId == productId) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return rules; + } + + /// + public Task AddCategoryAsync(ProductCategory category, CancellationToken cancellationToken = default) + { + return _context.ProductCategories.AddAsync(category, cancellationToken).AsTask(); + } + + /// + public Task AddProductAsync(Product product, CancellationToken cancellationToken = default) + { + return _context.Products.AddAsync(product, cancellationToken).AsTask(); + } + + /// + public Task AddSkusAsync(IEnumerable skus, CancellationToken cancellationToken = default) + { + return _context.ProductSkus.AddRangeAsync(skus, cancellationToken); + } + + /// + public Task AddAddonGroupsAsync(IEnumerable groups, IEnumerable options, CancellationToken cancellationToken = default) + { + var addGroupsTask = _context.ProductAddonGroups.AddRangeAsync(groups, cancellationToken); + var addOptionsTask = _context.ProductAddonOptions.AddRangeAsync(options, cancellationToken); + return Task.WhenAll(addGroupsTask, addOptionsTask); + } + + /// + public Task AddAttributeGroupsAsync(IEnumerable groups, IEnumerable options, CancellationToken cancellationToken = default) + { + var addGroupsTask = _context.ProductAttributeGroups.AddRangeAsync(groups, cancellationToken); + var addOptionsTask = _context.ProductAttributeOptions.AddRangeAsync(options, cancellationToken); + return Task.WhenAll(addGroupsTask, addOptionsTask); + } + + /// + public Task AddMediaAssetsAsync(IEnumerable assets, CancellationToken cancellationToken = default) + { + return _context.ProductMediaAssets.AddRangeAsync(assets, cancellationToken); + } + + /// + public Task AddPricingRulesAsync(IEnumerable rules, CancellationToken cancellationToken = default) + { + return _context.ProductPricingRules.AddRangeAsync(rules, cancellationToken); + } + + /// + public Task SaveChangesAsync(CancellationToken cancellationToken = default) + { + return _context.SaveChangesAsync(cancellationToken); + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfStoreRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfStoreRepository.cs new file mode 100644 index 0000000..120f1d0 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Repositories/EfStoreRepository.cs @@ -0,0 +1,174 @@ +using System.Linq; +using Microsoft.EntityFrameworkCore; +using TakeoutSaaS.Domain.Stores.Entities; +using TakeoutSaaS.Domain.Stores.Enums; +using TakeoutSaaS.Domain.Stores.Repositories; +using TakeoutSaaS.Infrastructure.App.Persistence; + +namespace TakeoutSaaS.Infrastructure.App.Repositories; + +/// +/// 门店聚合的 EF Core 仓储实现。 +/// +public sealed class EfStoreRepository : IStoreRepository +{ + private readonly TakeoutAppDbContext _context; + + /// + /// 初始化仓储。 + /// + public EfStoreRepository(TakeoutAppDbContext context) + { + _context = context; + } + + /// + public Task FindByIdAsync(long storeId, long tenantId, CancellationToken cancellationToken = default) + { + return _context.Stores + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.Id == storeId) + .FirstOrDefaultAsync(cancellationToken); + } + + /// + public async Task> SearchAsync(long tenantId, StoreStatus? status, CancellationToken cancellationToken = default) + { + var query = _context.Stores + .AsNoTracking() + .Where(x => x.TenantId == tenantId); + + if (status.HasValue) + { + query = query.Where(x => x.Status == status.Value); + } + + var stores = await query + .OrderBy(x => x.Name) + .ToListAsync(cancellationToken); + + return stores; + } + + /// + public async Task> GetBusinessHoursAsync(long storeId, long tenantId, CancellationToken cancellationToken = default) + { + var hours = await _context.StoreBusinessHours + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.StoreId == storeId) + .OrderBy(x => x.DayOfWeek) + .ThenBy(x => x.StartTime) + .ToListAsync(cancellationToken); + + return hours; + } + + /// + public async Task> GetDeliveryZonesAsync(long storeId, long tenantId, CancellationToken cancellationToken = default) + { + var zones = await _context.StoreDeliveryZones + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.StoreId == storeId) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return zones; + } + + /// + public async Task> GetHolidaysAsync(long storeId, long tenantId, CancellationToken cancellationToken = default) + { + var holidays = await _context.StoreHolidays + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.StoreId == storeId) + .OrderBy(x => x.Date) + .ToListAsync(cancellationToken); + + return holidays; + } + + /// + public async Task> GetTableAreasAsync(long storeId, long tenantId, CancellationToken cancellationToken = default) + { + var areas = await _context.StoreTableAreas + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.StoreId == storeId) + .OrderBy(x => x.SortOrder) + .ToListAsync(cancellationToken); + + return areas; + } + + /// + public async Task> GetTablesAsync(long storeId, long tenantId, CancellationToken cancellationToken = default) + { + var tables = await _context.StoreTables + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.StoreId == storeId) + .OrderBy(x => x.TableCode) + .ToListAsync(cancellationToken); + + return tables; + } + + /// + public async Task> GetShiftsAsync(long storeId, long tenantId, CancellationToken cancellationToken = default) + { + var shifts = await _context.StoreEmployeeShifts + .AsNoTracking() + .Where(x => x.TenantId == tenantId && x.StoreId == storeId) + .OrderBy(x => x.ShiftDate) + .ThenBy(x => x.StartTime) + .ToListAsync(cancellationToken); + + return shifts; + } + + /// + public Task AddStoreAsync(Store store, CancellationToken cancellationToken = default) + { + return _context.Stores.AddAsync(store, cancellationToken).AsTask(); + } + + /// + public Task AddBusinessHoursAsync(IEnumerable hours, CancellationToken cancellationToken = default) + { + return _context.StoreBusinessHours.AddRangeAsync(hours, cancellationToken); + } + + /// + public Task AddDeliveryZonesAsync(IEnumerable zones, CancellationToken cancellationToken = default) + { + return _context.StoreDeliveryZones.AddRangeAsync(zones, cancellationToken); + } + + /// + public Task AddHolidaysAsync(IEnumerable holidays, CancellationToken cancellationToken = default) + { + return _context.StoreHolidays.AddRangeAsync(holidays, cancellationToken); + } + + /// + public Task AddTableAreasAsync(IEnumerable areas, CancellationToken cancellationToken = default) + { + return _context.StoreTableAreas.AddRangeAsync(areas, cancellationToken); + } + + /// + public Task AddTablesAsync(IEnumerable tables, CancellationToken cancellationToken = default) + { + return _context.StoreTables.AddRangeAsync(tables, cancellationToken); + } + + /// + public Task AddShiftsAsync(IEnumerable shifts, CancellationToken cancellationToken = default) + { + return _context.StoreEmployeeShifts.AddRangeAsync(shifts, cancellationToken); + } + + /// + public Task SaveChangesAsync(CancellationToken cancellationToken = default) + { + return _context.SaveChangesAsync(cancellationToken); + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Extensions/DatabaseServiceCollectionExtensions.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Extensions/DatabaseServiceCollectionExtensions.cs index c1047d7..4f50569 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Extensions/DatabaseServiceCollectionExtensions.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Extensions/DatabaseServiceCollectionExtensions.cs @@ -3,7 +3,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using TakeoutSaaS.Infrastructure.Common.Options; using TakeoutSaaS.Infrastructure.Common.Persistence; +using TakeoutSaaS.Shared.Abstractions.Ids; using TakeoutSaaS.Shared.Abstractions.Data; +using TakeoutSaaS.Shared.Kernel.Ids; namespace TakeoutSaaS.Infrastructure.Common.Extensions; @@ -25,6 +27,17 @@ public static class DatabaseServiceCollectionExtensions .ValidateDataAnnotations() .ValidateOnStart(); + services.AddOptions() + .Bind(configuration.GetSection(IdGeneratorOptions.SectionName)) + .ValidateDataAnnotations() + .ValidateOnStart(); + + services.AddSingleton(sp => + { + var options = sp.GetRequiredService>().Value; + return new SnowflakeIdGenerator(options.WorkerId, options.DatacenterId); + }); + services.AddSingleton(); services.AddScoped(); return services; diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/AppDbContext.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/AppDbContext.cs index 068a88f..4733274 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/AppDbContext.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/AppDbContext.cs @@ -3,15 +3,20 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using TakeoutSaaS.Shared.Abstractions.Entities; using TakeoutSaaS.Shared.Abstractions.Security; +using TakeoutSaaS.Shared.Abstractions.Ids; namespace TakeoutSaaS.Infrastructure.Common.Persistence; /// /// 应用基础 DbContext,统一处理审计字段、软删除与全局查询过滤。 /// -public abstract class AppDbContext(DbContextOptions options, ICurrentUserAccessor? currentUserAccessor = null) : DbContext(options) +public abstract class AppDbContext( + DbContextOptions options, + ICurrentUserAccessor? currentUserAccessor = null, + IIdGenerator? idGenerator = null) : DbContext(options) { private readonly ICurrentUserAccessor? _currentUserAccessor = currentUserAccessor; + private readonly IIdGenerator? _idGenerator = idGenerator; /// /// 构建模型时应用软删除过滤器。 @@ -50,10 +55,35 @@ public abstract class AppDbContext(DbContextOptions options, ICurrentUserAccesso /// protected virtual void OnBeforeSaving() { + ApplyIdGeneration(); ApplySoftDeleteMetadata(); ApplyAuditMetadata(); } + /// + /// 为新增实体生成雪花 ID。 + /// + private void ApplyIdGeneration() + { + if (_idGenerator == null) + { + return; + } + + foreach (var entry in ChangeTracker.Entries()) + { + if (entry.State != EntityState.Added) + { + continue; + } + + if (entry.Entity.Id == 0) + { + entry.Entity.Id = _idGenerator.NextId(); + } + } + } + /// /// 将软删除实体的删除操作转换为设置 DeletedAt。 /// @@ -114,10 +144,10 @@ public abstract class AppDbContext(DbContextOptions options, ICurrentUserAccesso } } - private Guid? GetCurrentUserIdOrNull() + private long? GetCurrentUserIdOrNull() { - var userId = _currentUserAccessor?.UserId ?? Guid.Empty; - return userId == Guid.Empty ? null : userId; + var userId = _currentUserAccessor?.UserId ?? 0; + return userId == 0 ? null : userId; } /// diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/DesignTime/DesignTimeDbContextFactoryBase.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/DesignTime/DesignTimeDbContextFactoryBase.cs index c3f59f2..5a2cf5f 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/DesignTime/DesignTimeDbContextFactoryBase.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/DesignTime/DesignTimeDbContextFactoryBase.cs @@ -141,12 +141,12 @@ internal abstract class DesignTimeDbContextFactoryBase : IDesignTimeDb private sealed class DesignTimeTenantProvider : ITenantProvider { - public Guid GetCurrentTenantId() => Guid.Empty; + public long GetCurrentTenantId() => 0; } private sealed class DesignTimeCurrentUserAccessor : ICurrentUserAccessor { - public Guid UserId => Guid.Empty; + public long UserId => 0; public bool IsAuthenticated => false; } } diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/TenantAwareDbContext.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/TenantAwareDbContext.cs index 8681af9..f743d24 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/TenantAwareDbContext.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Common/Persistence/TenantAwareDbContext.cs @@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore; using TakeoutSaaS.Shared.Abstractions.Entities; using TakeoutSaaS.Shared.Abstractions.Security; using TakeoutSaaS.Shared.Abstractions.Tenancy; +using TakeoutSaaS.Shared.Abstractions.Ids; namespace TakeoutSaaS.Infrastructure.Common.Persistence; @@ -12,14 +13,15 @@ namespace TakeoutSaaS.Infrastructure.Common.Persistence; public abstract class TenantAwareDbContext( DbContextOptions options, ITenantProvider tenantProvider, - ICurrentUserAccessor? currentUserAccessor = null) : AppDbContext(options, currentUserAccessor) + ICurrentUserAccessor? currentUserAccessor = null, + IIdGenerator? idGenerator = null) : AppDbContext(options, currentUserAccessor, idGenerator) { private readonly ITenantProvider _tenantProvider = tenantProvider ?? throw new ArgumentNullException(nameof(tenantProvider)); /// /// 当前请求租户 ID。 /// - protected Guid CurrentTenantId => _tenantProvider.GetCurrentTenantId(); + protected long CurrentTenantId => _tenantProvider.GetCurrentTenantId(); /// /// 保存前填充租户元数据并执行基础处理。 @@ -71,7 +73,7 @@ public abstract class TenantAwareDbContext( foreach (var entry in ChangeTracker.Entries()) { - if (entry.State == EntityState.Added && entry.Entity.TenantId == Guid.Empty && tenantId != Guid.Empty) + if (entry.State == EntityState.Added && entry.Entity.TenantId == 0 && tenantId != 0) { entry.Entity.TenantId = tenantId; } diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201042346_InitialDictionary.Designer.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201042346_InitialDictionary.Designer.cs deleted file mode 100644 index ed76f4c..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201042346_InitialDictionary.Designer.cs +++ /dev/null @@ -1,172 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using TakeoutSaaS.Infrastructure.Dictionary.Persistence; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations -{ - [DbContext(typeof(DictionaryDbContext))] - [Migration("20251201042346_InitialDictionary")] - partial class InitialDictionary - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("IsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("Scope") - .HasColumnType("integer"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.HasIndex("TenantId", "Code") - .IsUnique(); - - b.ToTable("dictionary_groups", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("IsDefault") - .HasColumnType("boolean"); - - b.Property("IsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Key") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(100); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.HasIndex("GroupId", "Key") - .IsUnique(); - - b.ToTable("dictionary_items", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryItem", b => - { - b.HasOne("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryGroup", "Group") - .WithMany("Items") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryGroup", b => - { - b.Navigation("Items"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201042346_InitialDictionary.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201042346_InitialDictionary.cs deleted file mode 100644 index 3e0084a..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201042346_InitialDictionary.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations -{ - /// - public partial class InitialDictionary : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "dictionary_groups", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Code = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Scope = table.Column(type: "integer", nullable: false), - Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - IsEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_dictionary_groups", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "dictionary_items", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - GroupId = table.Column(type: "uuid", nullable: false), - Key = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Value = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - IsDefault = table.Column(type: "boolean", nullable: false), - IsEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true), - SortOrder = table.Column(type: "integer", nullable: false, defaultValue: 100), - Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_dictionary_items", x => x.Id); - table.ForeignKey( - name: "FK_dictionary_items_dictionary_groups_GroupId", - column: x => x.GroupId, - principalTable: "dictionary_groups", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_dictionary_groups_TenantId", - table: "dictionary_groups", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "IX_dictionary_groups_TenantId_Code", - table: "dictionary_groups", - columns: new[] { "TenantId", "Code" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_dictionary_items_GroupId_Key", - table: "dictionary_items", - columns: new[] { "GroupId", "Key" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_dictionary_items_TenantId", - table: "dictionary_items", - column: "TenantId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "dictionary_items"); - - migrationBuilder.DropTable( - name: "dictionary_groups"); - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201094456_AddEntityComments.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201094456_AddEntityComments.cs deleted file mode 100644 index 2447766..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201094456_AddEntityComments.cs +++ /dev/null @@ -1,599 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations -{ - /// - public partial class AddEntityComments : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterTable( - name: "dictionary_items", - comment: "参数字典项。"); - - migrationBuilder.AlterTable( - name: "dictionary_groups", - comment: "参数字典分组(系统参数、业务参数)。"); - - migrationBuilder.AlterColumn( - name: "Value", - table: "dictionary_items", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "字典项值。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "dictionary_items", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "dictionary_items", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "dictionary_items", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "dictionary_items", - type: "integer", - nullable: false, - defaultValue: 100, - comment: "排序值,越小越靠前。", - oldClrType: typeof(int), - oldType: "integer", - oldDefaultValue: 100); - - migrationBuilder.AlterColumn( - name: "Key", - table: "dictionary_items", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "字典项键。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "IsEnabled", - table: "dictionary_items", - type: "boolean", - nullable: false, - defaultValue: true, - comment: "是否启用。", - oldClrType: typeof(bool), - oldType: "boolean", - oldDefaultValue: true); - - migrationBuilder.AlterColumn( - name: "IsDefault", - table: "dictionary_items", - type: "boolean", - nullable: false, - comment: "是否默认项。", - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AlterColumn( - name: "GroupId", - table: "dictionary_items", - type: "uuid", - nullable: false, - comment: "关联分组 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "dictionary_items", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "描述信息。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "dictionary_items", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "dictionary_items", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "dictionary_items", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "dictionary_items", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "dictionary_items", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "dictionary_groups", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "dictionary_groups", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "dictionary_groups", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Scope", - table: "dictionary_groups", - type: "integer", - nullable: false, - comment: "分组作用域:系统/业务。", - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "dictionary_groups", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "分组名称。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "IsEnabled", - table: "dictionary_groups", - type: "boolean", - nullable: false, - defaultValue: true, - comment: "是否启用。", - oldClrType: typeof(bool), - oldType: "boolean", - oldDefaultValue: true); - - migrationBuilder.AlterColumn( - name: "Description", - table: "dictionary_groups", - type: "character varying(512)", - maxLength: 512, - nullable: true, - comment: "描述信息。", - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "dictionary_groups", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "dictionary_groups", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "dictionary_groups", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "dictionary_groups", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "dictionary_groups", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "分组编码(唯一)。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "Id", - table: "dictionary_groups", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterTable( - name: "dictionary_items", - oldComment: "参数字典项。"); - - migrationBuilder.AlterTable( - name: "dictionary_groups", - oldComment: "参数字典分组(系统参数、业务参数)。"); - - migrationBuilder.AlterColumn( - name: "Value", - table: "dictionary_items", - type: "character varying(256)", - maxLength: 256, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "字典项值。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "dictionary_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "dictionary_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "dictionary_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "SortOrder", - table: "dictionary_items", - type: "integer", - nullable: false, - defaultValue: 100, - oldClrType: typeof(int), - oldType: "integer", - oldDefaultValue: 100, - oldComment: "排序值,越小越靠前。"); - - migrationBuilder.AlterColumn( - name: "Key", - table: "dictionary_items", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "字典项键。"); - - migrationBuilder.AlterColumn( - name: "IsEnabled", - table: "dictionary_items", - type: "boolean", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "boolean", - oldDefaultValue: true, - oldComment: "是否启用。"); - - migrationBuilder.AlterColumn( - name: "IsDefault", - table: "dictionary_items", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldComment: "是否默认项。"); - - migrationBuilder.AlterColumn( - name: "GroupId", - table: "dictionary_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "关联分组 ID。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "dictionary_items", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "描述信息。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "dictionary_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "dictionary_items", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "dictionary_items", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "dictionary_items", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "dictionary_items", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "dictionary_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "dictionary_groups", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "dictionary_groups", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Scope", - table: "dictionary_groups", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldComment: "分组作用域:系统/业务。"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "dictionary_groups", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "分组名称。"); - - migrationBuilder.AlterColumn( - name: "IsEnabled", - table: "dictionary_groups", - type: "boolean", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "boolean", - oldDefaultValue: true, - oldComment: "是否启用。"); - - migrationBuilder.AlterColumn( - name: "Description", - table: "dictionary_groups", - type: "character varying(512)", - maxLength: 512, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(512)", - oldMaxLength: 512, - oldNullable: true, - oldComment: "描述信息。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "dictionary_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "dictionary_groups", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "dictionary_groups", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "dictionary_groups", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "dictionary_groups", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "分组编码(唯一)。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "dictionary_groups", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Persistence/DictionaryDbContext.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Persistence/DictionaryDbContext.cs index a6aa6b3..6025e35 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Persistence/DictionaryDbContext.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Persistence/DictionaryDbContext.cs @@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using TakeoutSaaS.Domain.Dictionary.Entities; using TakeoutSaaS.Infrastructure.Common.Persistence; +using TakeoutSaaS.Shared.Abstractions.Ids; using TakeoutSaaS.Shared.Abstractions.Security; using TakeoutSaaS.Shared.Abstractions.Tenancy; @@ -13,8 +14,9 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Persistence; public sealed class DictionaryDbContext( DbContextOptions options, ITenantProvider tenantProvider, - ICurrentUserAccessor? currentUserAccessor = null) - : TenantAwareDbContext(options, tenantProvider, currentUserAccessor) + ICurrentUserAccessor? currentUserAccessor = null, + IIdGenerator? idGenerator = null) + : TenantAwareDbContext(options, tenantProvider, currentUserAccessor, idGenerator) { /// /// 字典分组集。 diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Repositories/EfDictionaryRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Repositories/EfDictionaryRepository.cs index 3bb86c1..358a7c7 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Repositories/EfDictionaryRepository.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Repositories/EfDictionaryRepository.cs @@ -19,7 +19,7 @@ public sealed class EfDictionaryRepository : IDictionaryRepository _context = context; } - public Task FindGroupByIdAsync(Guid id, CancellationToken cancellationToken = default) + public Task FindGroupByIdAsync(long id, CancellationToken cancellationToken = default) => _context.DictionaryGroups.FirstOrDefaultAsync(group => group.Id == id, cancellationToken); public Task FindGroupByCodeAsync(string code, CancellationToken cancellationToken = default) @@ -50,10 +50,10 @@ public sealed class EfDictionaryRepository : IDictionaryRepository return Task.CompletedTask; } - public Task FindItemByIdAsync(Guid id, CancellationToken cancellationToken = default) + public Task FindItemByIdAsync(long id, CancellationToken cancellationToken = default) => _context.DictionaryItems.FirstOrDefaultAsync(item => item.Id == id, cancellationToken); - public async Task> GetItemsByGroupIdAsync(Guid groupId, CancellationToken cancellationToken = default) + public async Task> GetItemsByGroupIdAsync(long groupId, CancellationToken cancellationToken = default) { return await _context.DictionaryItems .AsNoTracking() @@ -77,7 +77,7 @@ public sealed class EfDictionaryRepository : IDictionaryRepository public Task SaveChangesAsync(CancellationToken cancellationToken = default) => _context.SaveChangesAsync(cancellationToken); - public async Task> GetItemsByCodesAsync(IEnumerable codes, Guid tenantId, bool includeSystem, CancellationToken cancellationToken = default) + public async Task> GetItemsByCodesAsync(IEnumerable codes, long tenantId, bool includeSystem, CancellationToken cancellationToken = default) { var normalizedCodes = codes .Where(code => !string.IsNullOrWhiteSpace(code)) @@ -96,7 +96,7 @@ public sealed class EfDictionaryRepository : IDictionaryRepository .Include(item => item.Group) .Where(item => normalizedCodes.Contains(item.Group!.Code)); - query = query.Where(item => item.TenantId == tenantId || (includeSystem && item.TenantId == Guid.Empty)); + query = query.Where(item => item.TenantId == tenantId || (includeSystem && item.TenantId == 0)); return await query .OrderBy(item => item.SortOrder) diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Services/DistributedDictionaryCache.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Services/DistributedDictionaryCache.cs index 9024674..d2708ba 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Services/DistributedDictionaryCache.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Services/DistributedDictionaryCache.cs @@ -22,7 +22,7 @@ public sealed class DistributedDictionaryCache : IDictionaryCache _options = options.Value; } - public async Task?> GetAsync(Guid tenantId, string code, CancellationToken cancellationToken = default) + public async Task?> GetAsync(long tenantId, string code, CancellationToken cancellationToken = default) { var cacheKey = BuildKey(tenantId, code); var payload = await _cache.GetAsync(cacheKey, cancellationToken); @@ -34,7 +34,7 @@ public sealed class DistributedDictionaryCache : IDictionaryCache return JsonSerializer.Deserialize>(payload, _serializerOptions); } - public Task SetAsync(Guid tenantId, string code, IReadOnlyList items, CancellationToken cancellationToken = default) + public Task SetAsync(long tenantId, string code, IReadOnlyList items, CancellationToken cancellationToken = default) { var cacheKey = BuildKey(tenantId, code); var payload = JsonSerializer.SerializeToUtf8Bytes(items, _serializerOptions); @@ -45,12 +45,12 @@ public sealed class DistributedDictionaryCache : IDictionaryCache return _cache.SetAsync(cacheKey, payload, options, cancellationToken); } - public Task RemoveAsync(Guid tenantId, string code, CancellationToken cancellationToken = default) + public Task RemoveAsync(long tenantId, string code, CancellationToken cancellationToken = default) { var cacheKey = BuildKey(tenantId, code); return _cache.RemoveAsync(cacheKey, cancellationToken); } - private static string BuildKey(Guid tenantId, string code) - => $"dictionary:{tenantId.ToString().ToLowerInvariant()}:{code.ToLowerInvariant()}"; + private static string BuildKey(long tenantId, string code) + => $"dictionary:{tenantId}:{code.ToLowerInvariant()}"; } diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201042324_InitialIdentity.Designer.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201042324_InitialIdentity.Designer.cs deleted file mode 100644 index 9ea6285..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201042324_InitialIdentity.Designer.cs +++ /dev/null @@ -1,152 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using TakeoutSaaS.Infrastructure.Identity.Persistence; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.Identity.Migrations -{ - [DbContext(typeof(IdentityDbContext))] - [Migration("20251201042324_InitialIdentity")] - partial class InitialIdentity - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.IdentityUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Account") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Avatar") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("MerchantId") - .HasColumnType("uuid"); - - b.Property("PasswordHash") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("text"); - - b.Property("Roles") - .IsRequired() - .HasColumnType("text"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.HasIndex("TenantId", "Account") - .IsUnique(); - - b.ToTable("identity_users", (string)null); - }); - - modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.MiniUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Avatar") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Nickname") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("OpenId") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("TenantId") - .HasColumnType("uuid"); - - b.Property("UnionId") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.HasIndex("TenantId", "OpenId") - .IsUnique(); - - b.ToTable("mini_users", (string)null); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201042324_InitialIdentity.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201042324_InitialIdentity.cs deleted file mode 100644 index 5a5a2c7..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201042324_InitialIdentity.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.Identity.Migrations -{ - /// - public partial class InitialIdentity : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "identity_users", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Account = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - DisplayName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - PasswordHash = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - MerchantId = table.Column(type: "uuid", nullable: true), - Roles = table.Column(type: "text", nullable: false), - Permissions = table.Column(type: "text", nullable: false), - Avatar = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_identity_users", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "mini_users", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OpenId = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - UnionId = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - Nickname = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Avatar = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - DeletedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "uuid", nullable: true), - UpdatedBy = table.Column(type: "uuid", nullable: true), - DeletedBy = table.Column(type: "uuid", nullable: true), - TenantId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_mini_users", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_identity_users_TenantId", - table: "identity_users", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "IX_identity_users_TenantId_Account", - table: "identity_users", - columns: new[] { "TenantId", "Account" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_mini_users_TenantId", - table: "mini_users", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "IX_mini_users_TenantId_OpenId", - table: "mini_users", - columns: new[] { "TenantId", "OpenId" }, - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "identity_users"); - - migrationBuilder.DropTable( - name: "mini_users"); - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201094410_AddEntityComments.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201094410_AddEntityComments.cs deleted file mode 100644 index 5f0481b..0000000 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201094410_AddEntityComments.cs +++ /dev/null @@ -1,581 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace TakeoutSaaS.Infrastructure.Identity.Migrations -{ - /// - public partial class AddEntityComments : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterTable( - name: "mini_users", - comment: "小程序用户实体。"); - - migrationBuilder.AlterTable( - name: "identity_users", - comment: "管理后台账户实体(平台管理员、租户管理员或商户员工)。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "mini_users", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "mini_users", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UnionId", - table: "mini_users", - type: "character varying(128)", - maxLength: 128, - nullable: true, - comment: "微信 UnionId,可能为空。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "mini_users", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "OpenId", - table: "mini_users", - type: "character varying(128)", - maxLength: 128, - nullable: false, - comment: "微信 OpenId。", - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128); - - migrationBuilder.AlterColumn( - name: "Nickname", - table: "mini_users", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "昵称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "mini_users", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "mini_users", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "mini_users", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "mini_users", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Avatar", - table: "mini_users", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "头像地址。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "mini_users", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "identity_users", - type: "uuid", - nullable: true, - comment: "最后更新人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "identity_users", - type: "timestamp with time zone", - nullable: true, - comment: "最近一次更新时间(UTC),从未更新时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "identity_users", - type: "uuid", - nullable: false, - comment: "所属租户 ID。", - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AlterColumn( - name: "Roles", - table: "identity_users", - type: "text", - nullable: false, - comment: "角色集合。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "Permissions", - table: "identity_users", - type: "text", - nullable: false, - comment: "权限集合。", - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "PasswordHash", - table: "identity_users", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "密码哈希。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "identity_users", - type: "uuid", - nullable: true, - comment: "所属商户(平台管理员为空)。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DisplayName", - table: "identity_users", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "展示名称。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "identity_users", - type: "uuid", - nullable: true, - comment: "删除人用户标识(软删除),未删除时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "identity_users", - type: "timestamp with time zone", - nullable: true, - comment: "软删除时间(UTC),未删除时为 null。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "identity_users", - type: "uuid", - nullable: true, - comment: "创建人用户标识,匿名或系统操作时为 null。", - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "identity_users", - type: "timestamp with time zone", - nullable: false, - comment: "创建时间(UTC)。", - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "Avatar", - table: "identity_users", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "头像地址。", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Account", - table: "identity_users", - type: "character varying(64)", - maxLength: 64, - nullable: false, - comment: "登录账号。", - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64); - - migrationBuilder.AlterColumn( - name: "Id", - table: "identity_users", - type: "uuid", - nullable: false, - comment: "实体唯一标识。", - oldClrType: typeof(Guid), - oldType: "uuid"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterTable( - name: "mini_users", - oldComment: "小程序用户实体。"); - - migrationBuilder.AlterTable( - name: "identity_users", - oldComment: "管理后台账户实体(平台管理员、租户管理员或商户员工)。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "mini_users", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "mini_users", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "UnionId", - table: "mini_users", - type: "character varying(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldNullable: true, - oldComment: "微信 UnionId,可能为空。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "mini_users", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "OpenId", - table: "mini_users", - type: "character varying(128)", - maxLength: 128, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(128)", - oldMaxLength: 128, - oldComment: "微信 OpenId。"); - - migrationBuilder.AlterColumn( - name: "Nickname", - table: "mini_users", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "昵称。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "mini_users", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "mini_users", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "mini_users", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "mini_users", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Avatar", - table: "mini_users", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "头像地址。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "mini_users", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - - migrationBuilder.AlterColumn( - name: "UpdatedBy", - table: "identity_users", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "最后更新人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "identity_users", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "最近一次更新时间(UTC),从未更新时为 null。"); - - migrationBuilder.AlterColumn( - name: "TenantId", - table: "identity_users", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "所属租户 ID。"); - - migrationBuilder.AlterColumn( - name: "Roles", - table: "identity_users", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "角色集合。"); - - migrationBuilder.AlterColumn( - name: "Permissions", - table: "identity_users", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "text", - oldComment: "权限集合。"); - - migrationBuilder.AlterColumn( - name: "PasswordHash", - table: "identity_users", - type: "character varying(256)", - maxLength: 256, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "密码哈希。"); - - migrationBuilder.AlterColumn( - name: "MerchantId", - table: "identity_users", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "所属商户(平台管理员为空)。"); - - migrationBuilder.AlterColumn( - name: "DisplayName", - table: "identity_users", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "展示名称。"); - - migrationBuilder.AlterColumn( - name: "DeletedBy", - table: "identity_users", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "删除人用户标识(软删除),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "DeletedAt", - table: "identity_users", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true, - oldComment: "软删除时间(UTC),未删除时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedBy", - table: "identity_users", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true, - oldComment: "创建人用户标识,匿名或系统操作时为 null。"); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "identity_users", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldComment: "创建时间(UTC)。"); - - migrationBuilder.AlterColumn( - name: "Avatar", - table: "identity_users", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "头像地址。"); - - migrationBuilder.AlterColumn( - name: "Account", - table: "identity_users", - type: "character varying(64)", - maxLength: 64, - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(64)", - oldMaxLength: 64, - oldComment: "登录账号。"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "identity_users", - type: "uuid", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid", - oldComment: "实体唯一标识。"); - } - } -} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Options/AdminSeedOptions.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Options/AdminSeedOptions.cs index 575f1b0..5a2f813 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Options/AdminSeedOptions.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Options/AdminSeedOptions.cs @@ -39,12 +39,12 @@ public sealed class SeedUserOptions /// /// 所属租户 ID。 /// - public Guid TenantId { get; set; } + public long TenantId { get; set; } /// /// 所属商户 ID(平台管理员为空)。 /// - public Guid? MerchantId { get; set; } + public long? MerchantId { get; set; } /// /// 角色集合。 diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/EfIdentityUserRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/EfIdentityUserRepository.cs index e90127c..f11a02d 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/EfIdentityUserRepository.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/EfIdentityUserRepository.cs @@ -22,6 +22,6 @@ public sealed class EfIdentityUserRepository : IIdentityUserRepository public Task FindByAccountAsync(string account, CancellationToken cancellationToken = default) => _dbContext.IdentityUsers.AsNoTracking().FirstOrDefaultAsync(x => x.Account == account, cancellationToken); - public Task FindByIdAsync(Guid userId, CancellationToken cancellationToken = default) + public Task FindByIdAsync(long userId, CancellationToken cancellationToken = default) => _dbContext.IdentityUsers.AsNoTracking().FirstOrDefaultAsync(x => x.Id == userId, cancellationToken); } diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/EfMiniUserRepository.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/EfMiniUserRepository.cs index d5c372b..9f843ca 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/EfMiniUserRepository.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/EfMiniUserRepository.cs @@ -22,17 +22,17 @@ public sealed class EfMiniUserRepository : IMiniUserRepository public Task FindByOpenIdAsync(string openId, CancellationToken cancellationToken = default) => _dbContext.MiniUsers.AsNoTracking().FirstOrDefaultAsync(x => x.OpenId == openId, cancellationToken); - public Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default) + public Task FindByIdAsync(long id, CancellationToken cancellationToken = default) => _dbContext.MiniUsers.AsNoTracking().FirstOrDefaultAsync(x => x.Id == id, cancellationToken); - public async Task CreateOrUpdateAsync(string openId, string? unionId, string? nickname, string? avatar, Guid tenantId, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string openId, string? unionId, string? nickname, string? avatar, long tenantId, CancellationToken cancellationToken = default) { var user = await _dbContext.MiniUsers.FirstOrDefaultAsync(x => x.OpenId == openId, cancellationToken); if (user == null) { user = new MiniUser { - Id = Guid.NewGuid(), + Id = 0, OpenId = openId, UnionId = unionId, Nickname = nickname ?? "小程序用户", diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/IdentityDataSeeder.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/IdentityDataSeeder.cs index f640da0..b6ce20f 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/IdentityDataSeeder.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/IdentityDataSeeder.cs @@ -42,7 +42,7 @@ public sealed class IdentityDataSeeder(IServiceProvider serviceProvider, ILogger { user = new DomainIdentityUser { - Id = Guid.NewGuid(), + Id = 0, Account = userOptions.Account, DisplayName = userOptions.DisplayName, TenantId = userOptions.TenantId, @@ -80,7 +80,7 @@ public sealed class IdentityDataSeeder(IServiceProvider serviceProvider, ILogger .Select(v => v.Trim()) .Distinct(StringComparer.OrdinalIgnoreCase)]; - private static IDisposable EnterTenantScope(ITenantContextAccessor accessor, Guid tenantId) + private static IDisposable EnterTenantScope(ITenantContextAccessor accessor, long tenantId) { var previous = accessor.Current; accessor.Current = new TenantContext(tenantId, null, "admin-seed"); diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/IdentityDbContext.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/IdentityDbContext.cs index 07ab279..7f98396 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/IdentityDbContext.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Persistence/IdentityDbContext.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using TakeoutSaaS.Domain.Identity.Entities; using TakeoutSaaS.Infrastructure.Common.Persistence; +using TakeoutSaaS.Shared.Abstractions.Ids; using TakeoutSaaS.Shared.Abstractions.Security; using TakeoutSaaS.Shared.Abstractions.Tenancy; @@ -16,8 +17,9 @@ namespace TakeoutSaaS.Infrastructure.Identity.Persistence; public sealed class IdentityDbContext( DbContextOptions options, ITenantProvider tenantProvider, - ICurrentUserAccessor? currentUserAccessor = null) - : TenantAwareDbContext(options, tenantProvider, currentUserAccessor) + ICurrentUserAccessor? currentUserAccessor = null, + IIdGenerator? idGenerator = null) + : TenantAwareDbContext(options, tenantProvider, currentUserAccessor, idGenerator) { /// /// 管理后台用户集合。 diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Services/RedisRefreshTokenStore.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Services/RedisRefreshTokenStore.cs index aabd967..3a670a9 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Services/RedisRefreshTokenStore.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Services/RedisRefreshTokenStore.cs @@ -26,7 +26,7 @@ public sealed class RedisRefreshTokenStore : IRefreshTokenStore _options = options.Value; } - public async Task IssueAsync(Guid userId, DateTime expiresAt, CancellationToken cancellationToken = default) + public async Task IssueAsync(long userId, DateTime expiresAt, CancellationToken cancellationToken = default) { var token = Convert.ToBase64String(RandomNumberGenerator.GetBytes(48)); var descriptor = new RefreshTokenDescriptor(token, userId, expiresAt, false); diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201094254_AddEntityComments.Designer.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20251202005208_InitSnowflake_App.Designer.cs similarity index 79% rename from src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201094254_AddEntityComments.Designer.cs rename to src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20251202005208_InitSnowflake_App.Designer.cs index 2baf184..84faa52 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/20251201094254_AddEntityComments.Designer.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20251202005208_InitSnowflake_App.Designer.cs @@ -9,11 +9,11 @@ using TakeoutSaaS.Infrastructure.App.Persistence; #nullable disable -namespace TakeoutSaaS.Infrastructure.App.Migrations +namespace TakeoutSaaS.Infrastructure.Migrations { [DbContext(typeof(TakeoutAppDbContext))] - [Migration("20251201094254_AddEntityComments")] - partial class AddEntityComments + [Migration("20251202005208_InitSnowflake_App")] + partial class InitSnowflake_App { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -27,11 +27,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricAlertRule", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ConditionJson") .IsRequired() .HasColumnType("text") @@ -41,24 +43,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Enabled") .HasColumnType("boolean") .HasComment("是否启用。"); - b.Property("MetricDefinitionId") - .HasColumnType("uuid") + b.Property("MetricDefinitionId") + .HasColumnType("bigint") .HasComment("关联指标。"); b.Property("NotificationChannels") @@ -71,16 +73,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("告警级别。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -95,11 +97,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricDefinition", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Code") .IsRequired() .HasMaxLength(64) @@ -110,8 +114,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DefaultAggregation") @@ -124,8 +128,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -143,16 +147,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("指标名称。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -168,25 +172,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricSnapshot", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DimensionKey") @@ -195,20 +201,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("维度键(JSON)。"); - b.Property("MetricDefinitionId") - .HasColumnType("uuid") + b.Property("MetricDefinitionId") + .HasColumnType("bigint") .HasComment("指标定义 ID。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Value") @@ -237,35 +243,37 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.Coupon", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Code") .IsRequired() .HasMaxLength(32) .HasColumnType("character varying(32)") .HasComment("券码或序列号。"); - b.Property("CouponTemplateId") - .HasColumnType("uuid") + b.Property("CouponTemplateId") + .HasColumnType("bigint") .HasComment("模板标识。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpireAt") @@ -276,32 +284,32 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("发放时间。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("订单 ID(已使用时记录)。"); b.Property("Status") .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("UsedAt") .HasColumnType("timestamp with time zone") .HasComment("使用时间。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("归属用户。"); b.HasKey("Id"); @@ -317,11 +325,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.CouponTemplate", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AllowStack") .HasColumnType("boolean") .HasComment("是否允许叠加其他优惠。"); @@ -342,16 +352,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -389,8 +399,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("适用门店 ID 集合(JSON)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TotalQuantity") @@ -401,8 +411,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("ValidFrom") @@ -427,11 +437,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.PromotionCampaign", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AudienceDescription") .HasMaxLength(512) .HasColumnType("character varying(512)") @@ -450,16 +462,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndAt") @@ -489,16 +501,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("活动状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -511,13 +523,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatMessage", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("ChatSessionId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChatSessionId") + .HasColumnType("bigint") .HasComment("会话标识。"); b.Property("Content") @@ -536,16 +550,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsRead") @@ -560,20 +574,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("发送方类型。"); - b.Property("SenderUserId") - .HasColumnType("uuid") + b.Property("SenderUserId") + .HasColumnType("bigint") .HasComment("发送方用户 ID。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -588,33 +602,35 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatSession", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AgentUserId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AgentUserId") + .HasColumnType("bigint") .HasComment("当前客服员工 ID。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); - b.Property("CustomerUserId") - .HasColumnType("uuid") + b.Property("CustomerUserId") + .HasColumnType("bigint") .HasComment("顾客用户 ID。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndedAt") @@ -639,20 +655,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("会话状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("所属门店(可空为平台)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -668,13 +684,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.SupportTicket", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AssignedAgentId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AssignedAgentId") + .HasColumnType("bigint") .HasComment("指派的客服。"); b.Property("ClosedAt") @@ -685,20 +703,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); - b.Property("CustomerUserId") - .HasColumnType("uuid") + b.Property("CustomerUserId") + .HasColumnType("bigint") .HasComment("客户用户 ID。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -706,8 +724,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("工单详情。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单(如有)。"); b.Property("Priority") @@ -724,8 +742,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("工单主题。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TicketNo") @@ -738,8 +756,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -755,17 +773,19 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.TicketComment", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AttachmentsJson") .HasColumnType("text") .HasComment("附件 JSON。"); - b.Property("AuthorUserId") - .HasColumnType("uuid") + b.Property("AuthorUserId") + .HasColumnType("bigint") .HasComment("评论人 ID。"); b.Property("Content") @@ -778,36 +798,36 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsInternal") .HasColumnType("boolean") .HasComment("是否内部备注。"); - b.Property("SupportTicketId") - .HasColumnType("uuid") + b.Property("SupportTicketId") + .HasColumnType("bigint") .HasComment("工单标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -822,29 +842,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryEvent", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("DeliveryOrderId") - .HasColumnType("uuid") + b.Property("DeliveryOrderId") + .HasColumnType("bigint") .HasComment("配送单标识。"); b.Property("EventType") @@ -865,16 +887,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("原始数据 JSON。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -889,11 +911,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryOrder", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CourierName") .HasMaxLength(64) .HasColumnType("character varying(64)") @@ -908,16 +932,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveredAt") @@ -938,8 +962,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("异常原因。"); - b.Property("OrderId") - .HasColumnType("uuid"); + b.Property("OrderId") + .HasColumnType("bigint"); b.Property("PickedUpAt") .HasColumnType("timestamp with time zone") @@ -958,16 +982,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -983,33 +1007,35 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliateOrder", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AffiliatePartnerId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AffiliatePartnerId") + .HasColumnType("bigint") .HasComment("推广人标识。"); - b.Property("BuyerUserId") - .HasColumnType("uuid") + b.Property("BuyerUserId") + .HasColumnType("bigint") .HasComment("用户 ID。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EstimatedCommission") @@ -1022,8 +1048,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("订单金额。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单。"); b.Property("SettledAt") @@ -1034,16 +1060,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("当前状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1059,11 +1085,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePartner", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ChannelType") .HasColumnType("integer") .HasComment("渠道类型。"); @@ -1076,16 +1104,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DisplayName") @@ -1108,20 +1136,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("当前状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户 ID(如绑定平台账号)。"); b.HasKey("Id"); @@ -1136,13 +1164,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePayout", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AffiliatePartnerId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AffiliatePartnerId") + .HasColumnType("bigint") .HasComment("合作伙伴标识。"); b.Property("Amount") @@ -1154,16 +1184,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("PaidAt") @@ -1185,16 +1215,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1210,11 +1240,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInCampaign", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AllowMakeupCount") .HasColumnType("integer") .HasComment("支持补签次数。"); @@ -1223,16 +1255,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -1263,16 +1295,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1287,13 +1319,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInRecord", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("CheckInCampaignId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CheckInCampaignId") + .HasColumnType("bigint") .HasComment("活动标识。"); b.Property("CheckInDate") @@ -1304,16 +1338,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsMakeup") @@ -1325,20 +1359,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("获得奖励 JSON。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.HasKey("Id"); @@ -1354,13 +1388,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityComment", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AuthorUserId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorUserId") + .HasColumnType("bigint") .HasComment("评论人。"); b.Property("Content") @@ -1373,40 +1409,40 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsDeleted") .HasColumnType("boolean") .HasComment("状态。"); - b.Property("ParentId") - .HasColumnType("uuid") + b.Property("ParentId") + .HasColumnType("bigint") .HasComment("父级评论 ID。"); - b.Property("PostId") - .HasColumnType("uuid") + b.Property("PostId") + .HasColumnType("bigint") .HasComment("动态标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1421,13 +1457,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityPost", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AuthorUserId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorUserId") + .HasColumnType("bigint") .HasComment("作者用户 ID。"); b.Property("CommentCount") @@ -1443,16 +1481,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("LikeCount") @@ -1467,8 +1505,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Title") @@ -1480,8 +1518,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1496,29 +1534,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityReaction", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("PostId") - .HasColumnType("uuid") + b.Property("PostId") + .HasColumnType("bigint") .HasComment("动态 ID。"); b.Property("ReactedAt") @@ -1529,20 +1569,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("反应类型。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户 ID。"); b.HasKey("Id"); @@ -1558,11 +1598,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.GroupBuying.Entities.GroupOrder", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CancelledAt") .HasColumnType("timestamp with time zone") .HasComment("取消时间。"); @@ -1571,8 +1613,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("CurrentCount") @@ -1583,8 +1625,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndAt") @@ -1602,12 +1644,12 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("拼团价格。"); - b.Property("LeaderUserId") - .HasColumnType("uuid") + b.Property("LeaderUserId") + .HasColumnType("bigint") .HasComment("团长用户 ID。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("关联商品或套餐。"); b.Property("StartAt") @@ -1618,8 +1660,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("拼团状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); b.Property("SucceededAt") @@ -1630,16 +1672,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("成团需要的人数。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1655,57 +1697,59 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.GroupBuying.Entities.GroupParticipant", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("GroupOrderId") - .HasColumnType("uuid") + b.Property("GroupOrderId") + .HasColumnType("bigint") .HasComment("拼单活动标识。"); b.Property("JoinedAt") .HasColumnType("timestamp with time zone") .HasComment("参与时间。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("对应订单标识。"); b.Property("Status") .HasColumnType("integer") .HasComment("参与状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.HasKey("Id"); @@ -1721,11 +1765,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryAdjustment", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AdjustmentType") .HasColumnType("integer") .HasComment("调整类型。"); @@ -1734,28 +1780,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("InventoryItemId") - .HasColumnType("uuid") + b.Property("InventoryItemId") + .HasColumnType("bigint") .HasComment("对应的库存记录标识。"); b.Property("OccurredAt") .HasColumnType("timestamp with time zone") .HasComment("发生时间。"); - b.Property("OperatorId") - .HasColumnType("uuid") + b.Property("OperatorId") + .HasColumnType("bigint") .HasComment("操作人标识。"); b.Property("Quantity") @@ -1767,16 +1813,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("原因说明。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1791,11 +1837,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryBatch", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("BatchNumber") .IsRequired() .HasMaxLength(64) @@ -1806,24 +1854,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpireDate") .HasColumnType("timestamp with time zone") .HasComment("过期日期。"); - b.Property("ProductSkuId") - .HasColumnType("uuid") + b.Property("ProductSkuId") + .HasColumnType("bigint") .HasComment("SKU 标识。"); b.Property("ProductionDate") @@ -1838,20 +1886,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("剩余数量。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1867,11 +1915,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("BatchNumber") .HasMaxLength(64) .HasColumnType("character varying(64)") @@ -1881,16 +1931,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpireDate") @@ -1902,8 +1952,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("储位或仓位信息。"); - b.Property("ProductSkuId") - .HasColumnType("uuid") + b.Property("ProductSkuId") + .HasColumnType("bigint") .HasComment("SKU 标识。"); b.Property("QuantityOnHand") @@ -1918,20 +1968,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("安全库存阈值。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1946,11 +1996,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberGrowthLog", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ChangeValue") .HasColumnType("integer") .HasComment("变动数量。"); @@ -1959,8 +2011,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("CurrentValue") @@ -1971,12 +2023,12 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("MemberId") - .HasColumnType("uuid") + b.Property("MemberId") + .HasColumnType("bigint") .HasComment("会员标识。"); b.Property("Notes") @@ -1988,16 +2040,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("发生时间。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2012,11 +2064,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberPointLedger", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("BalanceAfterChange") .HasColumnType("integer") .HasComment("变动后余额。"); @@ -2029,24 +2083,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpireAt") .HasColumnType("timestamp with time zone") .HasComment("过期时间(如适用)。"); - b.Property("MemberId") - .HasColumnType("uuid") + b.Property("MemberId") + .HasColumnType("bigint") .HasComment("会员标识。"); b.Property("OccurredAt") @@ -2057,20 +2111,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("变动原因。"); - b.Property("SourceId") - .HasColumnType("uuid") + b.Property("SourceId") + .HasColumnType("bigint") .HasComment("来源 ID(订单、活动等)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2085,11 +2139,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberProfile", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AvatarUrl") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -2103,16 +2159,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("GrowthValue") @@ -2123,8 +2179,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("注册时间。"); - b.Property("MemberTierId") - .HasColumnType("uuid") + b.Property("MemberTierId") + .HasColumnType("bigint") .HasComment("当前会员等级 ID。"); b.Property("Mobile") @@ -2146,20 +2202,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("会员状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.HasKey("Id"); @@ -2175,11 +2231,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberTier", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("BenefitsJson") .IsRequired() .HasColumnType("text") @@ -2189,16 +2247,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Name") @@ -2215,16 +2273,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序值。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2240,11 +2298,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.Merchant", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Address") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -2294,16 +2354,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("District") @@ -2362,16 +2422,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("税号/统一社会信用代码。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2386,11 +2446,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantContract", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ContractNumber") .IsRequired() .HasMaxLength(64) @@ -2401,16 +2463,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndDate") @@ -2423,8 +2485,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(512)") .HasComment("合同文件存储地址。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户标识。"); b.Property("SignedAt") @@ -2439,8 +2501,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("合同状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TerminatedAt") @@ -2456,8 +2518,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2473,25 +2535,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantDocument", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DocumentNumber") @@ -2517,8 +2581,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("签发日期。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户标识。"); b.Property("Remarks") @@ -2529,16 +2593,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("审核状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2553,25 +2617,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantStaff", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Email") @@ -2579,12 +2645,12 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("邮箱地址。"); - b.Property("IdentityUserId") - .HasColumnType("uuid") + b.Property("IdentityUserId") + .HasColumnType("bigint") .HasComment("登录账号 ID(指向统一身份体系)。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户标识。"); b.Property("Name") @@ -2611,20 +2677,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("员工状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("可选的关联门店 ID。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2639,11 +2705,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Navigation.Entities.MapLocation", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Address") .IsRequired() .HasMaxLength(256) @@ -2654,16 +2722,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Landmark") @@ -2685,20 +2753,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("名称。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("关联门店 ID,可空表示独立 POI。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2713,11 +2781,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Navigation.Entities.NavigationRequest", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Channel") .HasColumnType("integer") .HasComment("来源通道(小程序、H5 等)。"); @@ -2726,44 +2796,44 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("RequestedAt") .HasColumnType("timestamp with time zone") .HasComment("请求时间。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店 ID。"); b.Property("TargetApp") .HasColumnType("integer") .HasComment("跳转的地图应用。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户 ID。"); b.HasKey("Id"); @@ -2778,11 +2848,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CartItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AttributesJson") .HasColumnType("text") .HasComment("扩展 JSON(规格、加料选项等)。"); @@ -2791,20 +2863,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("商品或 SKU 标识。"); b.Property("ProductName") @@ -2813,8 +2885,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("商品名称快照。"); - b.Property("ProductSkuId") - .HasColumnType("uuid") + b.Property("ProductSkuId") + .HasColumnType("bigint") .HasComment("SKU 标识。"); b.Property("Quantity") @@ -2826,16 +2898,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("自定义备注(口味要求)。"); - b.Property("ShoppingCartId") - .HasColumnType("uuid") + b.Property("ShoppingCartId") + .HasColumnType("bigint") .HasComment("所属购物车标识。"); b.Property("Status") .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UnitPrice") @@ -2847,8 +2919,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2863,29 +2935,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CartItemAddon", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("CartItemId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CartItemId") + .HasColumnType("bigint") .HasComment("所属购物车条目。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExtraPrice") @@ -2899,20 +2973,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("选项名称。"); - b.Property("OptionId") - .HasColumnType("uuid") + b.Property("OptionId") + .HasColumnType("bigint") .HasComment("选项 ID(可对应 ProductAddonOption)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2925,25 +2999,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CheckoutSession", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpiresAt") @@ -2960,24 +3036,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("会话状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.Property("ValidationResultJson") @@ -2998,25 +3074,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.ShoppingCart", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveryPreference") @@ -3032,8 +3110,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("购物车状态,包含正常/锁定。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); b.Property("TableContext") @@ -3041,20 +3119,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("桌码或场景标识(扫码点餐)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.HasKey("Id"); @@ -3070,11 +3148,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.Order", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CancelReason") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -3092,8 +3172,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("CustomerName") @@ -3110,8 +3190,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveryType") @@ -3166,16 +3246,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(512)") .HasComment("备注。"); - b.Property("ReservationId") - .HasColumnType("uuid") + b.Property("ReservationId") + .HasColumnType("bigint") .HasComment("预约 ID。"); b.Property("Status") .HasColumnType("integer") .HasComment("当前状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店。"); b.Property("TableNo") @@ -3183,16 +3263,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(32)") .HasComment("就餐桌号。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3210,11 +3290,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AttributesJson") .HasColumnType("text") .HasComment("自定义属性 JSON。"); @@ -3223,16 +3305,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DiscountAmount") @@ -3240,12 +3322,12 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("折扣金额。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("订单 ID。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("商品 ID。"); b.Property("ProductName") @@ -3268,8 +3350,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("小计。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Unit") @@ -3286,8 +3368,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3304,25 +3386,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderStatusHistory", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Notes") @@ -3334,28 +3418,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("发生时间。"); - b.Property("OperatorId") - .HasColumnType("uuid") + b.Property("OperatorId") + .HasColumnType("bigint") .HasComment("操作人标识(可为空表示系统)。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("订单标识。"); b.Property("Status") .HasColumnType("integer") .HasComment("变更后的状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3370,11 +3454,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.RefundRequest", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Amount") .HasPrecision(18, 2) .HasColumnType("numeric(18,2)") @@ -3384,20 +3470,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单标识。"); b.Property("ProcessedAt") @@ -3429,16 +3515,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("退款状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3454,11 +3540,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Payments.Entities.PaymentRecord", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Amount") .HasPrecision(18, 2) .HasColumnType("numeric(18,2)") @@ -3473,24 +3561,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Method") .HasColumnType("integer") .HasComment("支付方式。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单。"); b.Property("PaidAt") @@ -3510,8 +3598,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("支付状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TradeNo") @@ -3523,8 +3611,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3539,11 +3627,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Payments.Entities.PaymentRefundRecord", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Amount") .HasPrecision(18, 2) .HasColumnType("numeric(18,2)") @@ -3562,28 +3652,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单标识。"); b.Property("Payload") .HasColumnType("text") .HasComment("渠道返回的原始数据 JSON。"); - b.Property("PaymentRecordId") - .HasColumnType("uuid") + b.Property("PaymentRecordId") + .HasColumnType("bigint") .HasComment("原支付记录标识。"); b.Property("RequestedAt") @@ -3594,16 +3684,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("退款状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3618,13 +3708,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.Product", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("CategoryId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("bigint") .HasComment("所属分类。"); b.Property("CoverImage") @@ -3636,16 +3728,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -3707,8 +3799,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("库存数量(可选)。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("所属门店。"); b.Property("Subtitle") @@ -3716,8 +3808,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("副标题/卖点。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Unit") @@ -3729,8 +3821,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3748,25 +3840,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAddonGroup", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsRequired") @@ -3787,8 +3881,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("分组名称。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("所属商品。"); b.Property("SelectionType") @@ -3799,16 +3893,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序值。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3823,29 +3917,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAddonOption", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AddonGroupId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AddonGroupId") + .HasColumnType("bigint") .HasComment("所属加料分组。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExtraPrice") @@ -3867,16 +3963,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3889,25 +3985,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAttributeGroup", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsRequired") @@ -3920,6 +4018,10 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("分组名称,例如“辣度”“份量”。"); + b.Property("ProductId") + .HasColumnType("bigint") + .HasComment("所属商品标识。"); + b.Property("SelectionType") .HasColumnType("integer") .HasComment("选择类型(单选/多选)。"); @@ -3928,20 +4030,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("显示排序。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("关联门店,可为空表示所有门店共享。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3956,29 +4058,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAttributeOption", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AttributeGroupId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AttributeGroupId") + .HasColumnType("bigint") .HasComment("所属规格组。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExtraPrice") @@ -4000,16 +4104,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4025,25 +4129,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductCategory", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -4065,20 +4171,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序值。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("所属门店。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4093,11 +4199,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductMediaAsset", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Caption") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -4107,40 +4215,40 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("MediaType") .HasColumnType("integer") .HasComment("媒体类型。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("商品标识。"); b.Property("SortOrder") .HasColumnType("integer") .HasComment("排序。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Url") @@ -4159,11 +4267,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductPricingRule", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ConditionsJson") .IsRequired() .HasColumnType("text") @@ -4173,16 +4283,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndTime") @@ -4194,28 +4304,32 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("特殊价格。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("所属商品。"); b.Property("RuleType") .HasColumnType("integer") .HasComment("策略类型。"); + b.Property("SortOrder") + .HasColumnType("integer") + .HasComment("排序值。"); + b.Property("StartTime") .HasColumnType("timestamp with time zone") .HasComment("生效开始时间。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("WeekdaysJson") @@ -4234,11 +4348,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductSku", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AttributesJson") .IsRequired() .HasColumnType("text") @@ -4253,16 +4369,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("OriginalPrice") @@ -4275,8 +4391,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("售价。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("所属商品标识。"); b.Property("SkuCode") @@ -4285,20 +4401,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(32)") .HasComment("SKU 编码。"); + b.Property("SortOrder") + .HasColumnType("integer") + .HasComment("排序值。"); + b.Property("StockQuantity") .HasColumnType("integer") .HasComment("可售库存。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Weight") @@ -4319,11 +4439,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Queues.Entities.QueueTicket", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CalledAt") .HasColumnType("timestamp with time zone") .HasComment("叫号时间。"); @@ -4336,16 +4458,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EstimatedWaitMinutes") @@ -4369,11 +4491,11 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("StoreId") - .HasColumnType("uuid"); + b.Property("StoreId") + .HasColumnType("bigint"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TicketNumber") @@ -4386,8 +4508,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4405,11 +4527,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Reservations.Entities.Reservation", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CancelledAt") .HasColumnType("timestamp with time zone") .HasComment("取消时间。"); @@ -4427,8 +4551,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("CustomerName") @@ -4447,8 +4571,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("PeopleCount") @@ -4474,8 +4598,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店。"); b.Property("TablePreference") @@ -4483,16 +4607,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("桌型/标签。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4510,11 +4634,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.Store", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Address") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -4553,16 +4679,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveryRadiusKm") @@ -4592,8 +4718,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("门店负责人姓名。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户标识。"); b.Property("Name") @@ -4640,16 +4766,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("门店标签(逗号分隔)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4667,11 +4793,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreBusinessHour", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CapacityLimit") .HasColumnType("integer") .HasComment("最大接待容量或单量限制。"); @@ -4680,8 +4808,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DayOfWeek") @@ -4692,8 +4820,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndTime") @@ -4713,20 +4841,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("interval") .HasComment("开始时间(本地时间)。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4741,25 +4869,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreDeliveryZone", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveryFee") @@ -4781,20 +4911,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("GeoJSON 表示的多边形范围。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("SortOrder") + .HasColumnType("integer") + .HasComment("排序值。"); + + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("ZoneName") @@ -4815,25 +4949,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreEmployeeShift", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndTime") @@ -4853,28 +4989,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("班次日期。"); - b.Property("StaffId") - .HasColumnType("uuid") + b.Property("StaffId") + .HasColumnType("bigint") .HasComment("员工标识。"); b.Property("StartTime") .HasColumnType("interval") .HasComment("开始时间。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4890,17 +5026,19 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreHoliday", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("Date") @@ -4911,8 +5049,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsClosed") @@ -4924,20 +5062,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("说明内容。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4953,13 +5091,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreTable", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AreaId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AreaId") + .HasColumnType("bigint") .HasComment("所在区域 ID。"); b.Property("Capacity") @@ -4970,16 +5110,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("QrCodeUrl") @@ -4991,8 +5131,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("当前桌台状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); b.Property("TableCode") @@ -5006,16 +5146,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("桌台标签(堂食、快餐等)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -5031,25 +5171,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreTableArea", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -5063,20 +5205,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("区域名称。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("SortOrder") + .HasColumnType("integer") + .HasComment("排序值。"); + + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -5092,11 +5238,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.Tenant", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Address") .HasColumnType("text") .HasComment("详细地址信息。"); @@ -5138,16 +5286,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EffectiveFrom") @@ -5178,8 +5326,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("租户全称或品牌名称。"); - b.Property("PrimaryOwnerUserId") - .HasColumnType("uuid") + b.Property("PrimaryOwnerUserId") + .HasColumnType("bigint") .HasComment("系统内对应的租户所有者账号 ID。"); b.Property("Province") @@ -5216,8 +5364,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Website") @@ -5237,11 +5385,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantBillingStatement", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AmountDue") .HasPrecision(18, 2) .HasColumnType("numeric(18,2)") @@ -5256,16 +5406,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DueDate") @@ -5294,16 +5444,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("当前付款状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -5319,11 +5469,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantNotification", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Channel") .HasColumnType("integer") .HasComment("发布通道(站内、邮件、短信等)。"); @@ -5332,16 +5484,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Message") @@ -5366,8 +5518,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("通知重要级别。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Title") @@ -5380,8 +5532,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -5396,25 +5548,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantPackage", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -5468,8 +5622,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("YearlyPrice") @@ -5486,25 +5640,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantQuotaUsage", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("LastResetAt") @@ -5523,16 +5679,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("配额刷新周期描述(如月、年)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("UsedValue") @@ -5552,11 +5708,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantSubscription", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AutoRenew") .HasColumnType("boolean") .HasComment("是否开启自动续费。"); @@ -5565,16 +5723,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EffectiveFrom") @@ -5593,28 +5751,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("运营备注信息。"); - b.Property("ScheduledPackageId") - .HasColumnType("uuid") + b.Property("ScheduledPackageId") + .HasColumnType("bigint") .HasComment("若已排期升降配,对应的新套餐 ID。"); b.Property("Status") .HasColumnType("integer") .HasComment("订阅当前状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); - b.Property("TenantPackageId") - .HasColumnType("uuid") + b.Property("TenantPackageId") + .HasColumnType("bigint") .HasComment("当前订阅关联的套餐标识。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20251202005208_InitSnowflake_App.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20251202005208_InitSnowflake_App.cs new file mode 100644 index 0000000..4b31527 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20251202005208_InitSnowflake_App.cs @@ -0,0 +1,2550 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace TakeoutSaaS.Infrastructure.Migrations +{ + /// + public partial class InitSnowflake_App : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "affiliate_orders", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AffiliatePartnerId = table.Column(type: "bigint", nullable: false, comment: "推广人标识。"), + OrderId = table.Column(type: "bigint", nullable: false, comment: "关联订单。"), + BuyerUserId = table.Column(type: "bigint", nullable: false, comment: "用户 ID。"), + OrderAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "订单金额。"), + EstimatedCommission = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "预计佣金。"), + Status = table.Column(type: "integer", nullable: false, comment: "当前状态。"), + SettledAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "结算完成时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_affiliate_orders", x => x.Id); + }, + comment: "分销订单记录。"); + + migrationBuilder.CreateTable( + name: "affiliate_partners", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "bigint", nullable: true, comment: "用户 ID(如绑定平台账号)。"), + DisplayName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "昵称或渠道名称。"), + Phone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "联系电话。"), + ChannelType = table.Column(type: "integer", nullable: false, comment: "渠道类型。"), + CommissionRate = table.Column(type: "numeric", nullable: false, comment: "分成比例(0-1)。"), + Status = table.Column(type: "integer", nullable: false, comment: "当前状态。"), + Remarks = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "审核备注。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_affiliate_partners", x => x.Id); + }, + comment: "分销/推广合作伙伴。"); + + migrationBuilder.CreateTable( + name: "affiliate_payouts", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AffiliatePartnerId = table.Column(type: "bigint", nullable: false, comment: "合作伙伴标识。"), + Period = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "结算周期描述。"), + Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "结算金额。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + PaidAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "打款时间。"), + Remarks = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_affiliate_payouts", x => x.Id); + }, + comment: "佣金结算记录。"); + + migrationBuilder.CreateTable( + name: "cart_item_addons", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CartItemId = table.Column(type: "bigint", nullable: false, comment: "所属购物车条目。"), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "选项名称。"), + ExtraPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "附加价格。"), + OptionId = table.Column(type: "bigint", nullable: true, comment: "选项 ID(可对应 ProductAddonOption)。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_cart_item_addons", x => x.Id); + }, + comment: "购物车条目的加料/附加项。"); + + migrationBuilder.CreateTable( + name: "cart_items", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ShoppingCartId = table.Column(type: "bigint", nullable: false, comment: "所属购物车标识。"), + ProductId = table.Column(type: "bigint", nullable: false, comment: "商品或 SKU 标识。"), + ProductSkuId = table.Column(type: "bigint", nullable: true, comment: "SKU 标识。"), + ProductName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "商品名称快照。"), + UnitPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "单价快照。"), + Quantity = table.Column(type: "integer", nullable: false, comment: "数量。"), + Remark = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "自定义备注(口味要求)。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + AttributesJson = table.Column(type: "text", nullable: true, comment: "扩展 JSON(规格、加料选项等)。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_cart_items", x => x.Id); + }, + comment: "购物车条目。"); + + migrationBuilder.CreateTable( + name: "chat_messages", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ChatSessionId = table.Column(type: "bigint", nullable: false, comment: "会话标识。"), + SenderType = table.Column(type: "integer", nullable: false, comment: "发送方类型。"), + SenderUserId = table.Column(type: "bigint", nullable: true, comment: "发送方用户 ID。"), + Content = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "消息内容。"), + ContentType = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "消息类型(文字/图片/语音等)。"), + IsRead = table.Column(type: "boolean", nullable: false, comment: "是否已读。"), + ReadAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "读取时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_chat_messages", x => x.Id); + }, + comment: "会话消息。"); + + migrationBuilder.CreateTable( + name: "chat_sessions", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + SessionCode = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "会话编号。"), + CustomerUserId = table.Column(type: "bigint", nullable: false, comment: "顾客用户 ID。"), + AgentUserId = table.Column(type: "bigint", nullable: true, comment: "当前客服员工 ID。"), + StoreId = table.Column(type: "bigint", nullable: true, comment: "所属门店(可空为平台)。"), + Status = table.Column(type: "integer", nullable: false, comment: "会话状态。"), + IsBotActive = table.Column(type: "boolean", nullable: false, comment: "是否机器人接待中。"), + StartedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "开始时间。"), + EndedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "结束时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_chat_sessions", x => x.Id); + }, + comment: "客服会话。"); + + migrationBuilder.CreateTable( + name: "checkin_campaigns", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "活动名称。"), + Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "活动描述。"), + StartDate = table.Column(type: "timestamp with time zone", nullable: false, comment: "开始日期。"), + EndDate = table.Column(type: "timestamp with time zone", nullable: false, comment: "结束日期。"), + AllowMakeupCount = table.Column(type: "integer", nullable: false, comment: "支持补签次数。"), + RewardsJson = table.Column(type: "text", nullable: false, comment: "连签奖励 JSON。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_checkin_campaigns", x => x.Id); + }, + comment: "签到活动配置。"); + + migrationBuilder.CreateTable( + name: "checkin_records", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CheckInCampaignId = table.Column(type: "bigint", nullable: false, comment: "活动标识。"), + UserId = table.Column(type: "bigint", nullable: false, comment: "用户标识。"), + CheckInDate = table.Column(type: "timestamp with time zone", nullable: false, comment: "签到日期(本地)。"), + IsMakeup = table.Column(type: "boolean", nullable: false, comment: "是否补签。"), + RewardJson = table.Column(type: "text", nullable: false, comment: "获得奖励 JSON。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_checkin_records", x => x.Id); + }, + comment: "用户签到记录。"); + + migrationBuilder.CreateTable( + name: "checkout_sessions", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "bigint", nullable: false, comment: "用户标识。"), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + SessionToken = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "会话 Token。"), + Status = table.Column(type: "integer", nullable: false, comment: "会话状态。"), + ValidationResultJson = table.Column(type: "text", nullable: false, comment: "校验结果明细 JSON。"), + ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "过期时间(UTC)。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_checkout_sessions", x => x.Id); + }, + comment: "结账会话,记录校验上下文。"); + + migrationBuilder.CreateTable( + name: "community_comments", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + PostId = table.Column(type: "bigint", nullable: false, comment: "动态标识。"), + AuthorUserId = table.Column(type: "bigint", nullable: false, comment: "评论人。"), + Content = table.Column(type: "character varying(512)", maxLength: 512, nullable: false, comment: "评论内容。"), + ParentId = table.Column(type: "bigint", nullable: true, comment: "父级评论 ID。"), + IsDeleted = table.Column(type: "boolean", nullable: false, comment: "状态。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_community_comments", x => x.Id); + }, + comment: "社区评论。"); + + migrationBuilder.CreateTable( + name: "community_posts", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AuthorUserId = table.Column(type: "bigint", nullable: false, comment: "作者用户 ID。"), + Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "标题。"), + Content = table.Column(type: "text", nullable: false, comment: "内容。"), + MediaJson = table.Column(type: "text", nullable: true, comment: "媒体资源 JSON。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + LikeCount = table.Column(type: "integer", nullable: false, comment: "点赞数。"), + CommentCount = table.Column(type: "integer", nullable: false, comment: "评论数。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_community_posts", x => x.Id); + }, + comment: "社区动态。"); + + migrationBuilder.CreateTable( + name: "community_reactions", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + PostId = table.Column(type: "bigint", nullable: false, comment: "动态 ID。"), + UserId = table.Column(type: "bigint", nullable: false, comment: "用户 ID。"), + ReactionType = table.Column(type: "integer", nullable: false, comment: "反应类型。"), + ReactedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "时间戳。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_community_reactions", x => x.Id); + }, + comment: "社区互动反馈。"); + + migrationBuilder.CreateTable( + name: "coupon_templates", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "模板名称。"), + CouponType = table.Column(type: "integer", nullable: false, comment: "券类型。"), + Value = table.Column(type: "numeric", nullable: false, comment: "面值或折扣额度。"), + DiscountCap = table.Column(type: "numeric", nullable: true, comment: "折扣上限(针对折扣券)。"), + MinimumSpend = table.Column(type: "numeric", nullable: true, comment: "最低消费门槛。"), + ValidFrom = table.Column(type: "timestamp with time zone", nullable: true, comment: "可用开始时间。"), + ValidTo = table.Column(type: "timestamp with time zone", nullable: true, comment: "可用结束时间。"), + RelativeValidDays = table.Column(type: "integer", nullable: true, comment: "有效天数(相对发放时间)。"), + TotalQuantity = table.Column(type: "integer", nullable: true, comment: "总发放数量上限。"), + ClaimedQuantity = table.Column(type: "integer", nullable: false, comment: "已领取数量。"), + StoreScopeJson = table.Column(type: "text", nullable: true, comment: "适用门店 ID 集合(JSON)。"), + ProductScopeJson = table.Column(type: "text", nullable: true, comment: "适用品类或商品范围(JSON)。"), + ChannelsJson = table.Column(type: "text", nullable: true, comment: "发放渠道(JSON)。"), + AllowStack = table.Column(type: "boolean", nullable: false, comment: "是否允许叠加其他优惠。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_coupon_templates", x => x.Id); + }, + comment: "优惠券模板。"); + + migrationBuilder.CreateTable( + name: "coupons", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CouponTemplateId = table.Column(type: "bigint", nullable: false, comment: "模板标识。"), + Code = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "券码或序列号。"), + UserId = table.Column(type: "bigint", nullable: false, comment: "归属用户。"), + OrderId = table.Column(type: "bigint", nullable: true, comment: "订单 ID(已使用时记录)。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + IssuedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "发放时间。"), + UsedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "使用时间。"), + ExpireAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "到期时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_coupons", x => x.Id); + }, + comment: "用户领取的券。"); + + migrationBuilder.CreateTable( + name: "delivery_events", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DeliveryOrderId = table.Column(type: "bigint", nullable: false, comment: "配送单标识。"), + EventType = table.Column(type: "integer", nullable: false, comment: "事件类型。"), + Message = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "事件描述。"), + Payload = table.Column(type: "text", nullable: true, comment: "原始数据 JSON。"), + OccurredAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "发生时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_delivery_events", x => x.Id); + }, + comment: "配送状态事件流水。"); + + migrationBuilder.CreateTable( + name: "delivery_orders", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OrderId = table.Column(type: "bigint", nullable: false), + Provider = table.Column(type: "integer", nullable: false, comment: "配送服务商。"), + ProviderOrderId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "第三方配送单号。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + DeliveryFee = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "配送费。"), + CourierName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "骑手姓名。"), + CourierPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "骑手电话。"), + DispatchedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "下发时间。"), + PickedUpAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "取餐时间。"), + DeliveredAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "完成时间。"), + FailureReason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "异常原因。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_delivery_orders", x => x.Id); + }, + comment: "配送单。"); + + migrationBuilder.CreateTable( + name: "group_orders", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + ProductId = table.Column(type: "bigint", nullable: false, comment: "关联商品或套餐。"), + GroupOrderNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "拼单编号。"), + LeaderUserId = table.Column(type: "bigint", nullable: false, comment: "团长用户 ID。"), + TargetCount = table.Column(type: "integer", nullable: false, comment: "成团需要的人数。"), + CurrentCount = table.Column(type: "integer", nullable: false, comment: "当前已参与人数。"), + GroupPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "拼团价格。"), + StartAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "开始时间。"), + EndAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "结束时间。"), + Status = table.Column(type: "integer", nullable: false, comment: "拼团状态。"), + SucceededAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "成团时间。"), + CancelledAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "取消时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_group_orders", x => x.Id); + }, + comment: "拼单活动。"); + + migrationBuilder.CreateTable( + name: "group_participants", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + GroupOrderId = table.Column(type: "bigint", nullable: false, comment: "拼单活动标识。"), + OrderId = table.Column(type: "bigint", nullable: false, comment: "对应订单标识。"), + UserId = table.Column(type: "bigint", nullable: false, comment: "用户标识。"), + Status = table.Column(type: "integer", nullable: false, comment: "参与状态。"), + JoinedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "参与时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_group_participants", x => x.Id); + }, + comment: "拼单参与者。"); + + migrationBuilder.CreateTable( + name: "inventory_adjustments", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + InventoryItemId = table.Column(type: "bigint", nullable: false, comment: "对应的库存记录标识。"), + AdjustmentType = table.Column(type: "integer", nullable: false, comment: "调整类型。"), + Quantity = table.Column(type: "integer", nullable: false, comment: "调整数量,正数增加,负数减少。"), + Reason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "原因说明。"), + OperatorId = table.Column(type: "bigint", nullable: true, comment: "操作人标识。"), + OccurredAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "发生时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_inventory_adjustments", x => x.Id); + }, + comment: "库存调整记录。"); + + migrationBuilder.CreateTable( + name: "inventory_batches", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + ProductSkuId = table.Column(type: "bigint", nullable: false, comment: "SKU 标识。"), + BatchNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "批次编号。"), + ProductionDate = table.Column(type: "timestamp with time zone", nullable: true, comment: "生产日期。"), + ExpireDate = table.Column(type: "timestamp with time zone", nullable: true, comment: "过期日期。"), + Quantity = table.Column(type: "integer", nullable: false, comment: "入库数量。"), + RemainingQuantity = table.Column(type: "integer", nullable: false, comment: "剩余数量。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_inventory_batches", x => x.Id); + }, + comment: "SKU 批次信息。"); + + migrationBuilder.CreateTable( + name: "inventory_items", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + ProductSkuId = table.Column(type: "bigint", nullable: false, comment: "SKU 标识。"), + BatchNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "批次编号,可为空表示混批。"), + QuantityOnHand = table.Column(type: "integer", nullable: false, comment: "可用库存。"), + QuantityReserved = table.Column(type: "integer", nullable: false, comment: "已锁定库存(订单占用)。"), + SafetyStock = table.Column(type: "integer", nullable: true, comment: "安全库存阈值。"), + Location = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "储位或仓位信息。"), + ExpireDate = table.Column(type: "timestamp with time zone", nullable: true, comment: "过期日期。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_inventory_items", x => x.Id); + }, + comment: "SKU 在门店的库存信息。"); + + migrationBuilder.CreateTable( + name: "map_locations", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: true, comment: "关联门店 ID,可空表示独立 POI。"), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "名称。"), + Address = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "地址。"), + Longitude = table.Column(type: "double precision", nullable: false, comment: "经度。"), + Latitude = table.Column(type: "double precision", nullable: false, comment: "纬度。"), + Landmark = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "打车/导航落点描述。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_map_locations", x => x.Id); + }, + comment: "地图 POI 信息,用于门店定位和推荐。"); + + migrationBuilder.CreateTable( + name: "member_growth_logs", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MemberId = table.Column(type: "bigint", nullable: false, comment: "会员标识。"), + ChangeValue = table.Column(type: "integer", nullable: false, comment: "变动数量。"), + CurrentValue = table.Column(type: "integer", nullable: false, comment: "当前成长值。"), + Notes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"), + OccurredAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "发生时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_member_growth_logs", x => x.Id); + }, + comment: "成长值变动日志。"); + + migrationBuilder.CreateTable( + name: "member_point_ledgers", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MemberId = table.Column(type: "bigint", nullable: false, comment: "会员标识。"), + ChangeAmount = table.Column(type: "integer", nullable: false, comment: "变动数量,可为负值。"), + BalanceAfterChange = table.Column(type: "integer", nullable: false, comment: "变动后余额。"), + Reason = table.Column(type: "integer", nullable: false, comment: "变动原因。"), + SourceId = table.Column(type: "bigint", nullable: true, comment: "来源 ID(订单、活动等)。"), + OccurredAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "发生时间。"), + ExpireAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "过期时间(如适用)。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_member_point_ledgers", x => x.Id); + }, + comment: "积分变动流水。"); + + migrationBuilder.CreateTable( + name: "member_profiles", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "bigint", nullable: false, comment: "用户标识。"), + Mobile = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "手机号。"), + Nickname = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "昵称。"), + AvatarUrl = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "头像。"), + MemberTierId = table.Column(type: "bigint", nullable: true, comment: "当前会员等级 ID。"), + Status = table.Column(type: "integer", nullable: false, comment: "会员状态。"), + PointsBalance = table.Column(type: "integer", nullable: false, comment: "会员积分余额。"), + GrowthValue = table.Column(type: "integer", nullable: false, comment: "成长值/经验值。"), + BirthDate = table.Column(type: "timestamp with time zone", nullable: true, comment: "生日。"), + JoinedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "注册时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_member_profiles", x => x.Id); + }, + comment: "会员档案。"); + + migrationBuilder.CreateTable( + name: "member_tiers", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "等级名称。"), + RequiredGrowth = table.Column(type: "integer", nullable: false, comment: "所需成长值。"), + BenefitsJson = table.Column(type: "text", nullable: false, comment: "等级权益(JSON)。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序值。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_member_tiers", x => x.Id); + }, + comment: "会员等级定义。"); + + migrationBuilder.CreateTable( + name: "merchant_contracts", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MerchantId = table.Column(type: "bigint", nullable: false, comment: "所属商户标识。"), + ContractNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "合同编号。"), + Status = table.Column(type: "integer", nullable: false, comment: "合同状态。"), + StartDate = table.Column(type: "timestamp with time zone", nullable: false, comment: "合同开始时间。"), + EndDate = table.Column(type: "timestamp with time zone", nullable: false, comment: "合同结束时间。"), + FileUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: false, comment: "合同文件存储地址。"), + SignedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "签署时间。"), + TerminatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "终止时间。"), + TerminationReason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "终止原因。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_merchant_contracts", x => x.Id); + }, + comment: "商户合同记录。"); + + migrationBuilder.CreateTable( + name: "merchant_documents", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MerchantId = table.Column(type: "bigint", nullable: false, comment: "所属商户标识。"), + DocumentType = table.Column(type: "integer", nullable: false, comment: "证照类型。"), + Status = table.Column(type: "integer", nullable: false, comment: "审核状态。"), + FileUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: false, comment: "证照文件链接。"), + DocumentNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "证照编号。"), + IssuedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "签发日期。"), + ExpiresAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "到期日期。"), + Remarks = table.Column(type: "text", nullable: true, comment: "审核备注或驳回原因。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_merchant_documents", x => x.Id); + }, + comment: "商户提交的资质或证照材料。"); + + migrationBuilder.CreateTable( + name: "merchant_staff", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MerchantId = table.Column(type: "bigint", nullable: false, comment: "所属商户标识。"), + StoreId = table.Column(type: "bigint", nullable: true, comment: "可选的关联门店 ID。"), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "员工姓名。"), + Phone = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "手机号。"), + Email = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "邮箱地址。"), + IdentityUserId = table.Column(type: "bigint", nullable: true, comment: "登录账号 ID(指向统一身份体系)。"), + RoleType = table.Column(type: "integer", nullable: false, comment: "员工角色类型。"), + Status = table.Column(type: "integer", nullable: false, comment: "员工状态。"), + PermissionsJson = table.Column(type: "text", nullable: true, comment: "自定义权限(JSON)。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_merchant_staff", x => x.Id); + }, + comment: "商户员工账号,支持门店维度分配。"); + + migrationBuilder.CreateTable( + name: "merchants", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + BrandName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "品牌名称(对外展示)。"), + BrandAlias = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "品牌简称或别名。"), + LogoUrl = table.Column(type: "text", nullable: true, comment: "品牌 Logo。"), + Category = table.Column(type: "text", nullable: true, comment: "品牌所属品类,如火锅、咖啡等。"), + BusinessLicenseNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "营业执照号。"), + BusinessLicenseImageUrl = table.Column(type: "text", nullable: true, comment: "营业执照扫描件地址。"), + TaxNumber = table.Column(type: "text", nullable: true, comment: "税号/统一社会信用代码。"), + LegalPerson = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "法人或负责人姓名。"), + ContactPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "联系电话。"), + ContactEmail = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "联系邮箱。"), + ServicePhone = table.Column(type: "text", nullable: true, comment: "客服电话。"), + SupportEmail = table.Column(type: "text", nullable: true, comment: "客服邮箱。"), + Province = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在省份。"), + City = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在城市。"), + District = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在区县。"), + Address = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "详细地址。"), + Longitude = table.Column(type: "double precision", nullable: true, comment: "经度信息。"), + Latitude = table.Column(type: "double precision", nullable: true, comment: "纬度信息。"), + Status = table.Column(type: "integer", nullable: false, comment: "入驻状态。"), + ReviewRemarks = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "审核备注或驳回原因。"), + JoinedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "入驻时间。"), + LastReviewedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次审核时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_merchants", x => x.Id); + }, + comment: "商户主体信息,承载入驻和资质审核结果。"); + + migrationBuilder.CreateTable( + name: "metric_alert_rules", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MetricDefinitionId = table.Column(type: "bigint", nullable: false, comment: "关联指标。"), + ConditionJson = table.Column(type: "text", nullable: false, comment: "触发条件 JSON。"), + Severity = table.Column(type: "integer", nullable: false, comment: "告警级别。"), + NotificationChannels = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "通知渠道。"), + Enabled = table.Column(type: "boolean", nullable: false, comment: "是否启用。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_metric_alert_rules", x => x.Id); + }, + comment: "指标告警规则。"); + + migrationBuilder.CreateTable( + name: "metric_definitions", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Code = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "指标编码。"), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "指标名称。"), + Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "说明。"), + DimensionsJson = table.Column(type: "text", nullable: true, comment: "维度描述 JSON。"), + DefaultAggregation = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "默认聚合方式。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_metric_definitions", x => x.Id); + }, + comment: "指标定义,描述可观测的数据点。"); + + migrationBuilder.CreateTable( + name: "metric_snapshots", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MetricDefinitionId = table.Column(type: "bigint", nullable: false, comment: "指标定义 ID。"), + DimensionKey = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "维度键(JSON)。"), + WindowStart = table.Column(type: "timestamp with time zone", nullable: false, comment: "统计时间窗口开始。"), + WindowEnd = table.Column(type: "timestamp with time zone", nullable: false, comment: "统计时间窗口结束。"), + Value = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false, comment: "数值。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_metric_snapshots", x => x.Id); + }, + comment: "指标快照,用于大盘展示。"); + + migrationBuilder.CreateTable( + name: "navigation_requests", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "bigint", nullable: false, comment: "用户 ID。"), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店 ID。"), + Channel = table.Column(type: "integer", nullable: false, comment: "来源通道(小程序、H5 等)。"), + TargetApp = table.Column(type: "integer", nullable: false, comment: "跳转的地图应用。"), + RequestedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "请求时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_navigation_requests", x => x.Id); + }, + comment: "用户发起的导航请求日志。"); + + migrationBuilder.CreateTable( + name: "order_status_histories", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OrderId = table.Column(type: "bigint", nullable: false, comment: "订单标识。"), + Status = table.Column(type: "integer", nullable: false, comment: "变更后的状态。"), + OperatorId = table.Column(type: "bigint", nullable: true, comment: "操作人标识(可为空表示系统)。"), + Notes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注信息。"), + OccurredAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "发生时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_order_status_histories", x => x.Id); + }, + comment: "订单状态流转记录。"); + + migrationBuilder.CreateTable( + name: "orders", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OrderNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "订单号。"), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店。"), + Channel = table.Column(type: "integer", nullable: false, comment: "下单渠道。"), + DeliveryType = table.Column(type: "integer", nullable: false, comment: "履约类型。"), + Status = table.Column(type: "integer", nullable: false, comment: "当前状态。"), + PaymentStatus = table.Column(type: "integer", nullable: false, comment: "支付状态。"), + CustomerName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "顾客姓名。"), + CustomerPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "顾客手机号。"), + TableNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "就餐桌号。"), + QueueNumber = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "排队号(如有)。"), + ReservationId = table.Column(type: "bigint", nullable: true, comment: "预约 ID。"), + ItemsAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "商品总额。"), + DiscountAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "优惠金额。"), + PayableAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "应付金额。"), + PaidAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "实付金额。"), + PaidAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "支付时间。"), + FinishedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "完成时间。"), + CancelledAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "取消时间。"), + CancelReason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "取消原因。"), + Remark = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_orders", x => x.Id); + }, + comment: "交易订单。"); + + migrationBuilder.CreateTable( + name: "payment_records", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OrderId = table.Column(type: "bigint", nullable: false, comment: "关联订单。"), + Method = table.Column(type: "integer", nullable: false, comment: "支付方式。"), + Status = table.Column(type: "integer", nullable: false, comment: "支付状态。"), + Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "支付金额。"), + TradeNo = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "平台交易号。"), + ChannelTransactionId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "第三方渠道单号。"), + PaidAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "支付完成时间。"), + Remark = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "错误/备注。"), + Payload = table.Column(type: "text", nullable: true, comment: "原始回调内容。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_payment_records", x => x.Id); + }, + comment: "支付流水。"); + + migrationBuilder.CreateTable( + name: "payment_refund_records", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + PaymentRecordId = table.Column(type: "bigint", nullable: false, comment: "原支付记录标识。"), + OrderId = table.Column(type: "bigint", nullable: false, comment: "关联订单标识。"), + Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "退款金额。"), + ChannelRefundId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "渠道退款流水号。"), + Status = table.Column(type: "integer", nullable: false, comment: "退款状态。"), + RequestedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "退款请求时间。"), + CompletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "完成时间。"), + Payload = table.Column(type: "text", nullable: true, comment: "渠道返回的原始数据 JSON。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_payment_refund_records", x => x.Id); + }, + comment: "支付渠道退款流水。"); + + migrationBuilder.CreateTable( + name: "product_addon_groups", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ProductId = table.Column(type: "bigint", nullable: false, comment: "所属商品。"), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分组名称。"), + SelectionType = table.Column(type: "integer", nullable: false, comment: "选择类型。"), + MinSelect = table.Column(type: "integer", nullable: true, comment: "最小选择数量。"), + MaxSelect = table.Column(type: "integer", nullable: true, comment: "最大选择数量。"), + IsRequired = table.Column(type: "boolean", nullable: false, comment: "是否必选。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序值。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_product_addon_groups", x => x.Id); + }, + comment: "加料/做法分组。"); + + migrationBuilder.CreateTable( + name: "product_addon_options", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AddonGroupId = table.Column(type: "bigint", nullable: false, comment: "所属加料分组。"), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "选项名称。"), + ExtraPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "附加价格。"), + IsDefault = table.Column(type: "boolean", nullable: false, comment: "是否默认选项。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_product_addon_options", x => x.Id); + }, + comment: "加料选项。"); + + migrationBuilder.CreateTable( + name: "product_attribute_groups", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: true, comment: "关联门店,可为空表示所有门店共享。"), + ProductId = table.Column(type: "bigint", nullable: false, comment: "所属商品标识。"), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分组名称,例如“辣度”“份量”。"), + SelectionType = table.Column(type: "integer", nullable: false, comment: "选择类型(单选/多选)。"), + IsRequired = table.Column(type: "boolean", nullable: false, comment: "是否必选。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "显示排序。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_product_attribute_groups", x => x.Id); + }, + comment: "商品规格/属性分组。"); + + migrationBuilder.CreateTable( + name: "product_attribute_options", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AttributeGroupId = table.Column(type: "bigint", nullable: false, comment: "所属规格组。"), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "选项名称。"), + ExtraPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "附加价格。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序。"), + IsDefault = table.Column(type: "boolean", nullable: false, comment: "是否默认选中。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_product_attribute_options", x => x.Id); + }, + comment: "商品规格选项。"); + + migrationBuilder.CreateTable( + name: "product_categories", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "所属门店。"), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分类名称。"), + Description = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "分类描述。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序值。"), + IsEnabled = table.Column(type: "boolean", nullable: false, comment: "是否启用。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_product_categories", x => x.Id); + }, + comment: "商品分类。"); + + migrationBuilder.CreateTable( + name: "product_media_assets", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ProductId = table.Column(type: "bigint", nullable: false, comment: "商品标识。"), + MediaType = table.Column(type: "integer", nullable: false, comment: "媒体类型。"), + Url = table.Column(type: "character varying(512)", maxLength: 512, nullable: false, comment: "媒资链接。"), + Caption = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "描述或标题。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_product_media_assets", x => x.Id); + }, + comment: "商品媒资素材。"); + + migrationBuilder.CreateTable( + name: "product_pricing_rules", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ProductId = table.Column(type: "bigint", nullable: false, comment: "所属商品。"), + RuleType = table.Column(type: "integer", nullable: false, comment: "策略类型。"), + ConditionsJson = table.Column(type: "text", nullable: false, comment: "条件描述(JSON),如会员等级、渠道等。"), + Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "特殊价格。"), + StartTime = table.Column(type: "timestamp with time zone", nullable: true, comment: "生效开始时间。"), + EndTime = table.Column(type: "timestamp with time zone", nullable: true, comment: "生效结束时间。"), + WeekdaysJson = table.Column(type: "text", nullable: true, comment: "生效星期(JSON 数组)。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序值。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_product_pricing_rules", x => x.Id); + }, + comment: "商品价格策略,支持会员价/时段价等。"); + + migrationBuilder.CreateTable( + name: "product_skus", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ProductId = table.Column(type: "bigint", nullable: false, comment: "所属商品标识。"), + SkuCode = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "SKU 编码。"), + Barcode = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "条形码。"), + Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "售价。"), + OriginalPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "原价。"), + StockQuantity = table.Column(type: "integer", nullable: true, comment: "可售库存。"), + Weight = table.Column(type: "numeric(10,3)", precision: 10, scale: 3, nullable: true, comment: "重量(千克)。"), + AttributesJson = table.Column(type: "text", nullable: false, comment: "规格属性 JSON(记录选项 ID)。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序值。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_product_skus", x => x.Id); + }, + comment: "商品 SKU,记录具体规格组合价格。"); + + migrationBuilder.CreateTable( + name: "products", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "所属门店。"), + CategoryId = table.Column(type: "bigint", nullable: false, comment: "所属分类。"), + SpuCode = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "商品编码。"), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "商品名称。"), + Subtitle = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "副标题/卖点。"), + Unit = table.Column(type: "character varying(16)", maxLength: 16, nullable: true, comment: "售卖单位(份/杯等)。"), + Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "现价。"), + OriginalPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "原价。"), + StockQuantity = table.Column(type: "integer", nullable: true, comment: "库存数量(可选)。"), + MaxQuantityPerOrder = table.Column(type: "integer", nullable: true, comment: "最大每单限购。"), + Status = table.Column(type: "integer", nullable: false, comment: "商品状态。"), + CoverImage = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "主图。"), + GalleryImages = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true, comment: "Gallery 图片逗号分隔。"), + Description = table.Column(type: "text", nullable: true, comment: "商品描述。"), + EnableDineIn = table.Column(type: "boolean", nullable: false, comment: "支持堂食。"), + EnablePickup = table.Column(type: "boolean", nullable: false, comment: "支持自提。"), + EnableDelivery = table.Column(type: "boolean", nullable: false, comment: "支持配送。"), + IsFeatured = table.Column(type: "boolean", nullable: false, comment: "是否热门推荐。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_products", x => x.Id); + }, + comment: "商品(SPU)信息。"); + + migrationBuilder.CreateTable( + name: "promotion_campaigns", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "活动名称。"), + PromotionType = table.Column(type: "integer", nullable: false, comment: "活动类型。"), + Status = table.Column(type: "integer", nullable: false, comment: "活动状态。"), + StartAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "开始时间。"), + EndAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "结束时间。"), + Budget = table.Column(type: "numeric", nullable: true, comment: "预算金额。"), + RulesJson = table.Column(type: "text", nullable: false, comment: "活动规则 JSON。"), + AudienceDescription = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "目标人群描述。"), + BannerUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "营销素材(如 banner)。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_promotion_campaigns", x => x.Id); + }, + comment: "营销活动配置。"); + + migrationBuilder.CreateTable( + name: "queue_tickets", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false), + TicketNumber = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "排队编号。"), + PartySize = table.Column(type: "integer", nullable: false, comment: "就餐人数。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + EstimatedWaitMinutes = table.Column(type: "integer", nullable: true, comment: "预计等待分钟。"), + CalledAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "叫号时间。"), + ExpiredAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "过号时间。"), + CancelledAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "取消时间。"), + Remark = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_queue_tickets", x => x.Id); + }, + comment: "排队叫号。"); + + migrationBuilder.CreateTable( + name: "refund_requests", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OrderId = table.Column(type: "bigint", nullable: false, comment: "关联订单标识。"), + RefundNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "退款单号。"), + Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "申请金额。"), + Reason = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "申请原因。"), + Status = table.Column(type: "integer", nullable: false, comment: "退款状态。"), + RequestedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "用户提交时间。"), + ProcessedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "审核完成时间。"), + ReviewNotes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "审核备注。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_refund_requests", x => x.Id); + }, + comment: "售后/退款申请。"); + + migrationBuilder.CreateTable( + name: "reservations", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店。"), + ReservationNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "预约号。"), + CustomerName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "客户姓名。"), + CustomerPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "联系电话。"), + PeopleCount = table.Column(type: "integer", nullable: false, comment: "用餐人数。"), + ReservationTime = table.Column(type: "timestamp with time zone", nullable: false, comment: "预约时间(UTC)。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + TablePreference = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "桌型/标签。"), + Remark = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注。"), + CheckInCode = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "核销码/到店码。"), + CheckedInAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "实际签到时间。"), + CancelledAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "取消时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_reservations", x => x.Id); + }, + comment: "预约/预订记录。"); + + migrationBuilder.CreateTable( + name: "shopping_carts", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "bigint", nullable: false, comment: "用户标识。"), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + Status = table.Column(type: "integer", nullable: false, comment: "购物车状态,包含正常/锁定。"), + TableContext = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "桌码或场景标识(扫码点餐)。"), + DeliveryPreference = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "履约方式(堂食/自提/配送)缓存。"), + LastModifiedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "最近一次修改时间(UTC)。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_shopping_carts", x => x.Id); + }, + comment: "用户购物车,按租户/门店隔离。"); + + migrationBuilder.CreateTable( + name: "store_business_hours", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + DayOfWeek = table.Column(type: "integer", nullable: false, comment: "星期几,0 表示周日。"), + HourType = table.Column(type: "integer", nullable: false, comment: "时段类型(正常营业、休息、预约等)。"), + StartTime = table.Column(type: "interval", nullable: false, comment: "开始时间(本地时间)。"), + EndTime = table.Column(type: "interval", nullable: false, comment: "结束时间(本地时间)。"), + CapacityLimit = table.Column(type: "integer", nullable: true, comment: "最大接待容量或单量限制。"), + Notes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_store_business_hours", x => x.Id); + }, + comment: "门店营业时段配置。"); + + migrationBuilder.CreateTable( + name: "store_delivery_zones", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + ZoneName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "区域名称。"), + PolygonGeoJson = table.Column(type: "text", nullable: false, comment: "GeoJSON 表示的多边形范围。"), + MinimumOrderAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "起送价。"), + DeliveryFee = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "配送费。"), + EstimatedMinutes = table.Column(type: "integer", nullable: true, comment: "预计送达分钟。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序值。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_store_delivery_zones", x => x.Id); + }, + comment: "门店配送范围配置。"); + + migrationBuilder.CreateTable( + name: "store_employee_shifts", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + StaffId = table.Column(type: "bigint", nullable: false, comment: "员工标识。"), + ShiftDate = table.Column(type: "timestamp with time zone", nullable: false, comment: "班次日期。"), + StartTime = table.Column(type: "interval", nullable: false, comment: "开始时间。"), + EndTime = table.Column(type: "interval", nullable: false, comment: "结束时间。"), + RoleType = table.Column(type: "integer", nullable: false, comment: "排班角色。"), + Notes = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_store_employee_shifts", x => x.Id); + }, + comment: "门店员工排班记录。"); + + migrationBuilder.CreateTable( + name: "store_holidays", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + Date = table.Column(type: "timestamp with time zone", nullable: false, comment: "日期。"), + IsClosed = table.Column(type: "boolean", nullable: false, comment: "是否全天闭店。"), + Reason = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "说明内容。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_store_holidays", x => x.Id); + }, + comment: "门店休息日或特殊营业日。"); + + migrationBuilder.CreateTable( + name: "store_table_areas", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "区域名称。"), + Description = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "区域描述。"), + SortOrder = table.Column(type: "integer", nullable: false, comment: "排序值。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_store_table_areas", x => x.Id); + }, + comment: "门店桌台区域配置。"); + + migrationBuilder.CreateTable( + name: "store_tables", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), + AreaId = table.Column(type: "bigint", nullable: true, comment: "所在区域 ID。"), + TableCode = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "桌码。"), + Capacity = table.Column(type: "integer", nullable: false, comment: "可容纳人数。"), + Tags = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "桌台标签(堂食、快餐等)。"), + Status = table.Column(type: "integer", nullable: false, comment: "当前桌台状态。"), + QrCodeUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "桌码二维码地址。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_store_tables", x => x.Id); + }, + comment: "桌台信息与二维码绑定。"); + + migrationBuilder.CreateTable( + name: "stores", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MerchantId = table.Column(type: "bigint", nullable: false, comment: "所属商户标识。"), + Code = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "门店编码,便于扫码及外部对接。"), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "门店名称。"), + Phone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "联系电话。"), + ManagerName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "门店负责人姓名。"), + Status = table.Column(type: "integer", nullable: false, comment: "门店当前运营状态。"), + Country = table.Column(type: "text", nullable: true, comment: "所在国家或地区。"), + Province = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在省份。"), + City = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在城市。"), + District = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "区县信息。"), + Address = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "详细地址。"), + Longitude = table.Column(type: "double precision", nullable: true, comment: "高德/腾讯地图经度。"), + Latitude = table.Column(type: "double precision", nullable: true, comment: "纬度。"), + Description = table.Column(type: "text", nullable: true, comment: "门店描述或公告。"), + BusinessHours = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "门店营业时段描述(备用字符串)。"), + SupportsDineIn = table.Column(type: "boolean", nullable: false, comment: "是否支持堂食。"), + SupportsPickup = table.Column(type: "boolean", nullable: false, comment: "是否支持自提。"), + SupportsDelivery = table.Column(type: "boolean", nullable: false, comment: "是否支持配送。"), + SupportsReservation = table.Column(type: "boolean", nullable: false, comment: "支持预约。"), + SupportsQueueing = table.Column(type: "boolean", nullable: false, comment: "支持排队叫号。"), + DeliveryRadiusKm = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false, comment: "默认配送半径(公里)。"), + Announcement = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "门店公告。"), + Tags = table.Column(type: "text", nullable: true, comment: "门店标签(逗号分隔)。"), + CoverImageUrl = table.Column(type: "text", nullable: true, comment: "门店海报。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_stores", x => x.Id); + }, + comment: "门店信息,承载营业配置与能力。"); + + migrationBuilder.CreateTable( + name: "support_tickets", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + TicketNo = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "工单编号。"), + CustomerUserId = table.Column(type: "bigint", nullable: false, comment: "客户用户 ID。"), + OrderId = table.Column(type: "bigint", nullable: true, comment: "关联订单(如有)。"), + Subject = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "工单主题。"), + Description = table.Column(type: "text", nullable: false, comment: "工单详情。"), + Priority = table.Column(type: "integer", nullable: false, comment: "优先级。"), + Status = table.Column(type: "integer", nullable: false, comment: "状态。"), + AssignedAgentId = table.Column(type: "bigint", nullable: true, comment: "指派的客服。"), + ClosedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "关闭时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_support_tickets", x => x.Id); + }, + comment: "客服工单。"); + + migrationBuilder.CreateTable( + name: "tenant_billing_statements", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StatementNo = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "账单编号,供对账查询。"), + PeriodStart = table.Column(type: "timestamp with time zone", nullable: false, comment: "账单周期开始时间。"), + PeriodEnd = table.Column(type: "timestamp with time zone", nullable: false, comment: "账单周期结束时间。"), + AmountDue = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "应付金额。"), + AmountPaid = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "实付金额。"), + Status = table.Column(type: "integer", nullable: false, comment: "当前付款状态。"), + DueDate = table.Column(type: "timestamp with time zone", nullable: false, comment: "到期日。"), + LineItemsJson = table.Column(type: "text", nullable: true, comment: "账单明细 JSON,记录各项费用。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_tenant_billing_statements", x => x.Id); + }, + comment: "租户账单,用于呈现周期性收费。"); + + migrationBuilder.CreateTable( + name: "tenant_notifications", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "通知标题。"), + Message = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "通知正文。"), + Channel = table.Column(type: "integer", nullable: false, comment: "发布通道(站内、邮件、短信等)。"), + Severity = table.Column(type: "integer", nullable: false, comment: "通知重要级别。"), + SentAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "推送时间。"), + ReadAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "租户是否已阅读。"), + MetadataJson = table.Column(type: "text", nullable: true, comment: "附加元数据 JSON。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_tenant_notifications", x => x.Id); + }, + comment: "面向租户的站内通知或消息推送。"); + + migrationBuilder.CreateTable( + name: "tenant_packages", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "套餐名称,展示给租户的简称。"), + Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "套餐描述,包含适用场景、权益等。"), + PackageType = table.Column(type: "integer", nullable: false, comment: "套餐分类(试用、标准、旗舰等)。"), + MonthlyPrice = table.Column(type: "numeric", nullable: true, comment: "月付价格,单位:人民币元。"), + YearlyPrice = table.Column(type: "numeric", nullable: true, comment: "年付价格,单位:人民币元。"), + MaxStoreCount = table.Column(type: "integer", nullable: true, comment: "允许的最大门店数。"), + MaxAccountCount = table.Column(type: "integer", nullable: true, comment: "允许创建的最大账号数。"), + MaxStorageGb = table.Column(type: "integer", nullable: true, comment: "存储容量上限(GB)。"), + MaxSmsCredits = table.Column(type: "integer", nullable: true, comment: "每月短信额度上限。"), + MaxDeliveryOrders = table.Column(type: "integer", nullable: true, comment: "每月可调用的配送单数量上限。"), + FeaturePoliciesJson = table.Column(type: "text", nullable: true, comment: "权益明细 JSON,记录自定义特性开关。"), + IsActive = table.Column(type: "boolean", nullable: false, comment: "是否仍可售卖。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。") + }, + constraints: table => + { + table.PrimaryKey("PK_tenant_packages", x => x.Id); + }, + comment: "平台提供的租户套餐定义。"); + + migrationBuilder.CreateTable( + name: "tenant_quota_usages", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + QuotaType = table.Column(type: "integer", nullable: false, comment: "配额类型,例如门店数、短信条数等。"), + LimitValue = table.Column(type: "numeric", nullable: false, comment: "当前配额上限。"), + UsedValue = table.Column(type: "numeric", nullable: false, comment: "已消耗的数量。"), + ResetCycle = table.Column(type: "text", nullable: true, comment: "配额刷新周期描述(如月、年)。"), + LastResetAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次重置时间。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_tenant_quota_usages", x => x.Id); + }, + comment: "租户配额使用情况快照。"); + + migrationBuilder.CreateTable( + name: "tenant_subscriptions", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + TenantPackageId = table.Column(type: "bigint", nullable: false, comment: "当前订阅关联的套餐标识。"), + EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: false, comment: "订阅生效时间(UTC)。"), + EffectiveTo = table.Column(type: "timestamp with time zone", nullable: false, comment: "订阅到期时间(UTC)。"), + NextBillingDate = table.Column(type: "timestamp with time zone", nullable: true, comment: "下一个计费时间,配合自动续费使用。"), + Status = table.Column(type: "integer", nullable: false, comment: "订阅当前状态。"), + AutoRenew = table.Column(type: "boolean", nullable: false, comment: "是否开启自动续费。"), + ScheduledPackageId = table.Column(type: "bigint", nullable: true, comment: "若已排期升降配,对应的新套餐 ID。"), + Notes = table.Column(type: "text", nullable: true, comment: "运营备注信息。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_tenant_subscriptions", x => x.Id); + }, + comment: "租户套餐订阅记录。"); + + migrationBuilder.CreateTable( + name: "tenants", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Code = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "租户短编码,作为跨系统引用的唯一标识。"), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "租户全称或品牌名称。"), + ShortName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "对外展示的简称。"), + LegalEntityName = table.Column(type: "text", nullable: true, comment: "法人或公司主体名称。"), + Industry = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所属行业,如餐饮、零售等。"), + LogoUrl = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "LOGO 图片地址。"), + CoverImageUrl = table.Column(type: "text", nullable: true, comment: "品牌海报或封面图。"), + Website = table.Column(type: "text", nullable: true, comment: "官网或主要宣传链接。"), + Country = table.Column(type: "text", nullable: true, comment: "所在国家/地区。"), + Province = table.Column(type: "text", nullable: true, comment: "所在省份或州。"), + City = table.Column(type: "text", nullable: true, comment: "所在城市。"), + Address = table.Column(type: "text", nullable: true, comment: "详细地址信息。"), + ContactName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "主联系人姓名。"), + ContactPhone = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "主联系人电话。"), + ContactEmail = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "主联系人邮箱。"), + PrimaryOwnerUserId = table.Column(type: "bigint", nullable: true, comment: "系统内对应的租户所有者账号 ID。"), + Status = table.Column(type: "integer", nullable: false, comment: "租户当前状态,涵盖审核、启用、停用等场景。"), + EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: true, comment: "服务生效时间(UTC)。"), + EffectiveTo = table.Column(type: "timestamp with time zone", nullable: true, comment: "服务到期时间(UTC)。"), + SuspendedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次暂停服务时间。"), + SuspensionReason = table.Column(type: "text", nullable: true, comment: "暂停或终止的原因说明。"), + Tags = table.Column(type: "text", nullable: true, comment: "业务标签集合(逗号分隔)。"), + Remarks = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注信息,用于运营记录特殊说明。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。") + }, + constraints: table => + { + table.PrimaryKey("PK_tenants", x => x.Id); + }, + comment: "平台租户信息,描述租户的生命周期与基础资料。"); + + migrationBuilder.CreateTable( + name: "ticket_comments", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + SupportTicketId = table.Column(type: "bigint", nullable: false, comment: "工单标识。"), + AuthorUserId = table.Column(type: "bigint", nullable: true, comment: "评论人 ID。"), + Content = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "评论内容。"), + IsInternal = table.Column(type: "boolean", nullable: false, comment: "是否内部备注。"), + AttachmentsJson = table.Column(type: "text", nullable: true, comment: "附件 JSON。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_ticket_comments", x => x.Id); + }, + comment: "工单评论/流转记录。"); + + migrationBuilder.CreateTable( + name: "order_items", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OrderId = table.Column(type: "bigint", nullable: false, comment: "订单 ID。"), + ProductId = table.Column(type: "bigint", nullable: false, comment: "商品 ID。"), + ProductName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "商品名称。"), + SkuName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "SKU/规格描述。"), + Unit = table.Column(type: "character varying(16)", maxLength: 16, nullable: true, comment: "单位。"), + Quantity = table.Column(type: "integer", nullable: false, comment: "数量。"), + UnitPrice = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "单价。"), + DiscountAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "折扣金额。"), + SubTotal = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "小计。"), + AttributesJson = table.Column(type: "text", nullable: true, comment: "自定义属性 JSON。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_order_items", x => x.Id); + table.ForeignKey( + name: "FK_order_items_orders_OrderId", + column: x => x.OrderId, + principalTable: "orders", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "订单明细。"); + + migrationBuilder.CreateIndex( + name: "IX_affiliate_orders_TenantId_AffiliatePartnerId_OrderId", + table: "affiliate_orders", + columns: new[] { "TenantId", "AffiliatePartnerId", "OrderId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_affiliate_partners_TenantId_DisplayName", + table: "affiliate_partners", + columns: new[] { "TenantId", "DisplayName" }); + + migrationBuilder.CreateIndex( + name: "IX_affiliate_payouts_TenantId_AffiliatePartnerId_Period", + table: "affiliate_payouts", + columns: new[] { "TenantId", "AffiliatePartnerId", "Period" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_cart_items_TenantId_ShoppingCartId", + table: "cart_items", + columns: new[] { "TenantId", "ShoppingCartId" }); + + migrationBuilder.CreateIndex( + name: "IX_chat_messages_TenantId_ChatSessionId_CreatedAt", + table: "chat_messages", + columns: new[] { "TenantId", "ChatSessionId", "CreatedAt" }); + + migrationBuilder.CreateIndex( + name: "IX_chat_sessions_TenantId_SessionCode", + table: "chat_sessions", + columns: new[] { "TenantId", "SessionCode" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_checkin_campaigns_TenantId_Name", + table: "checkin_campaigns", + columns: new[] { "TenantId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_checkin_records_TenantId_CheckInCampaignId_UserId_CheckInDa~", + table: "checkin_records", + columns: new[] { "TenantId", "CheckInCampaignId", "UserId", "CheckInDate" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_checkout_sessions_TenantId_SessionToken", + table: "checkout_sessions", + columns: new[] { "TenantId", "SessionToken" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_community_comments_TenantId_PostId_CreatedAt", + table: "community_comments", + columns: new[] { "TenantId", "PostId", "CreatedAt" }); + + migrationBuilder.CreateIndex( + name: "IX_community_posts_TenantId_AuthorUserId_CreatedAt", + table: "community_posts", + columns: new[] { "TenantId", "AuthorUserId", "CreatedAt" }); + + migrationBuilder.CreateIndex( + name: "IX_community_reactions_TenantId_PostId_UserId", + table: "community_reactions", + columns: new[] { "TenantId", "PostId", "UserId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_coupons_TenantId_Code", + table: "coupons", + columns: new[] { "TenantId", "Code" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_delivery_events_TenantId_DeliveryOrderId_EventType", + table: "delivery_events", + columns: new[] { "TenantId", "DeliveryOrderId", "EventType" }); + + migrationBuilder.CreateIndex( + name: "IX_delivery_orders_TenantId_OrderId", + table: "delivery_orders", + columns: new[] { "TenantId", "OrderId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_group_orders_TenantId_GroupOrderNo", + table: "group_orders", + columns: new[] { "TenantId", "GroupOrderNo" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_group_participants_TenantId_GroupOrderId_UserId", + table: "group_participants", + columns: new[] { "TenantId", "GroupOrderId", "UserId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_inventory_adjustments_TenantId_InventoryItemId_OccurredAt", + table: "inventory_adjustments", + columns: new[] { "TenantId", "InventoryItemId", "OccurredAt" }); + + migrationBuilder.CreateIndex( + name: "IX_inventory_batches_TenantId_StoreId_ProductSkuId_BatchNumber", + table: "inventory_batches", + columns: new[] { "TenantId", "StoreId", "ProductSkuId", "BatchNumber" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_inventory_items_TenantId_StoreId_ProductSkuId_BatchNumber", + table: "inventory_items", + columns: new[] { "TenantId", "StoreId", "ProductSkuId", "BatchNumber" }); + + migrationBuilder.CreateIndex( + name: "IX_map_locations_TenantId_StoreId", + table: "map_locations", + columns: new[] { "TenantId", "StoreId" }); + + migrationBuilder.CreateIndex( + name: "IX_member_growth_logs_TenantId_MemberId_OccurredAt", + table: "member_growth_logs", + columns: new[] { "TenantId", "MemberId", "OccurredAt" }); + + migrationBuilder.CreateIndex( + name: "IX_member_point_ledgers_TenantId_MemberId_OccurredAt", + table: "member_point_ledgers", + columns: new[] { "TenantId", "MemberId", "OccurredAt" }); + + migrationBuilder.CreateIndex( + name: "IX_member_profiles_TenantId_Mobile", + table: "member_profiles", + columns: new[] { "TenantId", "Mobile" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_member_tiers_TenantId_Name", + table: "member_tiers", + columns: new[] { "TenantId", "Name" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_merchant_contracts_TenantId_MerchantId_ContractNumber", + table: "merchant_contracts", + columns: new[] { "TenantId", "MerchantId", "ContractNumber" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_merchant_documents_TenantId_MerchantId_DocumentType", + table: "merchant_documents", + columns: new[] { "TenantId", "MerchantId", "DocumentType" }); + + migrationBuilder.CreateIndex( + name: "IX_merchant_staff_TenantId_MerchantId_Phone", + table: "merchant_staff", + columns: new[] { "TenantId", "MerchantId", "Phone" }); + + migrationBuilder.CreateIndex( + name: "IX_merchants_TenantId", + table: "merchants", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_metric_alert_rules_TenantId_MetricDefinitionId_Severity", + table: "metric_alert_rules", + columns: new[] { "TenantId", "MetricDefinitionId", "Severity" }); + + migrationBuilder.CreateIndex( + name: "IX_metric_definitions_TenantId_Code", + table: "metric_definitions", + columns: new[] { "TenantId", "Code" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_metric_snapshots_TenantId_MetricDefinitionId_DimensionKey_W~", + table: "metric_snapshots", + columns: new[] { "TenantId", "MetricDefinitionId", "DimensionKey", "WindowStart", "WindowEnd" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_navigation_requests_TenantId_UserId_StoreId_RequestedAt", + table: "navigation_requests", + columns: new[] { "TenantId", "UserId", "StoreId", "RequestedAt" }); + + migrationBuilder.CreateIndex( + name: "IX_order_items_OrderId", + table: "order_items", + column: "OrderId"); + + migrationBuilder.CreateIndex( + name: "IX_order_items_TenantId_OrderId", + table: "order_items", + columns: new[] { "TenantId", "OrderId" }); + + migrationBuilder.CreateIndex( + name: "IX_order_status_histories_TenantId_OrderId_OccurredAt", + table: "order_status_histories", + columns: new[] { "TenantId", "OrderId", "OccurredAt" }); + + migrationBuilder.CreateIndex( + name: "IX_orders_TenantId_OrderNo", + table: "orders", + columns: new[] { "TenantId", "OrderNo" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_orders_TenantId_StoreId_Status", + table: "orders", + columns: new[] { "TenantId", "StoreId", "Status" }); + + migrationBuilder.CreateIndex( + name: "IX_payment_records_TenantId_OrderId", + table: "payment_records", + columns: new[] { "TenantId", "OrderId" }); + + migrationBuilder.CreateIndex( + name: "IX_payment_refund_records_TenantId_PaymentRecordId", + table: "payment_refund_records", + columns: new[] { "TenantId", "PaymentRecordId" }); + + migrationBuilder.CreateIndex( + name: "IX_product_addon_groups_TenantId_ProductId_Name", + table: "product_addon_groups", + columns: new[] { "TenantId", "ProductId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_product_attribute_groups_TenantId_StoreId_Name", + table: "product_attribute_groups", + columns: new[] { "TenantId", "StoreId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_product_attribute_options_TenantId_AttributeGroupId_Name", + table: "product_attribute_options", + columns: new[] { "TenantId", "AttributeGroupId", "Name" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_product_categories_TenantId_StoreId", + table: "product_categories", + columns: new[] { "TenantId", "StoreId" }); + + migrationBuilder.CreateIndex( + name: "IX_product_pricing_rules_TenantId_ProductId_RuleType", + table: "product_pricing_rules", + columns: new[] { "TenantId", "ProductId", "RuleType" }); + + migrationBuilder.CreateIndex( + name: "IX_product_skus_TenantId_SkuCode", + table: "product_skus", + columns: new[] { "TenantId", "SkuCode" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_products_TenantId_SpuCode", + table: "products", + columns: new[] { "TenantId", "SpuCode" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_products_TenantId_StoreId", + table: "products", + columns: new[] { "TenantId", "StoreId" }); + + migrationBuilder.CreateIndex( + name: "IX_queue_tickets_TenantId_StoreId", + table: "queue_tickets", + columns: new[] { "TenantId", "StoreId" }); + + migrationBuilder.CreateIndex( + name: "IX_queue_tickets_TenantId_StoreId_TicketNumber", + table: "queue_tickets", + columns: new[] { "TenantId", "StoreId", "TicketNumber" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_refund_requests_TenantId_RefundNo", + table: "refund_requests", + columns: new[] { "TenantId", "RefundNo" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_reservations_TenantId_ReservationNo", + table: "reservations", + columns: new[] { "TenantId", "ReservationNo" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_reservations_TenantId_StoreId", + table: "reservations", + columns: new[] { "TenantId", "StoreId" }); + + migrationBuilder.CreateIndex( + name: "IX_shopping_carts_TenantId_UserId_StoreId", + table: "shopping_carts", + columns: new[] { "TenantId", "UserId", "StoreId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_store_business_hours_TenantId_StoreId_DayOfWeek", + table: "store_business_hours", + columns: new[] { "TenantId", "StoreId", "DayOfWeek" }); + + migrationBuilder.CreateIndex( + name: "IX_store_delivery_zones_TenantId_StoreId_ZoneName", + table: "store_delivery_zones", + columns: new[] { "TenantId", "StoreId", "ZoneName" }); + + migrationBuilder.CreateIndex( + name: "IX_store_employee_shifts_TenantId_StoreId_ShiftDate_StaffId", + table: "store_employee_shifts", + columns: new[] { "TenantId", "StoreId", "ShiftDate", "StaffId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_store_holidays_TenantId_StoreId_Date", + table: "store_holidays", + columns: new[] { "TenantId", "StoreId", "Date" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_store_table_areas_TenantId_StoreId_Name", + table: "store_table_areas", + columns: new[] { "TenantId", "StoreId", "Name" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_store_tables_TenantId_StoreId_TableCode", + table: "store_tables", + columns: new[] { "TenantId", "StoreId", "TableCode" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_stores_TenantId_Code", + table: "stores", + columns: new[] { "TenantId", "Code" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_stores_TenantId_MerchantId", + table: "stores", + columns: new[] { "TenantId", "MerchantId" }); + + migrationBuilder.CreateIndex( + name: "IX_support_tickets_TenantId_TicketNo", + table: "support_tickets", + columns: new[] { "TenantId", "TicketNo" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_tenant_billing_statements_TenantId_StatementNo", + table: "tenant_billing_statements", + columns: new[] { "TenantId", "StatementNo" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_tenant_notifications_TenantId_Channel_SentAt", + table: "tenant_notifications", + columns: new[] { "TenantId", "Channel", "SentAt" }); + + migrationBuilder.CreateIndex( + name: "IX_tenant_quota_usages_TenantId_QuotaType", + table: "tenant_quota_usages", + columns: new[] { "TenantId", "QuotaType" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_tenant_subscriptions_TenantId_TenantPackageId", + table: "tenant_subscriptions", + columns: new[] { "TenantId", "TenantPackageId" }); + + migrationBuilder.CreateIndex( + name: "IX_tenants_Code", + table: "tenants", + column: "Code", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ticket_comments_TenantId_SupportTicketId", + table: "ticket_comments", + columns: new[] { "TenantId", "SupportTicketId" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "affiliate_orders"); + + migrationBuilder.DropTable( + name: "affiliate_partners"); + + migrationBuilder.DropTable( + name: "affiliate_payouts"); + + migrationBuilder.DropTable( + name: "cart_item_addons"); + + migrationBuilder.DropTable( + name: "cart_items"); + + migrationBuilder.DropTable( + name: "chat_messages"); + + migrationBuilder.DropTable( + name: "chat_sessions"); + + migrationBuilder.DropTable( + name: "checkin_campaigns"); + + migrationBuilder.DropTable( + name: "checkin_records"); + + migrationBuilder.DropTable( + name: "checkout_sessions"); + + migrationBuilder.DropTable( + name: "community_comments"); + + migrationBuilder.DropTable( + name: "community_posts"); + + migrationBuilder.DropTable( + name: "community_reactions"); + + migrationBuilder.DropTable( + name: "coupon_templates"); + + migrationBuilder.DropTable( + name: "coupons"); + + migrationBuilder.DropTable( + name: "delivery_events"); + + migrationBuilder.DropTable( + name: "delivery_orders"); + + migrationBuilder.DropTable( + name: "group_orders"); + + migrationBuilder.DropTable( + name: "group_participants"); + + migrationBuilder.DropTable( + name: "inventory_adjustments"); + + migrationBuilder.DropTable( + name: "inventory_batches"); + + migrationBuilder.DropTable( + name: "inventory_items"); + + migrationBuilder.DropTable( + name: "map_locations"); + + migrationBuilder.DropTable( + name: "member_growth_logs"); + + migrationBuilder.DropTable( + name: "member_point_ledgers"); + + migrationBuilder.DropTable( + name: "member_profiles"); + + migrationBuilder.DropTable( + name: "member_tiers"); + + migrationBuilder.DropTable( + name: "merchant_contracts"); + + migrationBuilder.DropTable( + name: "merchant_documents"); + + migrationBuilder.DropTable( + name: "merchant_staff"); + + migrationBuilder.DropTable( + name: "merchants"); + + migrationBuilder.DropTable( + name: "metric_alert_rules"); + + migrationBuilder.DropTable( + name: "metric_definitions"); + + migrationBuilder.DropTable( + name: "metric_snapshots"); + + migrationBuilder.DropTable( + name: "navigation_requests"); + + migrationBuilder.DropTable( + name: "order_items"); + + migrationBuilder.DropTable( + name: "order_status_histories"); + + migrationBuilder.DropTable( + name: "payment_records"); + + migrationBuilder.DropTable( + name: "payment_refund_records"); + + migrationBuilder.DropTable( + name: "product_addon_groups"); + + migrationBuilder.DropTable( + name: "product_addon_options"); + + migrationBuilder.DropTable( + name: "product_attribute_groups"); + + migrationBuilder.DropTable( + name: "product_attribute_options"); + + migrationBuilder.DropTable( + name: "product_categories"); + + migrationBuilder.DropTable( + name: "product_media_assets"); + + migrationBuilder.DropTable( + name: "product_pricing_rules"); + + migrationBuilder.DropTable( + name: "product_skus"); + + migrationBuilder.DropTable( + name: "products"); + + migrationBuilder.DropTable( + name: "promotion_campaigns"); + + migrationBuilder.DropTable( + name: "queue_tickets"); + + migrationBuilder.DropTable( + name: "refund_requests"); + + migrationBuilder.DropTable( + name: "reservations"); + + migrationBuilder.DropTable( + name: "shopping_carts"); + + migrationBuilder.DropTable( + name: "store_business_hours"); + + migrationBuilder.DropTable( + name: "store_delivery_zones"); + + migrationBuilder.DropTable( + name: "store_employee_shifts"); + + migrationBuilder.DropTable( + name: "store_holidays"); + + migrationBuilder.DropTable( + name: "store_table_areas"); + + migrationBuilder.DropTable( + name: "store_tables"); + + migrationBuilder.DropTable( + name: "stores"); + + migrationBuilder.DropTable( + name: "support_tickets"); + + migrationBuilder.DropTable( + name: "tenant_billing_statements"); + + migrationBuilder.DropTable( + name: "tenant_notifications"); + + migrationBuilder.DropTable( + name: "tenant_packages"); + + migrationBuilder.DropTable( + name: "tenant_quota_usages"); + + migrationBuilder.DropTable( + name: "tenant_subscriptions"); + + migrationBuilder.DropTable( + name: "tenants"); + + migrationBuilder.DropTable( + name: "ticket_comments"); + + migrationBuilder.DropTable( + name: "orders"); + } + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201094456_AddEntityComments.Designer.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/20251202005247_InitSnowflake_Dictionary.Designer.cs similarity index 83% rename from src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201094456_AddEntityComments.Designer.cs rename to src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/20251202005247_InitSnowflake_Dictionary.Designer.cs index 2f36f70..96bfd4a 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/20251201094456_AddEntityComments.Designer.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/20251202005247_InitSnowflake_Dictionary.Designer.cs @@ -9,11 +9,11 @@ using TakeoutSaaS.Infrastructure.Dictionary.Persistence; #nullable disable -namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations +namespace TakeoutSaaS.Infrastructure.Migrations.DictionaryDb { [DbContext(typeof(DictionaryDbContext))] - [Migration("20251201094456_AddEntityComments")] - partial class AddEntityComments + [Migration("20251202005247_InitSnowflake_Dictionary")] + partial class InitSnowflake_Dictionary { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -27,11 +27,13 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryGroup", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Code") .IsRequired() .HasMaxLength(64) @@ -42,16 +44,16 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -75,16 +77,16 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations .HasColumnType("integer") .HasComment("分组作用域:系统/业务。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -102,25 +104,27 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -128,8 +132,8 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations .HasColumnType("character varying(512)") .HasComment("描述信息。"); - b.Property("GroupId") - .HasColumnType("uuid") + b.Property("GroupId") + .HasColumnType("bigint") .HasComment("关联分组 ID。"); b.Property("IsDefault") @@ -154,16 +158,16 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations .HasDefaultValue(100) .HasComment("排序值,越小越靠前。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Value") diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/20251202005247_InitSnowflake_Dictionary.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/20251202005247_InitSnowflake_Dictionary.cs new file mode 100644 index 0000000..374be49 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/20251202005247_InitSnowflake_Dictionary.cs @@ -0,0 +1,106 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace TakeoutSaaS.Infrastructure.Migrations.DictionaryDb +{ + /// + public partial class InitSnowflake_Dictionary : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "dictionary_groups", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Code = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分组编码(唯一)。"), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "分组名称。"), + Scope = table.Column(type: "integer", nullable: false, comment: "分组作用域:系统/业务。"), + Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "描述信息。"), + IsEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true, comment: "是否启用。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_dictionary_groups", x => x.Id); + }, + comment: "参数字典分组(系统参数、业务参数)。"); + + migrationBuilder.CreateTable( + name: "dictionary_items", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + GroupId = table.Column(type: "bigint", nullable: false, comment: "关联分组 ID。"), + Key = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "字典项键。"), + Value = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "字典项值。"), + IsDefault = table.Column(type: "boolean", nullable: false, comment: "是否默认项。"), + IsEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true, comment: "是否启用。"), + SortOrder = table.Column(type: "integer", nullable: false, defaultValue: 100, comment: "排序值,越小越靠前。"), + Description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "描述信息。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_dictionary_items", x => x.Id); + table.ForeignKey( + name: "FK_dictionary_items_dictionary_groups_GroupId", + column: x => x.GroupId, + principalTable: "dictionary_groups", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "参数字典项。"); + + migrationBuilder.CreateIndex( + name: "IX_dictionary_groups_TenantId", + table: "dictionary_groups", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_dictionary_groups_TenantId_Code", + table: "dictionary_groups", + columns: new[] { "TenantId", "Code" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_dictionary_items_GroupId_Key", + table: "dictionary_items", + columns: new[] { "GroupId", "Key" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_dictionary_items_TenantId", + table: "dictionary_items", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "dictionary_items"); + + migrationBuilder.DropTable( + name: "dictionary_groups"); + } + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/DictionaryDbContextModelSnapshot.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/DictionaryDbContextModelSnapshot.cs similarity index 84% rename from src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/DictionaryDbContextModelSnapshot.cs rename to src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/DictionaryDbContextModelSnapshot.cs index d55b340..1df55bf 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Dictionary/Migrations/DictionaryDbContextModelSnapshot.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/DictionaryDb/DictionaryDbContextModelSnapshot.cs @@ -8,7 +8,7 @@ using TakeoutSaaS.Infrastructure.Dictionary.Persistence; #nullable disable -namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations +namespace TakeoutSaaS.Infrastructure.Migrations.DictionaryDb { [DbContext(typeof(DictionaryDbContext))] partial class DictionaryDbContextModelSnapshot : ModelSnapshot @@ -24,11 +24,13 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryGroup", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Code") .IsRequired() .HasMaxLength(64) @@ -39,16 +41,16 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -72,16 +74,16 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations .HasColumnType("integer") .HasComment("分组作用域:系统/业务。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -99,25 +101,27 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -125,8 +129,8 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations .HasColumnType("character varying(512)") .HasComment("描述信息。"); - b.Property("GroupId") - .HasColumnType("uuid") + b.Property("GroupId") + .HasColumnType("bigint") .HasComment("关联分组 ID。"); b.Property("IsDefault") @@ -151,16 +155,16 @@ namespace TakeoutSaaS.Infrastructure.Dictionary.Migrations .HasDefaultValue(100) .HasComment("排序值,越小越靠前。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Value") diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201094410_AddEntityComments.Designer.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20251202005226_InitSnowflake_Identity.Designer.cs similarity index 81% rename from src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201094410_AddEntityComments.Designer.cs rename to src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20251202005226_InitSnowflake_Identity.Designer.cs index 9f9c680..87e37a5 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/20251201094410_AddEntityComments.Designer.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20251202005226_InitSnowflake_Identity.Designer.cs @@ -9,11 +9,11 @@ using TakeoutSaaS.Infrastructure.Identity.Persistence; #nullable disable -namespace TakeoutSaaS.Infrastructure.Identity.Migrations +namespace TakeoutSaaS.Infrastructure.Migrations.IdentityDb { [DbContext(typeof(IdentityDbContext))] - [Migration("20251201094410_AddEntityComments")] - partial class AddEntityComments + [Migration("20251202005226_InitSnowflake_Identity")] + partial class InitSnowflake_Identity { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -27,11 +27,13 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.IdentityUser", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Account") .IsRequired() .HasMaxLength(64) @@ -47,16 +49,16 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DisplayName") @@ -65,8 +67,8 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("character varying(64)") .HasComment("展示名称。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户(平台管理员为空)。"); b.Property("PasswordHash") @@ -85,16 +87,16 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("text") .HasComment("角色集合。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -112,11 +114,13 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.MiniUser", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Avatar") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -126,16 +130,16 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Nickname") @@ -150,8 +154,8 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("character varying(128)") .HasComment("微信 OpenId。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UnionId") @@ -163,8 +167,8 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20251202005226_InitSnowflake_Identity.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20251202005226_InitSnowflake_Identity.cs new file mode 100644 index 0000000..772ad91 --- /dev/null +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20251202005226_InitSnowflake_Identity.cs @@ -0,0 +1,99 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace TakeoutSaaS.Infrastructure.Migrations.IdentityDb +{ + /// + public partial class InitSnowflake_Identity : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "identity_users", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Account = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "登录账号。"), + DisplayName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "展示名称。"), + PasswordHash = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "密码哈希。"), + MerchantId = table.Column(type: "bigint", nullable: true, comment: "所属商户(平台管理员为空)。"), + Roles = table.Column(type: "text", nullable: false, comment: "角色集合。"), + Permissions = table.Column(type: "text", nullable: false, comment: "权限集合。"), + Avatar = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "头像地址。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_identity_users", x => x.Id); + }, + comment: "管理后台账户实体(平台管理员、租户管理员或商户员工)。"); + + migrationBuilder.CreateTable( + name: "mini_users", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OpenId = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "微信 OpenId。"), + UnionId = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "微信 UnionId,可能为空。"), + Nickname = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "昵称。"), + Avatar = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "头像地址。"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), + DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), + CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), + UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), + DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), + TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") + }, + constraints: table => + { + table.PrimaryKey("PK_mini_users", x => x.Id); + }, + comment: "小程序用户实体。"); + + migrationBuilder.CreateIndex( + name: "IX_identity_users_TenantId", + table: "identity_users", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_identity_users_TenantId_Account", + table: "identity_users", + columns: new[] { "TenantId", "Account" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_mini_users_TenantId", + table: "mini_users", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_mini_users_TenantId_OpenId", + table: "mini_users", + columns: new[] { "TenantId", "OpenId" }, + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "identity_users"); + + migrationBuilder.DropTable( + name: "mini_users"); + } + } +} diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/IdentityDbContextModelSnapshot.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/IdentityDbContextModelSnapshot.cs similarity index 82% rename from src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/IdentityDbContextModelSnapshot.cs rename to src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/IdentityDbContextModelSnapshot.cs index 1814980..477e211 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Identity/Migrations/IdentityDbContextModelSnapshot.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/IdentityDbContextModelSnapshot.cs @@ -8,7 +8,7 @@ using TakeoutSaaS.Infrastructure.Identity.Persistence; #nullable disable -namespace TakeoutSaaS.Infrastructure.Identity.Migrations +namespace TakeoutSaaS.Infrastructure.Migrations.IdentityDb { [DbContext(typeof(IdentityDbContext))] partial class IdentityDbContextModelSnapshot : ModelSnapshot @@ -24,11 +24,13 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.IdentityUser", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Account") .IsRequired() .HasMaxLength(64) @@ -44,16 +46,16 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DisplayName") @@ -62,8 +64,8 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("character varying(64)") .HasComment("展示名称。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户(平台管理员为空)。"); b.Property("PasswordHash") @@ -82,16 +84,16 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("text") .HasComment("角色集合。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -109,11 +111,13 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.MiniUser", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Avatar") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -123,16 +127,16 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Nickname") @@ -147,8 +151,8 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("character varying(128)") .HasComment("微信 OpenId。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UnionId") @@ -160,8 +164,8 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/TakeoutAppDbContextModelSnapshot.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/TakeoutAppDbContextModelSnapshot.cs similarity index 79% rename from src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/TakeoutAppDbContextModelSnapshot.cs rename to src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/TakeoutAppDbContextModelSnapshot.cs index 50ffaf5..fc6058e 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Migrations/TakeoutAppDbContextModelSnapshot.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/TakeoutAppDbContextModelSnapshot.cs @@ -8,7 +8,7 @@ using TakeoutSaaS.Infrastructure.App.Persistence; #nullable disable -namespace TakeoutSaaS.Infrastructure.App.Migrations +namespace TakeoutSaaS.Infrastructure.Migrations { [DbContext(typeof(TakeoutAppDbContext))] partial class TakeoutAppDbContextModelSnapshot : ModelSnapshot @@ -24,11 +24,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricAlertRule", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ConditionJson") .IsRequired() .HasColumnType("text") @@ -38,24 +40,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Enabled") .HasColumnType("boolean") .HasComment("是否启用。"); - b.Property("MetricDefinitionId") - .HasColumnType("uuid") + b.Property("MetricDefinitionId") + .HasColumnType("bigint") .HasComment("关联指标。"); b.Property("NotificationChannels") @@ -68,16 +70,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("告警级别。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -92,11 +94,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricDefinition", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Code") .IsRequired() .HasMaxLength(64) @@ -107,8 +111,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DefaultAggregation") @@ -121,8 +125,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -140,16 +144,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("指标名称。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -165,25 +169,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricSnapshot", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DimensionKey") @@ -192,20 +198,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("维度键(JSON)。"); - b.Property("MetricDefinitionId") - .HasColumnType("uuid") + b.Property("MetricDefinitionId") + .HasColumnType("bigint") .HasComment("指标定义 ID。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Value") @@ -234,35 +240,37 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.Coupon", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Code") .IsRequired() .HasMaxLength(32) .HasColumnType("character varying(32)") .HasComment("券码或序列号。"); - b.Property("CouponTemplateId") - .HasColumnType("uuid") + b.Property("CouponTemplateId") + .HasColumnType("bigint") .HasComment("模板标识。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpireAt") @@ -273,32 +281,32 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("发放时间。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("订单 ID(已使用时记录)。"); b.Property("Status") .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("UsedAt") .HasColumnType("timestamp with time zone") .HasComment("使用时间。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("归属用户。"); b.HasKey("Id"); @@ -314,11 +322,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.CouponTemplate", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AllowStack") .HasColumnType("boolean") .HasComment("是否允许叠加其他优惠。"); @@ -339,16 +349,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -386,8 +396,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("适用门店 ID 集合(JSON)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TotalQuantity") @@ -398,8 +408,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("ValidFrom") @@ -424,11 +434,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.PromotionCampaign", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AudienceDescription") .HasMaxLength(512) .HasColumnType("character varying(512)") @@ -447,16 +459,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndAt") @@ -486,16 +498,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("活动状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -508,13 +520,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatMessage", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("ChatSessionId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChatSessionId") + .HasColumnType("bigint") .HasComment("会话标识。"); b.Property("Content") @@ -533,16 +547,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsRead") @@ -557,20 +571,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("发送方类型。"); - b.Property("SenderUserId") - .HasColumnType("uuid") + b.Property("SenderUserId") + .HasColumnType("bigint") .HasComment("发送方用户 ID。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -585,33 +599,35 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatSession", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AgentUserId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AgentUserId") + .HasColumnType("bigint") .HasComment("当前客服员工 ID。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); - b.Property("CustomerUserId") - .HasColumnType("uuid") + b.Property("CustomerUserId") + .HasColumnType("bigint") .HasComment("顾客用户 ID。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndedAt") @@ -636,20 +652,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("会话状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("所属门店(可空为平台)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -665,13 +681,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.SupportTicket", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AssignedAgentId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AssignedAgentId") + .HasColumnType("bigint") .HasComment("指派的客服。"); b.Property("ClosedAt") @@ -682,20 +700,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); - b.Property("CustomerUserId") - .HasColumnType("uuid") + b.Property("CustomerUserId") + .HasColumnType("bigint") .HasComment("客户用户 ID。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -703,8 +721,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("工单详情。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单(如有)。"); b.Property("Priority") @@ -721,8 +739,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("工单主题。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TicketNo") @@ -735,8 +753,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -752,17 +770,19 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.TicketComment", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AttachmentsJson") .HasColumnType("text") .HasComment("附件 JSON。"); - b.Property("AuthorUserId") - .HasColumnType("uuid") + b.Property("AuthorUserId") + .HasColumnType("bigint") .HasComment("评论人 ID。"); b.Property("Content") @@ -775,36 +795,36 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsInternal") .HasColumnType("boolean") .HasComment("是否内部备注。"); - b.Property("SupportTicketId") - .HasColumnType("uuid") + b.Property("SupportTicketId") + .HasColumnType("bigint") .HasComment("工单标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -819,29 +839,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryEvent", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("DeliveryOrderId") - .HasColumnType("uuid") + b.Property("DeliveryOrderId") + .HasColumnType("bigint") .HasComment("配送单标识。"); b.Property("EventType") @@ -862,16 +884,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("原始数据 JSON。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -886,11 +908,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryOrder", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CourierName") .HasMaxLength(64) .HasColumnType("character varying(64)") @@ -905,16 +929,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveredAt") @@ -935,8 +959,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("异常原因。"); - b.Property("OrderId") - .HasColumnType("uuid"); + b.Property("OrderId") + .HasColumnType("bigint"); b.Property("PickedUpAt") .HasColumnType("timestamp with time zone") @@ -955,16 +979,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -980,33 +1004,35 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliateOrder", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AffiliatePartnerId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AffiliatePartnerId") + .HasColumnType("bigint") .HasComment("推广人标识。"); - b.Property("BuyerUserId") - .HasColumnType("uuid") + b.Property("BuyerUserId") + .HasColumnType("bigint") .HasComment("用户 ID。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EstimatedCommission") @@ -1019,8 +1045,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("订单金额。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单。"); b.Property("SettledAt") @@ -1031,16 +1057,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("当前状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1056,11 +1082,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePartner", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ChannelType") .HasColumnType("integer") .HasComment("渠道类型。"); @@ -1073,16 +1101,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DisplayName") @@ -1105,20 +1133,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("当前状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户 ID(如绑定平台账号)。"); b.HasKey("Id"); @@ -1133,13 +1161,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePayout", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AffiliatePartnerId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AffiliatePartnerId") + .HasColumnType("bigint") .HasComment("合作伙伴标识。"); b.Property("Amount") @@ -1151,16 +1181,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("PaidAt") @@ -1182,16 +1212,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1207,11 +1237,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInCampaign", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AllowMakeupCount") .HasColumnType("integer") .HasComment("支持补签次数。"); @@ -1220,16 +1252,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -1260,16 +1292,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1284,13 +1316,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInRecord", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("CheckInCampaignId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CheckInCampaignId") + .HasColumnType("bigint") .HasComment("活动标识。"); b.Property("CheckInDate") @@ -1301,16 +1335,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsMakeup") @@ -1322,20 +1356,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("获得奖励 JSON。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.HasKey("Id"); @@ -1351,13 +1385,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityComment", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AuthorUserId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorUserId") + .HasColumnType("bigint") .HasComment("评论人。"); b.Property("Content") @@ -1370,40 +1406,40 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsDeleted") .HasColumnType("boolean") .HasComment("状态。"); - b.Property("ParentId") - .HasColumnType("uuid") + b.Property("ParentId") + .HasColumnType("bigint") .HasComment("父级评论 ID。"); - b.Property("PostId") - .HasColumnType("uuid") + b.Property("PostId") + .HasColumnType("bigint") .HasComment("动态标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1418,13 +1454,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityPost", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AuthorUserId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorUserId") + .HasColumnType("bigint") .HasComment("作者用户 ID。"); b.Property("CommentCount") @@ -1440,16 +1478,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("LikeCount") @@ -1464,8 +1502,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Title") @@ -1477,8 +1515,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1493,29 +1531,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CommunityReaction", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("PostId") - .HasColumnType("uuid") + b.Property("PostId") + .HasColumnType("bigint") .HasComment("动态 ID。"); b.Property("ReactedAt") @@ -1526,20 +1566,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("反应类型。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户 ID。"); b.HasKey("Id"); @@ -1555,11 +1595,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.GroupBuying.Entities.GroupOrder", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CancelledAt") .HasColumnType("timestamp with time zone") .HasComment("取消时间。"); @@ -1568,8 +1610,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("CurrentCount") @@ -1580,8 +1622,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndAt") @@ -1599,12 +1641,12 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("拼团价格。"); - b.Property("LeaderUserId") - .HasColumnType("uuid") + b.Property("LeaderUserId") + .HasColumnType("bigint") .HasComment("团长用户 ID。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("关联商品或套餐。"); b.Property("StartAt") @@ -1615,8 +1657,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("拼团状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); b.Property("SucceededAt") @@ -1627,16 +1669,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("成团需要的人数。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1652,57 +1694,59 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.GroupBuying.Entities.GroupParticipant", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("GroupOrderId") - .HasColumnType("uuid") + b.Property("GroupOrderId") + .HasColumnType("bigint") .HasComment("拼单活动标识。"); b.Property("JoinedAt") .HasColumnType("timestamp with time zone") .HasComment("参与时间。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("对应订单标识。"); b.Property("Status") .HasColumnType("integer") .HasComment("参与状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.HasKey("Id"); @@ -1718,11 +1762,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryAdjustment", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AdjustmentType") .HasColumnType("integer") .HasComment("调整类型。"); @@ -1731,28 +1777,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("InventoryItemId") - .HasColumnType("uuid") + b.Property("InventoryItemId") + .HasColumnType("bigint") .HasComment("对应的库存记录标识。"); b.Property("OccurredAt") .HasColumnType("timestamp with time zone") .HasComment("发生时间。"); - b.Property("OperatorId") - .HasColumnType("uuid") + b.Property("OperatorId") + .HasColumnType("bigint") .HasComment("操作人标识。"); b.Property("Quantity") @@ -1764,16 +1810,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("原因说明。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1788,11 +1834,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryBatch", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("BatchNumber") .IsRequired() .HasMaxLength(64) @@ -1803,24 +1851,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpireDate") .HasColumnType("timestamp with time zone") .HasComment("过期日期。"); - b.Property("ProductSkuId") - .HasColumnType("uuid") + b.Property("ProductSkuId") + .HasColumnType("bigint") .HasComment("SKU 标识。"); b.Property("ProductionDate") @@ -1835,20 +1883,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("剩余数量。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1864,11 +1912,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Inventory.Entities.InventoryItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("BatchNumber") .HasMaxLength(64) .HasColumnType("character varying(64)") @@ -1878,16 +1928,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpireDate") @@ -1899,8 +1949,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("储位或仓位信息。"); - b.Property("ProductSkuId") - .HasColumnType("uuid") + b.Property("ProductSkuId") + .HasColumnType("bigint") .HasComment("SKU 标识。"); b.Property("QuantityOnHand") @@ -1915,20 +1965,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("安全库存阈值。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -1943,11 +1993,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberGrowthLog", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ChangeValue") .HasColumnType("integer") .HasComment("变动数量。"); @@ -1956,8 +2008,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("CurrentValue") @@ -1968,12 +2020,12 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("MemberId") - .HasColumnType("uuid") + b.Property("MemberId") + .HasColumnType("bigint") .HasComment("会员标识。"); b.Property("Notes") @@ -1985,16 +2037,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("发生时间。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2009,11 +2061,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberPointLedger", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("BalanceAfterChange") .HasColumnType("integer") .HasComment("变动后余额。"); @@ -2026,24 +2080,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpireAt") .HasColumnType("timestamp with time zone") .HasComment("过期时间(如适用)。"); - b.Property("MemberId") - .HasColumnType("uuid") + b.Property("MemberId") + .HasColumnType("bigint") .HasComment("会员标识。"); b.Property("OccurredAt") @@ -2054,20 +2108,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("变动原因。"); - b.Property("SourceId") - .HasColumnType("uuid") + b.Property("SourceId") + .HasColumnType("bigint") .HasComment("来源 ID(订单、活动等)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2082,11 +2136,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberProfile", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AvatarUrl") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -2100,16 +2156,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("GrowthValue") @@ -2120,8 +2176,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("注册时间。"); - b.Property("MemberTierId") - .HasColumnType("uuid") + b.Property("MemberTierId") + .HasColumnType("bigint") .HasComment("当前会员等级 ID。"); b.Property("Mobile") @@ -2143,20 +2199,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("会员状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.HasKey("Id"); @@ -2172,11 +2228,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberTier", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("BenefitsJson") .IsRequired() .HasColumnType("text") @@ -2186,16 +2244,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Name") @@ -2212,16 +2270,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序值。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2237,11 +2295,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.Merchant", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Address") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -2291,16 +2351,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("District") @@ -2359,16 +2419,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("税号/统一社会信用代码。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2383,11 +2443,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantContract", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ContractNumber") .IsRequired() .HasMaxLength(64) @@ -2398,16 +2460,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndDate") @@ -2420,8 +2482,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(512)") .HasComment("合同文件存储地址。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户标识。"); b.Property("SignedAt") @@ -2436,8 +2498,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("合同状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TerminatedAt") @@ -2453,8 +2515,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2470,25 +2532,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantDocument", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DocumentNumber") @@ -2514,8 +2578,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("签发日期。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户标识。"); b.Property("Remarks") @@ -2526,16 +2590,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("审核状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2550,25 +2614,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantStaff", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Email") @@ -2576,12 +2642,12 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("邮箱地址。"); - b.Property("IdentityUserId") - .HasColumnType("uuid") + b.Property("IdentityUserId") + .HasColumnType("bigint") .HasComment("登录账号 ID(指向统一身份体系)。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户标识。"); b.Property("Name") @@ -2608,20 +2674,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("员工状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("可选的关联门店 ID。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2636,11 +2702,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Navigation.Entities.MapLocation", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Address") .IsRequired() .HasMaxLength(256) @@ -2651,16 +2719,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Landmark") @@ -2682,20 +2750,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("名称。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("关联门店 ID,可空表示独立 POI。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2710,11 +2778,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Navigation.Entities.NavigationRequest", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Channel") .HasColumnType("integer") .HasComment("来源通道(小程序、H5 等)。"); @@ -2723,44 +2793,44 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("RequestedAt") .HasColumnType("timestamp with time zone") .HasComment("请求时间。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店 ID。"); b.Property("TargetApp") .HasColumnType("integer") .HasComment("跳转的地图应用。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户 ID。"); b.HasKey("Id"); @@ -2775,11 +2845,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CartItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AttributesJson") .HasColumnType("text") .HasComment("扩展 JSON(规格、加料选项等)。"); @@ -2788,20 +2860,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("商品或 SKU 标识。"); b.Property("ProductName") @@ -2810,8 +2882,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("商品名称快照。"); - b.Property("ProductSkuId") - .HasColumnType("uuid") + b.Property("ProductSkuId") + .HasColumnType("bigint") .HasComment("SKU 标识。"); b.Property("Quantity") @@ -2823,16 +2895,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("自定义备注(口味要求)。"); - b.Property("ShoppingCartId") - .HasColumnType("uuid") + b.Property("ShoppingCartId") + .HasColumnType("bigint") .HasComment("所属购物车标识。"); b.Property("Status") .HasColumnType("integer") .HasComment("状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UnitPrice") @@ -2844,8 +2916,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2860,29 +2932,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CartItemAddon", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("CartItemId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CartItemId") + .HasColumnType("bigint") .HasComment("所属购物车条目。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExtraPrice") @@ -2896,20 +2970,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("选项名称。"); - b.Property("OptionId") - .HasColumnType("uuid") + b.Property("OptionId") + .HasColumnType("bigint") .HasComment("选项 ID(可对应 ProductAddonOption)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -2922,25 +2996,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.CheckoutSession", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExpiresAt") @@ -2957,24 +3033,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("会话状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.Property("ValidationResultJson") @@ -2995,25 +3071,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Ordering.Entities.ShoppingCart", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveryPreference") @@ -3029,8 +3107,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("购物车状态,包含正常/锁定。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); b.Property("TableContext") @@ -3038,20 +3116,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("桌码或场景标识(扫码点餐)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); - b.Property("UserId") - .HasColumnType("uuid") + b.Property("UserId") + .HasColumnType("bigint") .HasComment("用户标识。"); b.HasKey("Id"); @@ -3067,11 +3145,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.Order", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CancelReason") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -3089,8 +3169,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("CustomerName") @@ -3107,8 +3187,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveryType") @@ -3163,16 +3243,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(512)") .HasComment("备注。"); - b.Property("ReservationId") - .HasColumnType("uuid") + b.Property("ReservationId") + .HasColumnType("bigint") .HasComment("预约 ID。"); b.Property("Status") .HasColumnType("integer") .HasComment("当前状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店。"); b.Property("TableNo") @@ -3180,16 +3260,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(32)") .HasComment("就餐桌号。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3207,11 +3287,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AttributesJson") .HasColumnType("text") .HasComment("自定义属性 JSON。"); @@ -3220,16 +3302,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DiscountAmount") @@ -3237,12 +3319,12 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("折扣金额。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("订单 ID。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("商品 ID。"); b.Property("ProductName") @@ -3265,8 +3347,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("小计。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Unit") @@ -3283,8 +3365,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3301,25 +3383,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderStatusHistory", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Notes") @@ -3331,28 +3415,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("发生时间。"); - b.Property("OperatorId") - .HasColumnType("uuid") + b.Property("OperatorId") + .HasColumnType("bigint") .HasComment("操作人标识(可为空表示系统)。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("订单标识。"); b.Property("Status") .HasColumnType("integer") .HasComment("变更后的状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3367,11 +3451,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.RefundRequest", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Amount") .HasPrecision(18, 2) .HasColumnType("numeric(18,2)") @@ -3381,20 +3467,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单标识。"); b.Property("ProcessedAt") @@ -3426,16 +3512,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("退款状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3451,11 +3537,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Payments.Entities.PaymentRecord", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Amount") .HasPrecision(18, 2) .HasColumnType("numeric(18,2)") @@ -3470,24 +3558,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Method") .HasColumnType("integer") .HasComment("支付方式。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单。"); b.Property("PaidAt") @@ -3507,8 +3595,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("支付状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TradeNo") @@ -3520,8 +3608,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3536,11 +3624,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Payments.Entities.PaymentRefundRecord", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Amount") .HasPrecision(18, 2) .HasColumnType("numeric(18,2)") @@ -3559,28 +3649,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); - b.Property("OrderId") - .HasColumnType("uuid") + b.Property("OrderId") + .HasColumnType("bigint") .HasComment("关联订单标识。"); b.Property("Payload") .HasColumnType("text") .HasComment("渠道返回的原始数据 JSON。"); - b.Property("PaymentRecordId") - .HasColumnType("uuid") + b.Property("PaymentRecordId") + .HasColumnType("bigint") .HasComment("原支付记录标识。"); b.Property("RequestedAt") @@ -3591,16 +3681,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("退款状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3615,13 +3705,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.Product", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("CategoryId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("bigint") .HasComment("所属分类。"); b.Property("CoverImage") @@ -3633,16 +3725,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -3704,8 +3796,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("库存数量(可选)。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("所属门店。"); b.Property("Subtitle") @@ -3713,8 +3805,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("副标题/卖点。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Unit") @@ -3726,8 +3818,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3745,25 +3837,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAddonGroup", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsRequired") @@ -3784,8 +3878,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("分组名称。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("所属商品。"); b.Property("SelectionType") @@ -3796,16 +3890,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序值。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3820,29 +3914,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAddonOption", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AddonGroupId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AddonGroupId") + .HasColumnType("bigint") .HasComment("所属加料分组。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExtraPrice") @@ -3864,16 +3960,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3886,25 +3982,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAttributeGroup", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsRequired") @@ -3917,6 +4015,10 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("分组名称,例如“辣度”“份量”。"); + b.Property("ProductId") + .HasColumnType("bigint") + .HasComment("所属商品标识。"); + b.Property("SelectionType") .HasColumnType("integer") .HasComment("选择类型(单选/多选)。"); @@ -3925,20 +4027,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("显示排序。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("关联门店,可为空表示所有门店共享。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -3953,29 +4055,31 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductAttributeOption", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AttributeGroupId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AttributeGroupId") + .HasColumnType("bigint") .HasComment("所属规格组。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("ExtraPrice") @@ -3997,16 +4101,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4022,25 +4126,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductCategory", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -4062,20 +4168,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("排序值。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("所属门店。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4090,11 +4196,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductMediaAsset", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Caption") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -4104,40 +4212,40 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("MediaType") .HasColumnType("integer") .HasComment("媒体类型。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("商品标识。"); b.Property("SortOrder") .HasColumnType("integer") .HasComment("排序。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Url") @@ -4156,11 +4264,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductPricingRule", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ConditionsJson") .IsRequired() .HasColumnType("text") @@ -4170,16 +4280,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndTime") @@ -4191,28 +4301,32 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("特殊价格。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("所属商品。"); b.Property("RuleType") .HasColumnType("integer") .HasComment("策略类型。"); + b.Property("SortOrder") + .HasColumnType("integer") + .HasComment("排序值。"); + b.Property("StartTime") .HasColumnType("timestamp with time zone") .HasComment("生效开始时间。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("WeekdaysJson") @@ -4231,11 +4345,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductSku", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AttributesJson") .IsRequired() .HasColumnType("text") @@ -4250,16 +4366,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("OriginalPrice") @@ -4272,8 +4388,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("numeric(18,2)") .HasComment("售价。"); - b.Property("ProductId") - .HasColumnType("uuid") + b.Property("ProductId") + .HasColumnType("bigint") .HasComment("所属商品标识。"); b.Property("SkuCode") @@ -4282,20 +4398,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(32)") .HasComment("SKU 编码。"); + b.Property("SortOrder") + .HasColumnType("integer") + .HasComment("排序值。"); + b.Property("StockQuantity") .HasColumnType("integer") .HasComment("可售库存。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Weight") @@ -4316,11 +4436,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Queues.Entities.QueueTicket", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CalledAt") .HasColumnType("timestamp with time zone") .HasComment("叫号时间。"); @@ -4333,16 +4455,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EstimatedWaitMinutes") @@ -4366,11 +4488,11 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("StoreId") - .HasColumnType("uuid"); + b.Property("StoreId") + .HasColumnType("bigint"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("TicketNumber") @@ -4383,8 +4505,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4402,11 +4524,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Reservations.Entities.Reservation", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CancelledAt") .HasColumnType("timestamp with time zone") .HasComment("取消时间。"); @@ -4424,8 +4548,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("CustomerName") @@ -4444,8 +4568,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("PeopleCount") @@ -4471,8 +4595,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店。"); b.Property("TablePreference") @@ -4480,16 +4604,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("桌型/标签。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4507,11 +4631,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.Store", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Address") .HasMaxLength(256) .HasColumnType("character varying(256)") @@ -4550,16 +4676,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveryRadiusKm") @@ -4589,8 +4715,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("门店负责人姓名。"); - b.Property("MerchantId") - .HasColumnType("uuid") + b.Property("MerchantId") + .HasColumnType("bigint") .HasComment("所属商户标识。"); b.Property("Name") @@ -4637,16 +4763,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("门店标签(逗号分隔)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4664,11 +4790,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreBusinessHour", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CapacityLimit") .HasColumnType("integer") .HasComment("最大接待容量或单量限制。"); @@ -4677,8 +4805,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DayOfWeek") @@ -4689,8 +4817,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndTime") @@ -4710,20 +4838,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("interval") .HasComment("开始时间(本地时间)。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4738,25 +4866,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreDeliveryZone", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DeliveryFee") @@ -4778,20 +4908,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("GeoJSON 表示的多边形范围。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("SortOrder") + .HasColumnType("integer") + .HasComment("排序值。"); + + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("ZoneName") @@ -4812,25 +4946,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreEmployeeShift", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EndTime") @@ -4850,28 +4986,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("班次日期。"); - b.Property("StaffId") - .HasColumnType("uuid") + b.Property("StaffId") + .HasColumnType("bigint") .HasComment("员工标识。"); b.Property("StartTime") .HasColumnType("interval") .HasComment("开始时间。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4887,17 +5023,19 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreHoliday", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("Date") @@ -4908,8 +5046,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("IsClosed") @@ -4921,20 +5059,20 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(256)") .HasComment("说明内容。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -4950,13 +5088,15 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreTable", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); - b.Property("AreaId") - .HasColumnType("uuid") + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AreaId") + .HasColumnType("bigint") .HasComment("所在区域 ID。"); b.Property("Capacity") @@ -4967,16 +5107,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("QrCodeUrl") @@ -4988,8 +5128,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("当前桌台状态。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); b.Property("TableCode") @@ -5003,16 +5143,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("桌台标签(堂食、快餐等)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -5028,25 +5168,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreTableArea", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -5060,20 +5202,24 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(64)") .HasComment("区域名称。"); - b.Property("StoreId") - .HasColumnType("uuid") + b.Property("SortOrder") + .HasColumnType("integer") + .HasComment("排序值。"); + + b.Property("StoreId") + .HasColumnType("bigint") .HasComment("门店标识。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -5089,11 +5235,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.Tenant", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Address") .HasColumnType("text") .HasComment("详细地址信息。"); @@ -5135,16 +5283,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EffectiveFrom") @@ -5175,8 +5323,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("character varying(128)") .HasComment("租户全称或品牌名称。"); - b.Property("PrimaryOwnerUserId") - .HasColumnType("uuid") + b.Property("PrimaryOwnerUserId") + .HasColumnType("bigint") .HasComment("系统内对应的租户所有者账号 ID。"); b.Property("Province") @@ -5213,8 +5361,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Website") @@ -5234,11 +5382,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantBillingStatement", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AmountDue") .HasPrecision(18, 2) .HasColumnType("numeric(18,2)") @@ -5253,16 +5403,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DueDate") @@ -5291,16 +5441,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("当前付款状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -5316,11 +5466,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantNotification", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Channel") .HasColumnType("integer") .HasComment("发布通道(站内、邮件、短信等)。"); @@ -5329,16 +5481,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Message") @@ -5363,8 +5515,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("integer") .HasComment("通知重要级别。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Title") @@ -5377,8 +5529,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); @@ -5393,25 +5545,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantPackage", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") @@ -5465,8 +5619,8 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("YearlyPrice") @@ -5483,25 +5637,27 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantQuotaUsage", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("LastResetAt") @@ -5520,16 +5676,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("配额刷新周期描述(如月、年)。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("UsedValue") @@ -5549,11 +5705,13 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantSubscription", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") + .HasColumnType("bigint") .HasComment("实体唯一标识。"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AutoRenew") .HasColumnType("boolean") .HasComment("是否开启自动续费。"); @@ -5562,16 +5720,16 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); - b.Property("CreatedBy") - .HasColumnType("uuid") + b.Property("CreatedBy") + .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); - b.Property("DeletedBy") - .HasColumnType("uuid") + b.Property("DeletedBy") + .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("EffectiveFrom") @@ -5590,28 +5748,28 @@ namespace TakeoutSaaS.Infrastructure.App.Migrations .HasColumnType("text") .HasComment("运营备注信息。"); - b.Property("ScheduledPackageId") - .HasColumnType("uuid") + b.Property("ScheduledPackageId") + .HasColumnType("bigint") .HasComment("若已排期升降配,对应的新套餐 ID。"); b.Property("Status") .HasColumnType("integer") .HasComment("订阅当前状态。"); - b.Property("TenantId") - .HasColumnType("uuid") + b.Property("TenantId") + .HasColumnType("bigint") .HasComment("所属租户 ID。"); - b.Property("TenantPackageId") - .HasColumnType("uuid") + b.Property("TenantPackageId") + .HasColumnType("bigint") .HasComment("当前订阅关联的套餐标识。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); - b.Property("UpdatedBy") - .HasColumnType("uuid") + b.Property("UpdatedBy") + .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj b/src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj index 90cd078..4661491 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/TakeoutSaaS.Infrastructure.csproj @@ -23,5 +23,6 @@ + diff --git a/src/Modules/TakeoutSaaS.Module.Tenancy/TenantProvider.cs b/src/Modules/TakeoutSaaS.Module.Tenancy/TenantProvider.cs index 1adf1d1..7faff05 100644 --- a/src/Modules/TakeoutSaaS.Module.Tenancy/TenantProvider.cs +++ b/src/Modules/TakeoutSaaS.Module.Tenancy/TenantProvider.cs @@ -19,6 +19,6 @@ public sealed class TenantProvider : ITenantProvider } /// - public Guid GetCurrentTenantId() - => _tenantContextAccessor.Current?.TenantId ?? Guid.Empty; + public long GetCurrentTenantId() + => _tenantContextAccessor.Current?.TenantId ?? 0; } diff --git a/src/Modules/TakeoutSaaS.Module.Tenancy/TenantResolutionMiddleware.cs b/src/Modules/TakeoutSaaS.Module.Tenancy/TenantResolutionMiddleware.cs index e7a2c2f..a1066c1 100644 --- a/src/Modules/TakeoutSaaS.Module.Tenancy/TenantResolutionMiddleware.cs +++ b/src/Modules/TakeoutSaaS.Module.Tenancy/TenantResolutionMiddleware.cs @@ -107,7 +107,7 @@ public sealed class TenantResolutionMiddleware // 1. Header 中的租户 ID if (!string.IsNullOrWhiteSpace(options.TenantIdHeaderName) && request.Headers.TryGetValue(options.TenantIdHeaderName, out var tenantHeader) && - Guid.TryParse(tenantHeader.FirstOrDefault(), out var headerTenantId)) + long.TryParse(tenantHeader.FirstOrDefault(), out var headerTenantId)) { return new TenantContext(headerTenantId, null, $"header:{options.TenantIdHeaderName}"); } @@ -141,7 +141,7 @@ public sealed class TenantResolutionMiddleware // 4. Token Claim var claim = context.User?.FindFirst("tenant_id"); - if (claim != null && Guid.TryParse(claim.Value, out var claimTenant)) + if (claim != null && long.TryParse(claim.Value, out var claimTenant)) { return new TenantContext(claimTenant, null, "claim:tenant_id"); } @@ -149,9 +149,9 @@ public sealed class TenantResolutionMiddleware return TenantContext.Empty; } - private static bool TryResolveByCode(string? code, TenantResolutionOptions options, out Guid tenantId) + private static bool TryResolveByCode(string? code, TenantResolutionOptions options, out long tenantId) { - tenantId = Guid.Empty; + tenantId = 0; if (string.IsNullOrWhiteSpace(code)) { return false; diff --git a/src/Modules/TakeoutSaaS.Module.Tenancy/TenantResolutionOptions.cs b/src/Modules/TakeoutSaaS.Module.Tenancy/TenantResolutionOptions.cs index 8e0c5ff..7cd928d 100644 --- a/src/Modules/TakeoutSaaS.Module.Tenancy/TenantResolutionOptions.cs +++ b/src/Modules/TakeoutSaaS.Module.Tenancy/TenantResolutionOptions.cs @@ -20,14 +20,14 @@ public sealed class TenantResolutionOptions /// /// 明确指定 host 与租户 ID 对应关系的映射表(精确匹配)。 /// - public IDictionary DomainTenantMap { get; set; } - = new Dictionary(StringComparer.OrdinalIgnoreCase); + public IDictionary DomainTenantMap { get; set; } + = new Dictionary(StringComparer.OrdinalIgnoreCase); /// /// 租户编码到租户 ID 的映射表,用于 header 或子域名解析。 /// - public IDictionary CodeTenantMap { get; set; } - = new Dictionary(StringComparer.OrdinalIgnoreCase); + public IDictionary CodeTenantMap { get; set; } + = new Dictionary(StringComparer.OrdinalIgnoreCase); /// /// 根域(不含子域),用于形如 {tenant}.rootDomain 的场景,例如 admin.takeoutsaas.com。 @@ -47,10 +47,10 @@ public sealed class TenantResolutionOptions /// /// 对外只读视图,便于审计日志输出。 /// - public IReadOnlyDictionary DomainMappings => new ReadOnlyDictionary(DomainTenantMap); + public IReadOnlyDictionary DomainMappings => new ReadOnlyDictionary(DomainTenantMap); /// /// 对外只读的编码映射。 /// - public IReadOnlyDictionary CodeMappings => new ReadOnlyDictionary(CodeTenantMap); + public IReadOnlyDictionary CodeMappings => new ReadOnlyDictionary(CodeTenantMap); }