feat(db): add automations.group_name

Merged
KI
1d ago
+17316-0

Stack (merge in order)

  1. this PR: migration
  2. API, CLI, MCP: base kiet/automation-groups-migration
  3. Desktop UI: base kiet/automation-groups-api

Walkthrough with a film: https://app.superset.sh/page/automation-groups-mlki3d

Summary

  • Adds a nullable automations.group_name text column. It groups an automation in the automations table (one group per automation, like a folder).
  • Kept apart from automations.tags, which tag each run's workspace into sidebar folders and default to ["automation"].

Migration

ALTER TABLE "automations" ADD COLUMN "group_name" text;

Generated with drizzle-kit generate on top of main's 0180_dynamic_client_scopes; nothing hand-edited.

Safety checklist (.agents/skills/db-migrations)

  • One statement: ADD COLUMN that is nullable with no default. Postgres records it in the catalog only, so it does not rewrite or scan the table and runs in constant time at any size.
  • No type change, no constraint, no foreign key, so no lock-order concern (rule 3).
  • automations is not one of the hot tables in rule 4. It takes a brief ACCESS EXCLUSIVE for the catalog update only.
  • No reads move to a new table (rule 5).
  • No tRPC change in this PR (#7726 rule); the API is the next PR.
  • Production size: the superset-home review applied it on a production-child Neon branch (automations: 2,727 rows) in 22 ms inside a transaction, then rolled it back. Not rehearsed under load: the statement is metadata-only and the table is not on the hot list.

Testing

  • Applied to this workspace's own Neon branch with bun run migrate.
  • bunx tsc --noEmit -p packages/db

Rollback

Forward-only is fine: nothing reads the column until PR 2 ships. To undo, drop the column in a new migration.


Summary by cubic

Adds a nullable automations.group_name column so automations can be grouped in the automations list. It's separate from automations.tags, which tags each run's workspace into sidebar folders.

Because the column is nullable with no default, the migration only updates the Postgres catalog: no table rewrite or scan, and it runs in constant time at any size. Nothing reads the column yet; API, CLI, MCP, and UI changes ship as follow-up PRs.

Summary by CodeRabbit

  • New Features
    • Automations can now be assigned to groups, making them easier to organize in the automations list.