8000 GitHub - habbim/id-to-uuid: 🏆 Id to Uuid migration classes for Doctrine
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🏆 Id to Uuid migration classes for Doctrine

License

Notifications You must be signed in to change notification settings

habbim/id-to-uuid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

id-to-uuid

Easily migrate from an auto incremented integer id to a uuid in a project using DoctrineMigrationsBundle. Autodetect your foreign keys and update them. Works only on MySQL.

Installation

composer require habbim/id-to-uuid

Usage

  1. Update your id column from integer to guid:
# User.orm.xml
<entity name="AppBundle\Entity\User" table="user">
---    <id name="id" column="id" type="integer">
---        <generator strategy="AUTO" />
+++    <id name="id" column="id" type="uuid_binary_ordered_time">
+++        <generator strategy="CUSTOM"/>
+++        <custom-id-generator class="Ramsey\Uuid\Doctrine\UuidGenerator"/>           
    </id>
 #...
</entity>
  1. Config your symfony:

Click here

  1. Add a new migration:
// app/DoctrineMigrations/VersionXYZ.php
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Habbim\IdToUuid\IdToUuidMigration;

class VersionXYZ extends IdToUuidMigration
{
    public function postUp(Schema $schema)
    {
        $this->migrate('user');
    }
}

About

🏆 Id to Uuid migration classes for Doctrine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%
0