Skip to content
iiot-seed/core logo

iiot-seed/core

IIoT database seeding CLI built with @gbg/ctl

SKILL.md

Full skill instructions

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

OptionAliasDescription
--mode-mfast (generate_series) or validated (repo batch)
--clear-cClear existing mock data before seeding
--assets-only-aOnly seed assets (skip readings/​alarms)
--verbose-vShow 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