c4ys/doctrine-snowflakes-bundle
@CustomIdGenerator, avoiding breaking changes to existing @GeneratedValue workflows.laravel-doctrine), integration is straightforward.@GeneratedValue("AUTO") must be updated to CUSTOM strategy, requiring schema/DB migrations.doctrine/orm, doctrine/doctrine-bundle (if using Symfony/Laravel bridge).ramsey/uuid (if hybrid UUID/snowflake use cases emerge).ON DELETE CASCADE may fail with non-sequential IDs).SERIAL)?laravel-doctrine/orm.Ramsey\Uuid or Laravel’s Str::uuid() instead.Phase 1: Pilot Entity
// Before
@ORM\GeneratedValue("AUTO")
// After
@ORM\GeneratedValue("CUSTOM")
@ORM\CustomIdGenerator(class="KaiGrassnick\DoctrineSnowflakeBundle\Generator\SnowflakeGenerator")
Phase 2: Gradual Rollout
AUTO and CUSTOM in the same table.bigint columns are indexed for performance.Phase 3: Deprecate Auto-Increment
AUTO strategy entirely.ON DELETE SET NULL).match expression usage in generator).composer require c4ys/doctrine-snowflakes-bundle.config/bundles.php (Symfony) or manually register in Laravel’s service container.worker_id and datacenter_id in config/packages/doctrine_snowflake.yaml:
kai_grassnick_doctrine_snowflake:
worker_id: %env(int:WORKER_ID, 1)%
datacenter_id: %env(int:DATACENTER_ID, 1)%
SnowflakeGenerator for custom bit allocations (e.g., more worker IDs).generate() method for hybrid ID strategies (e.g., snowflake + hash).NTP and monitor systemd-timesyncd (Linux) or W32Time (Windows).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Clock desync (>1ms) | Duplicate IDs | Enforce NTP, add skew buffer in config. |
| Worker ID collision | Data corruption | Unique worker_id per deployment. |
| Database connection loss | ID generation fails | Retry with exponential backoff. |
| Bundle version incompatibility | ORM errors | Pin version in composer.json. |
| Migration rollback | Mixed ID strategies | Use feature flags for gradual rollout. |
42-bit timestamp + 10-bit worker + 12-bit sequence).SELECT id FROM table WHERE id & 0xFFFFFFFF00000000 = X to debug worker IDs).How can I help you explore Laravel packages today?