PHPackages                             cap-collectif/id-to-uuid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. cap-collectif/id-to-uuid

ActiveLibrary

cap-collectif/id-to-uuid
========================

Easily migrate from auto incremented id to uuid

v2.1.0(5y ago)1766.9k15[4 issues](https://github.com/cap-collectif/id-to-uuid/issues)[2 PRs](https://github.com/cap-collectif/id-to-uuid/pulls)MITPHP

Since Jun 21Pushed 2y ago15 watchersCompare

[ Source](https://github.com/cap-collectif/id-to-uuid)[ Packagist](https://packagist.org/packages/cap-collectif/id-to-uuid)[ RSS](/packages/cap-collectif-id-to-uuid/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (4)Versions (7)Used By (0)

id-to-uuid
==========

[](#id-to-uuid)

Easily migrate from an auto incremented integer id to a [uuid](https://en.wikipedia.org/wiki/Universally_unique_identifier) in a project using [DoctrineMigrationsBundle](https://github.com/doctrine/DoctrineMigrationsBundle). Autodetect your foreign keys and update them. Supported databases: **MySQL, Postgres**.

Installation
------------

[](#installation)

```
composer require cap-collectif/id-to-uuid
# install for postgres support
composer require ramsey/uuid

```

Usage
-----

[](#usage)

1. Update your `id` column from `integer` to `guid`:

```
# User.orm.xml

---
---
+++
+++

 #...

```

Alternatively you can use [uuid-doctrine](https://github.com/ramsey/uuid-doctrine) to add `uuid` type support.

```

```

2. Add a new migration:

```
// app/DoctrineMigrations/VersionXYZ.php
