viragtripathi opened a new pull request, #69555: URL: https://github.com/apache/airflow/pull/69555
Migration 0042 adds a UUID primary key to the task_instance table. Its PostgreSQL branch creates a uuid_generate_v7() helper with PL/pgSQL and pgcrypto, and drops the old primary key before creating the new one. Neither works on the cockroachdb dialect: there is no pgcrypto extension, and the engine refuses to drop a primary key without a replacement in the same statement, so `airflow db migrate --use-migration-files` cannot complete there. This adds a cockroachdb branch that mirrors the existing sqlite approach to UUID generation: values come from uuid6.uuid7() client side, backfilled with keyset pagination over the composite key in executemany batches. The primary key is swapped atomically with ALTER TABLE ... ALTER PRIMARY KEY USING COLUMNS (id), and _get_type_id_column returns the native UUID type for cockroachdb, matching what the ORM's Uuid() column renders on that dialect. Other dialects are untouched. Both upgrade and downgrade were executed against CockroachDB v26.3 with a 2,500 row harness. The resulting constraint and index set matches the PostgreSQL path exactly: task_instance_pkey on id plus the task_instance_composite_key unique constraint. Discussed on the devlist: https://lists.apache.org/thread/t6jo4th3sn23jmr34m6gcxzw4k8mo4pc --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes - Claude Code Generated-by: Claude Code following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
