m190518_014619_soft_delete_users_fix::safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace dukt\social\migrations;
4
5
use craft\db\Migration;
6
use craft\helpers\MigrationHelper;
7
8
/**
9
 * m190518_014619_soft_delete_users_fix migration.
10
 */
11
class m190518_014619_soft_delete_users_fix extends Migration
12
{
13
    /**
14
     * @inheritdoc
15
     */
16
    public function safeUp()
17
    {
18
        // Unique social UID should no longer be enforced by the DB to avoid conflicts with soft-deleted users.
19
        MigrationHelper::dropIndexIfExists('{{%social_login_accounts}}', ['providerHandle', 'socialUid'], true, $this);
20
    }
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function safeDown()
26
    {
27
        echo "m190518_014619_soft_delete_users_fix cannot be reverted.\n";
28
        return false;
29
    }
30
}
31