Powersync add synced table two pr flow
Skill kjuhwa/skills-hub/skills/powersync/powersync-add-synced-table-two-pr-flow
Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.
npx -y skills add kjuhwa/skills-hub --skill powersync-add-synced-table-two-pr-flowAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Add a new PowerSync-synced table across frontend SQLite, backend Postgres, shared table registry, and sync-rules YAML using a strict two-PR process so the frontend never ships before the PowerSync Cloud dashboard rules exist.
SKILL.md
3.2 KB, 609 tokens by cl100k_base, as published. Nobody here has run it
When to use
You are adding a brand-new PowerSync-synced table to an app where the backend schema, shared table registry, sync-rules YAML, and frontend schema all have to stay in lock-step with PowerSync Cloud's dashboard rules.
Steps
PR 1 — backend only
- Add the table to the backend Drizzle schema file (e.g.
backend/src/db/powersync-schema.ts). Include auser_idcolumn and exactly one index:index('idx_<table>_user_id').on(table.userId). - Generate and register the Drizzle migration with
bun db generate. Verify the new entry appears inbackend/drizzle/meta/_journal.json— Drizzle discovers pending migrations through the journal, not the file system, so a missing entry means the migration will never run. - Update
shared/powersync-tables.ts: add the table name toPOWERSYNC_TABLE_NAMESand wire its React Query keys inpowersyncTableToQueryKeys. - Add a sync rule line under
bucket_definitions.user_data.datainpowersync-service/config/config.yaml:- SELECT * FROM <table> WHERE <table>.user_id = bucket.user_id. - For default-data tables, use a composite PK
(id, user_id)or(key, user_id)and updatepowersyncConflictTargetin the backend schema. - Merge PR 1. Run the migration in production. Then update sync rules in the PowerSync Cloud dashboard so they match
config.yaml.
PR 2 — frontend + feature code
- Add the table to
src/db/tables.ts(frontend SQLite schema). Single-columnidorkeyis fine — the frontend is per-user, so composite PKs are not needed locally. - Register the table in
src/db/powersync/schema.ts(drizzleSchema). - Add any UI, DAL, and feature logic.
- Merge PR 2 only after PR 1 is fully deployed and PowerSync Cloud dashboard rules are live.
Counter / Caveats
- Shipping PR 2 before the dashboard rules are updated causes silent sync failure: the table works locally but nothing replicates across devices, and there is no error surface.
- Do not add composite foreign keys or secondary indexes to the backend schema — see the linked
powersync-backend-minimal-indexesknowledge for rationale. - Cherry-picking migration SQL across branches without the matching
_journal.jsonentry is a common failure mode; re-runbun db generateafter cherry-picks.
Evidence
CLAUDE.md:82-93— deploying new synced tables (two-PR process) and journal warningdocs/powersync-account-devices.md:51-72— full adding-a-new-table stepspowersync-service/config/config.yaml— sync rule format
What ships with it: 1 file
1.9 KB alongside SKILL.md
- content.md1.9 KB