:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(persons): allow the restore lifecycle op type (#117422)
Eli Reisman1333170d9f68
diff --git a/rust/persons_migrations/20261014000001_add_restore_lifecycle_op_type.sql b/rust/persons_migrations/20261014000001_add_restore_lifecycle_op_type.sqlnew file mode 100644index 000000000000..e385eda5b6e7--- /dev/null+++ b/rust/persons_migrations/20261014000001_add_restore_lifecycle_op_type.sql@@ -0,0 +1,15 @@+-- The person consistency repair claims lifecycle marks as op_type 'restore'.+--+-- SAFE: NOT VALID skips the table scan, so the swap holds ACCESS EXCLUSIVE only briefly;+-- lock_timeout bounds the wait, so the migration fails fast instead of queueing ingestion+-- merges behind it. The next migration validates in its own transaction. Idempotent.++SET LOCAL lock_timeout = '2s';++ALTER TABLE lifecycle_op DROP CONSTRAINT IF EXISTS lifecycle_op_op_type_check;+ALTER TABLE lifecycle_op ADD CONSTRAINT lifecycle_op_op_type_check+ CHECK (op_type IN ('merge', 'delete', 'restore')) NOT VALID;++ALTER TABLE lifecycle_op_tmp DROP CONSTRAINT IF EXISTS lifecycle_op_tmp_op_type_check;+ALTER TABLE lifecycle_op_tmp ADD CONSTRAINT lifecycle_op_tmp_op_type_check+ CHECK (op_type IN ('merge', 'delete', 'restore')) NOT VALID;diff --git a/rust/persons_migrations/20261014000002_validate_restore_lifecycle_op_type.sql b/rust/persons_migrations/20261014000002_validate_restore_lifecycle_op_type.sqlnew file mode 100644index 000000000000..c93dc1501f7c--- /dev/null+++ b/rust/persons_migrations/20261014000002_validate_restore_lifecycle_op_type.sql@@ -0,0 +1,7 @@+-- Validate the op_type constraints added NOT VALID by the previous migration.+--+-- SAFE: VALIDATE CONSTRAINT takes SHARE UPDATE EXCLUSIVE, which does not block inserts, updates or+-- deletes, so ingestion merges keep running during the scan. Idempotent.++ALTER TABLE lifecycle_op VALIDATE CONSTRAINT lifecycle_op_op_type_check;+ALTER TABLE lifecycle_op_tmp VALIDATE CONSTRAINT lifecycle_op_tmp_op_type_check;