mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
Use checksum more broadly, not specifically SHA256
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ModifyChecksumsColumnForBackups extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('backups', function (Blueprint $table) {
|
||||
$table->renameColumn('sha256_hash', 'checksum');
|
||||
});
|
||||
|
||||
Schema::table('backups', function (Blueprint $table) {
|
||||
DB::update('UPDATE backups SET checksum = CONCAT(\'sha256:\', checksum)');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('backups', function (Blueprint $table) {
|
||||
$table->renameColumn('checksum', 'sha256_hash');
|
||||
});
|
||||
|
||||
Schema::table('backups', function (Blueprint $table) {
|
||||
DB::update('UPDATE backups SET sha256_hash = SUBSTRING(sha256_hash, 8)');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user