HEX
Server: Apache
System: Linux server1.ariadata.co 4.18.0-553.120.1.el8_10.x86_64 #1 SMP Mon Apr 20 18:04:27 EDT 2026 x86_64
User: nepi (1051)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,show_source,popen,proc_open
Upload Files
File: /home/nepi/www/migrations/upgrades/20191202164207_update_directus_roles.php
<?php

use Phinx\Migration\AbstractMigration;

class UpdateDirectusRoles extends AbstractMigration
{
  public function change() {
    $rolesTable = $this->table('directus_roles');

    // -------------------------------------------------------------------------
    // Remove unused nav_blacklist column
    // -------------------------------------------------------------------------
    if ($rolesTable->hasColumn('nav_blacklist')) {
        $rolesTable->removeColumn('nav_blacklist');
    }

    // -------------------------------------------------------------------------
    // Remove deprecated nav_override
    // -------------------------------------------------------------------------
    if ($rolesTable->hasColumn('nav_override')) {
        $rolesTable->removeColumn('nav_override');
    }

    // -------------------------------------------------------------------------
    // Add module_listing column
    // -------------------------------------------------------------------------
    if ($rolesTable->hasColumn('module_listing') == false) {
        $rolesTable->addColumn('module_listing', 'string', [
            'null' => true,
            'default' => null
        ]);
    }

    // -------------------------------------------------------------------------
    // Add collection_listing column
    // -------------------------------------------------------------------------
    if ($rolesTable->hasColumn('collection_listing') == false) {
        $rolesTable->addColumn('collection_listing', 'string', [
            'null' => true,
            'default' => null
        ]);
    }

    // -------------------------------------------------------------------------
    // Add enforce_2fa column
    // -------------------------------------------------------------------------
    if ($rolesTable->hasColumn('enforce_2fa') == false) {
        $rolesTable->addColumn('enforce_2fa', 'integer', [
            'null' => true,
            'default' => false
        ]);
    }

    // -------------------------------------------------------------------------
    // Save changes to table
    // -------------------------------------------------------------------------
    $rolesTable->save();
  }
}