chore(server): let seed-base-rows script take row count via env var

This commit is contained in:
Philipinho
2026-04-18 22:44:52 +01:00
parent 2f6bad141c
commit a9ea2a99b4
+3 -2
View File
@@ -6,7 +6,7 @@ import postgres from 'postgres';
import { v7 as uuid7 } from 'uuid';
import { generateJitteredKeyBetween } from 'fractional-indexing-jittered';
const TOTAL_ROWS = 1500;
const TOTAL_ROWS = Number(process.env.TOTAL_ROWS) || 1500;
const BATCH_SIZE = 2000;
const envFilePath = path.resolve(process.cwd(), '..', '..', '.env');
@@ -167,7 +167,8 @@ function buildCellGenerator(property: any): CellGenerator | null {
async function createBase(workspaceId: string, spaceId: string, creatorId: string | null): Promise<string> {
const baseId = uuid7();
const baseName = `Seed Base ${new Date().toISOString().slice(0, 16)}`;
const rowCountLabel = TOTAL_ROWS >= 1000 ? `${Math.round(TOTAL_ROWS / 1000)}K` : `${TOTAL_ROWS}`;
const baseName = `Seed Base ${rowCountLabel} rows`;
await db.insertInto('bases').values({
id: baseId,