<?xml version="1.0" encoding="UTF-8"?>

<!--

 This file is part of the Sylius package.

 (c) Paweł Jędrzejewski

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <mapped-superclass name="Sylius\Component\Core\Model\UserOAuth" table="sylius_user_oauth">
        <id name="id" column="id" type="integer">
            <generator strategy="AUTO" />
        </id>

        <field name="provider" type="string" />
        <field name="identifier" type="string" />
        <field name="accessToken" column="access_token" type="string" nullable="true" />

        <many-to-one field="user" target-entity="Sylius\Component\Core\Model\UserInterface" inversed-by="oauthAccounts">
            <join-column name="user_id" referenced-column-name="id" />
        </many-to-one>
    </mapped-superclass>

</doctrine-mapping>

<?xml version="1.0" encoding="UTF-8"?>

<!--

 This file is part of the Sylius package.

 (c) Paweł Jędrzejewski

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <mapped-superclass name="Sylius\Component\Core\Model\UserOAuth" table="sylius_user_oauth">
        <id name="id" column="id" type="integer">
            <generator strategy="AUTO" />
        </id>

        <unique-constraints>
            <unique-constraint columns="user_id,provider" name="user_provider" />
        </unique-constraints>

        <field name="provider" type="string" />
        <field name="identifier" type="string" />
        <field name="accessToken" column="access_token" type="string" nullable="true" />

        <many-to-one field="user" target-entity="Sylius\Component\Core\Model\UserInterface" inversed-by="oauthAccounts">
            <join-column name="user_id" referenced-column-name="id" />
        </many-to-one>
    </mapped-superclass>

</doctrine-mapping>

Add missing unique index to Doctrine mapping of UserOAuth entity
[Core] Add missing unique index to Doctrine mapping of UserOAuth entity
