Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding migrations for jos_auth_link and jos_auth_domain to speed up s… #1446

Merged
merged 5 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions core/migrations/Migration20200917000000AuthLinkIndex.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

use Hubzero\Content\Migration\Base;

// no direct access
defined('_HZEXEC_') or die();

/**
* Migration script for adding indexes to the #__auth_link table.
**/
class Migration202000171000000AuthLinkIndex extends Base
{
public function up()
{
if ($this->db->tableExists('#__auth_link'))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only Run IF the index isn't already there.

{
$query = "ALTER TABLE `#__auth_link` ADD INDEX auth_domain_id_idx (auth_domain_id);";
$this->db->setQuery($query);
$this->db->query();

$query = "ALTER TABLE `#__auth_link` ADD INDEX user_id_idx (user_id);";
$this->db->setQuery($query);
$this->db->query();
}
}

public function down()
{
if ($this->db->tableExists('#__auth_link'))
{
$query = "ALTER TABLE `#__auth_link` DROP INDEX auth_domain_id_idx;";
$this->db->setQuery($query);
$this->db->query();

$query = "ALTER TABLE `#__auth_link` DROP INDEX user_id_idx;";
$this->db->setQuery($query);
$this->db->query();
}
}

}
33 changes: 33 additions & 0 deletions core/migrations/Migration20200917100000AuthDomainIndex.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Hubzero\Content\Migration\Base;

// no direct access
defined('_HZEXEC_') or die();

/**
* Migration script for adding indexes to the #__auth_domain table.
**/
class Migration202000171000000AuthDomainIndex extends Base
{
public function up()
{
if ($this->db->tableExists('#__auth_domain'))
{
$query = "ALTER TABLE `#__auth_domain` ADD INDEX authenticator_idx (authenticator);";
$this->db->setQuery($query);
$this->db->query();
}
}

public function down()
{
if ($this->db->tableExists('#__auth_domain'))
{
$query = "ALTER TABLE `#__auth_domain` DROP INDEX authenticator_idx;";
$this->db->setQuery($query);
$this->db->query();
}
}

}