Cleanup short api keys
This commit is contained in:
parent
8185a74edc
commit
0dbf88ad1c
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Migrations;
|
||||||
|
|
||||||
|
use Engelsystem\Database\Migration\Migration;
|
||||||
|
|
||||||
|
class CleanupShortApiKeys extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$db = $this->schema->getConnection();
|
||||||
|
$db->table('users')
|
||||||
|
->where($db->raw('LENGTH(api_key)'), '<=', 42)
|
||||||
|
->update(['api_key' => '']);
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,6 +46,7 @@ trait HasDatabase
|
||||||
->insert(
|
->insert(
|
||||||
[
|
[
|
||||||
// Migrations that can be skipped as they only use legacy tables
|
// Migrations that can be skipped as they only use legacy tables
|
||||||
|
// or only change data not available/relevant in migrations
|
||||||
['migration' => '2018_01_01_000001_import_install_sql'],
|
['migration' => '2018_01_01_000001_import_install_sql'],
|
||||||
['migration' => '2018_01_01_000002_import_update_sql'],
|
['migration' => '2018_01_01_000002_import_update_sql'],
|
||||||
['migration' => '2018_01_01_000003_fix_old_tables'],
|
['migration' => '2018_01_01_000003_fix_old_tables'],
|
||||||
|
@ -66,6 +67,7 @@ trait HasDatabase
|
||||||
['migration' => '2022_07_21_000000_fix_old_groups_table_id_and_name'],
|
['migration' => '2022_07_21_000000_fix_old_groups_table_id_and_name'],
|
||||||
['migration' => '2022_10_21_000000_add_hide_register_to_angeltypes'],
|
['migration' => '2022_10_21_000000_add_hide_register_to_angeltypes'],
|
||||||
['migration' => '2022_11_06_000000_shifttype_remove_angeltype'],
|
['migration' => '2022_11_06_000000_shifttype_remove_angeltype'],
|
||||||
|
['migration' => '2023_05_21_000001_cleanup_short_api_keys'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue