feat: add TenantIndustry and TenantIndustryNameTranslations tables with seed data
parent
1a7ab235cb
commit
1a5fb4b32d
|
|
@ -8,6 +8,8 @@
|
|||
20260718121851_PaygOfflineOrderManage 隨付即用(PAYG)下单与线下订单管理
|
||||
20260719120000_AddAgentUserSettingAndPaymentMethod 代理归属国家 + 支持的支付网关
|
||||
20260720000000_SplitOrderTypeAddOrderSource 订单来源与业务意图拆分
|
||||
20260723000000_AddTenantIndustry 行业配置表(含 10 条行业种子)
|
||||
20260724000000_AddTenantIndustryNameTranslations 行业名称多语言 JSON 列
|
||||
|
||||
另外补上 IsDeleted 的 DEFAULT 0 约束:.bak 还原后部分表丢了默认值约束,
|
||||
而 EF 的 INSERT 并不显式带该列 → 报 "Cannot insert the value NULL into column 'IsDeleted'"。
|
||||
|
|
@ -103,4 +105,49 @@ BEGIN
|
|||
EXEC(N'UPDATE AMLPortal_Orders SET OrderType = 200, OrderSource = 2 WHERE OrderType = 300;');
|
||||
END
|
||||
|
||||
/* ── 5) AddTenantIndustry ──────────────────────────────────── */
|
||||
IF OBJECT_ID('AML_TenantIndustrys') IS NULL
|
||||
CREATE TABLE AML_TenantIndustrys (
|
||||
Id uniqueidentifier NOT NULL CONSTRAINT PK_AML_TenantIndustrys PRIMARY KEY,
|
||||
Code nvarchar(64) NOT NULL,
|
||||
Name nvarchar(256) NULL,
|
||||
EditionId uniqueidentifier NULL, -- 行业→Edition 映射,购买时用;由后台维护
|
||||
DisplayOrder int NOT NULL,
|
||||
Enabled bit NOT NULL,
|
||||
ExtraProperties nvarchar(max) NULL,
|
||||
ConcurrencyStamp nvarchar(40) NULL,
|
||||
CreationTime datetime2 NOT NULL,
|
||||
CreatorId uniqueidentifier NULL,
|
||||
LastModificationTime datetime2 NULL,
|
||||
LastModifierId uniqueidentifier NULL,
|
||||
IsDeleted bit NOT NULL CONSTRAINT DF_AML_TenantIndustrys_IsDeleted DEFAULT 0,
|
||||
DeleterId uniqueidentifier NULL,
|
||||
DeletionTime datetime2 NULL
|
||||
);
|
||||
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'UIX_AML_TenantIndustrys_Code')
|
||||
CREATE UNIQUE INDEX UIX_AML_TenantIndustrys_Code ON AML_TenantIndustrys(Code);
|
||||
|
||||
-- 迁移里的 10 条行业种子(原 TenantIndustry.json),EditionId 留空
|
||||
MERGE AML_TenantIndustrys AS t
|
||||
USING (VALUES
|
||||
('A1B2C3D4-0001-4A01-9A01-000000000001', 'Crypto', 'Crypto - crypto currency', 10),
|
||||
('A1B2C3D4-0002-4A02-9A02-000000000002', 'DPMS', 'DPMS - precious metal and stone', 20),
|
||||
('A1B2C3D4-0003-4A03-9A03-000000000003', 'Insurance', 'Insurance', 30),
|
||||
('A1B2C3D4-0004-4A04-9A04-000000000004', 'MSO', 'MSO - Money Services Operator', 40),
|
||||
('A1B2C3D4-0005-4A05-9A05-000000000005', 'NGO', 'NGO - Non-profit Organization', 50),
|
||||
('A1B2C3D4-0006-4A06-9A06-000000000006', 'RealEstate', 'Real Estate - real estate agents', 60),
|
||||
('A1B2C3D4-0007-4A07-9A07-000000000007', 'SecuritiesTrades', 'Securities Trades', 70),
|
||||
('A1B2C3D4-0008-4A08-9A08-000000000008', 'TCSP', 'TCSP - Trust and Company Services', 80),
|
||||
('A1B2C3D4-0009-4A09-9A09-000000000009', 'CPA', 'CPA', 90),
|
||||
('A1B2C3D4-0010-4A10-9A10-000000000010', 'Others', 'Others', 100)
|
||||
) AS s (Id, Code, Name, DisplayOrder) ON t.Code = s.Code
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (Id, Code, Name, DisplayOrder, Enabled, CreationTime, IsDeleted)
|
||||
VALUES (CONVERT(uniqueidentifier, s.Id), s.Code, s.Name, s.DisplayOrder, 1, '2026-07-23T00:00:00', 0);
|
||||
|
||||
/* ── 6) AddTenantIndustryNameTranslations ──────────────────── */
|
||||
-- 行业名称多语言 JSON:{"zh-Hans":"","zh-Hant":"","en":"","ja":""},可空
|
||||
IF COL_LENGTH('AML_TenantIndustrys', 'NameTranslations') IS NULL
|
||||
ALTER TABLE AML_TenantIndustrys ADD NameTranslations nvarchar(max) NULL;
|
||||
|
||||
PRINT '本地库架构补齐完成';
|
||||
|
|
|
|||
Loading…
Reference in New Issue