|
|
|
|
@ -47,20 +47,23 @@ class Version011603Date20230620111039 extends SimpleMigrationStep { |
|
|
|
|
if ($schema->hasTable('oauth2_access_tokens')) { |
|
|
|
|
$table = $schema->getTable('oauth2_access_tokens'); |
|
|
|
|
$dbChanged = false; |
|
|
|
|
if (!$table->hasColumn('created_at') || !$table->hasColumn('token_count')) { |
|
|
|
|
$dbChanged = true; |
|
|
|
|
} |
|
|
|
|
if (!$table->hasColumn('created_at')) { |
|
|
|
|
$table->addColumn('created_at', Types::BIGINT, [ |
|
|
|
|
'notnull' => true, |
|
|
|
|
'default' => 0, |
|
|
|
|
]); |
|
|
|
|
$dbChanged = true; |
|
|
|
|
} |
|
|
|
|
if (!$table->hasColumn('token_count')) { |
|
|
|
|
$table->addColumn('token_count', Types::BIGINT, [ |
|
|
|
|
'notnull' => true, |
|
|
|
|
'default' => 0, |
|
|
|
|
]); |
|
|
|
|
$dbChanged = true; |
|
|
|
|
} |
|
|
|
|
if (!$table->hasIndex('oauth2_tk_c_created_idx')) { |
|
|
|
|
$table->addIndex(['token_count', 'created_at'], 'oauth2_tk_c_created_idx'); |
|
|
|
|
$dbChanged = true; |
|
|
|
|
} |
|
|
|
|
if ($dbChanged) { |
|
|
|
|
return $schema; |
|
|
|
|
|