fix: Scheduler 用 slug 构建 tenant schema 名

tenant schema 是 it0_t_{slug}(如 it0_t_default),不是 it0_t_{uuid}。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-23 05:03:04 -08:00
parent 09274aa6af
commit 1c291ce6c0
1 changed files with 3 additions and 3 deletions

View File

@ -60,10 +60,10 @@ export class StandingOrderExecutorService implements OnModuleInit {
*/
@Cron('*/1 * * * *')
async scanCronOrders(): Promise<void> {
let tenants: { id: string; name: string }[];
let tenants: { id: string; name: string; slug: string }[];
try {
const result = await this.dataSource.query(
`SELECT id, name FROM public.tenants WHERE status = 'active'`,
`SELECT id, name, slug FROM public.tenants WHERE status = 'active'`,
);
tenants = result;
} catch (err) {
@ -81,7 +81,7 @@ export class StandingOrderExecutorService implements OnModuleInit {
tenantId: tenant.id,
tenantName: tenant.name,
plan: 'pro',
schemaName: `it0_t_${tenant.id}`,
schemaName: `it0_t_${tenant.slug}`,
},
async () => {
const activeOrders =