返回 Skill 列表
extension
分类: 开发与工程无需 API Key

iiot-seed/core

IIoT数据库播种CLI,使用@gbg/ctl构建

person作者: jakexiaohubgithub

iiot-seed/core

CLI tool for seeding the IIoT database with mock data.

When to Use

  • Need to seed IIoT database with test data
  • Need to check current data statistics
  • Need to clear mock data

Commands

seed

Seed the database with mock data.

# Default (fast mode, all data)
bun run src/lib/iiot/seed/ctl/src/index.ts seed

# Validated mode (schema validation)
bun run src/lib/iiot/seed/ctl/src/index.ts seed --mode validated

# Assets only (skip readings/alarms)
bun run src/lib/iiot/seed/ctl/src/index.ts seed --assets-only

# Clear before seeding
bun run src/lib/iiot/seed/ctl/src/index.ts seed --clear --verbose

stats

Show current data statistics.

bun run src/lib/iiot/seed/ctl/src/index.ts stats

clear

Clear all mock data.

bun run src/lib/iiot/seed/ctl/src/index.ts clear

Options

| Option | Alias | Description | |--------|-------|-------------| | --mode | -m | fast (generate_series) or validated (repo batch) | | --clear | -c | Clear existing mock data before seeding | | --assets-only | -a | Only seed assets (skip readings/alarms) | | --verbose | -v | Show detailed output |

Architecture

Uses tiered seeding approach:

  • Tier 1: Assets/Alarms via repos (full validation)
  • Tier 2: Readings via generate_series (performance)

Layer Composition

const FullSeedLayer = Layer.merge(
  SeedPgClientWithMigrations,  // PgClient + Migrator
  IIoTRepositoriesLive         // All repos
)

Database

  • Host: localhost:5433
  • Database: iiot_mock
  • User: iiot

Ensure database is running:

docker compose -f docker/docker-compose.iiot.yml up -d