OUT-3645: add pending_action tombstone columns#104
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds five
Confidence Score: 5/5Safe to merge — purely additive schema change with no reads or writes of the new columns in this PR. All five new columns are nullable or carry safe defaults, existing rows are unaffected, and the CHECK constraint is correctly tracked by both the raw SQL migration and the Drizzle schema+snapshot so future migrations won't drop it. The change introduces no new code paths. No files require special attention. The migration SQL is straightforward and self-consistent with the Drizzle schema and snapshot. Important Files Changed
Entity Relationship Diagram%%{init: {'theme': 'neutral'}}%%
erDiagram
file_folder_sync {
uuid id PK
varchar portal_id
uuid channel_sync_id FK
object_types object
pending_action_enum pending_action "nullable"
pending_action_target_enum pending_action_target "nullable"
integer pending_action_attempts "DEFAULT 0 NOT NULL"
timestamptz pending_action_last_attempt_at "nullable"
text pending_action_last_error "nullable"
}
pending_action_enum {
string delete
string create
string update
}
pending_action_target_enum {
string assembly
string dropbox
}
file_folder_sync }o--|| pending_action_enum : "pending_action"
file_folder_sync }o--|| pending_action_target_enum : "pending_action_target"
Reviews (2): Last reviewed commit: "feat(OUT-3645): add pending_action tombs..." | Re-trigger Greptile |
| @@ -22,6 +27,11 @@ export const fileFolderSync = pgTable('file_folder_sync', { | |||
| contentHash: varchar(), | |||
| dbxFileId: varchar(), | |||
| assemblyFileId: uuid(), | |||
| pendingAction: PendingActionEnum(), | |||
| pendingActionTarget: PendingActionTargetEnum(), | |||
| pendingActionAttempts: integer().notNull().default(0), | |||
| pendingActionLastAttemptAt: timestamp({ withTimezone: true, mode: 'date' }), | |||
| pendingActionLastError: text(), | |||
| ...timestampsWithSoftDelete, | |||
| }) | |||
There was a problem hiding this comment.
CHECK constraint invisible to Drizzle — will be dropped on next migration
The file_folder_sync_pending_action_target_consistency CHECK constraint is only declared in the raw SQL migration, not in the Drizzle schema definition. The snapshot's checkConstraints for file_folder_sync is therefore {}. When a future PR runs drizzle-kit generate, Drizzle will diff the schema (no constraint) against the database (constraint present) and emit a DROP CONSTRAINT statement, silently removing the guard.
Add the constraint to the table definition using Drizzle's check() and regenerate the snapshot so Drizzle tracks the constraint going forward.
| # Sentry Config File | ||
| .env.sentry-build-plugin | ||
|
|
||
| docs No newline at end of file |
There was a problem hiding this comment.
Additive migration. Adds pending_action, pending_action_target, pending_action_attempts, pending_action_last_attempt_at, and pending_action_last_error columns plus a CHECK constraint enforcing that pending_action and pending_action_target are both set or both null. Also gitignores docs/ for spec and plan artifacts. Subsequent PRs populate these columns from per-file handlers and read from the resync sweeper. PR 1 is observation-only — no code reads or writes the new columns yet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c76a606 to
efa43a6
Compare
d75d5a1
into
feature/refresh-sync-OUT-3645
Summary
pending_action,pending_action_target,pending_action_attempts,pending_action_last_attempt_at,pending_action_last_errorcolumns tofile_folder_syncvia an additive Drizzle migration.file_folder_sync_pending_action_target_consistencyenforces thatpending_actionandpending_action_targetare both set or both null — prevents application bugs from creating half-set rows the sweeper can't process.PendingAction('delete' | 'create' | 'update') andPendingActionTarget('assembly' | 'dropbox') insrc/db/constants.ts. Postgres enum type names arepending_action_enum/pending_action_target_enum(suffix differentiates them from the column names).docs/to keep design specs and plans out of the repo.Why this lives behind a feature branch
This is PR 1 of a multi-PR rollout (
feature/refresh-sync-OUT-3645). Future PRs will target the same feature branch:Test plan
CREATE TYPEs (with_enumsuffix), fiveALTER TABLE ADD COLUMNs with correct nullability/defaults, and theADD CONSTRAINTline.pnpm typecheck— should exit 0.pnpm lint— should exit 0.\d file_folder_syncthat the five columns and the CHECK constraint exist.INSERT INTO file_folder_sync (..., pending_action) VALUES (..., 'delete')— expect a constraint violation.🤖 Generated with Claude Code