forked from directus/v8-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
392 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
return [ | ||
'paths' => [ | ||
'migrations' => '%%PHINX_CONFIG_DIR%%/../migrations/upgrades/schemas', | ||
'seeds' => '%%PHINX_CONFIG_DIR%%/../migrations/upgrades/seeds' | ||
], | ||
|
||
'version_order' => 'creation', | ||
|
||
'environments' => [ | ||
'default_migration_table' => 'directus_migrations', | ||
] | ||
]; |
159 changes: 159 additions & 0 deletions
159
migrations/upgrades/schemas/20181022175715_upgrade_070003.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class Upgrade070003 extends AbstractMigration | ||
{ | ||
public function up() | ||
{ | ||
// ---------------------------------------------------------------------------- | ||
// Fix directus_users.timezone placeholder text | ||
// ---------------------------------------------------------------------------- | ||
$options = json_encode([ | ||
'choices' => [ | ||
'America/Puerto_Rico' => 'Puerto Rico (Atlantic)', | ||
'America/New_York' => 'New York (Eastern)', | ||
'America/Chicago' => 'Chicago (Central)', | ||
'America/Denver' => 'Denver (Mountain)', | ||
'America/Phoenix' => 'Phoenix (MST)', | ||
'America/Los_Angeles' => 'Los Angeles (Pacific)', | ||
'America/Anchorage' => 'Anchorage (Alaska)', | ||
'Pacific/Honolulu' => 'Honolulu (Hawaii)' | ||
], | ||
'placeholder' => 'Choose a timezone...' | ||
]); | ||
|
||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_fields', | ||
['options' => $options], | ||
['collection' => 'directus_users', 'field' => 'timezone'] | ||
)); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Update directus_users.roles interface from "many-to-many" to "user-roles" | ||
// Set directus_users.roles hidden_detail and hidden_browse attribute to "false" | ||
// Update directus_users.roles width to 2 | ||
// Update directus_users.roes sort to 8 | ||
// ---------------------------------------------------------------------------- | ||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_fields', | ||
[ | ||
'interface' => 'user-roles', | ||
'hidden_detail' => 0, | ||
'hidden_browse' => 0, | ||
'width' => 2, | ||
'sort' => 8, | ||
], | ||
[ | ||
'collection' => 'directus_users', | ||
'field' => 'roles' | ||
] | ||
)); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Update directus_users.locale_options hidden_detail attribute to "true" | ||
// ---------------------------------------------------------------------------- | ||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_fields', | ||
[ | ||
'hidden_detail' => 1, | ||
], | ||
[ | ||
'collection' => 'directus_users', | ||
'field' => 'locale_options' | ||
] | ||
)); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Update directus_settings "logo" interface from "single_file" to "file" | ||
// ---------------------------------------------------------------------------- | ||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_fields', | ||
[ | ||
'interface' => 'file', | ||
], | ||
[ | ||
'collection' => 'directus_settings', | ||
'field' => 'logo' | ||
] | ||
)); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Update directus_user_roles user_id field to user in directus_fields | ||
// ---------------------------------------------------------------------------- | ||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_fields', | ||
[ | ||
'field' => 'user', | ||
], | ||
[ | ||
'collection' => 'directus_user_roles', | ||
'field' => 'user_id' | ||
] | ||
)); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Update directus_user_roles role_id field to role in directus_fields | ||
// ---------------------------------------------------------------------------- | ||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_fields', | ||
[ | ||
'field' => 'role', | ||
], | ||
[ | ||
'collection' => 'directus_user_roles', | ||
'field' => 'role_id' | ||
] | ||
)); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Update directus_users.password width attribute to 2 | ||
// ---------------------------------------------------------------------------- | ||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_fields', | ||
[ | ||
'width' => 2, | ||
], | ||
[ | ||
'collection' => 'directus_users', | ||
'field' => 'password' | ||
] | ||
)); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Update directus_users fields sort value | ||
// ---------------------------------------------------------------------------- | ||
$fields = [ | ||
'company' => 9, | ||
'title' => 10, | ||
'timezone' => 11, | ||
'locale' => 12, | ||
'locale_options' => 13, | ||
'token' => 14, | ||
'last_login' => 15, | ||
'last_access_on' => 16, | ||
'avatar' => 18, | ||
]; | ||
|
||
foreach ($fields as $field => $sort) { | ||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_fields', | ||
[ | ||
'sort' => $sort, | ||
], | ||
[ | ||
'collection' => 'directus_users', | ||
'field' => $field | ||
] | ||
)); | ||
} | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Directus\Api\Routes; | ||
|
||
use Directus\Application\Http\Request; | ||
use Directus\Application\Http\Response; | ||
use Directus\Application\Route; | ||
use function Directus\get_api_project_from_request; | ||
use Directus\Util\Installation\InstallerUtils; | ||
|
||
class ProjectUpdate extends Route | ||
{ | ||
public function __invoke(Request $request, Response $response) | ||
{ | ||
InstallerUtils::updateTables($this->container->get('path_base'), get_api_project_from_request()); | ||
|
||
$response = $response->withStatus(204); | ||
return $this->responseWithData($request, $response, []); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.