- Made necessary changes to the migration and created new one as well.

- Updated the Clickhouse service template to use the official `clickhouse/clickhouse-server` image.
- Removed the usage of the deprecated `bitnamilegacy/clickhouse` image.

- fixes #7110
This commit is contained in:
EbinJose2002
2025-11-28 17:08:31 +05:30
parent 8505922b87
commit f37eef8266
6 changed files with 123 additions and 43 deletions

View File

@@ -19,6 +19,7 @@ return new class extends Migration
$table->string('clickhouse_admin_user')->default('default');
$table->text('clickhouse_admin_password');
$table->string('clickhouse_db')->default('default');
$table->boolean('is_log_drain_enabled')->default(false);
$table->boolean('is_include_timestamps')->default(false);
@@ -26,7 +27,7 @@ return new class extends Migration
$table->string('status')->default('exited');
$table->string('image')->default('bitnami/clickhouse');
$table->string('image')->default('clickhouse/clickhouse-server:latest');
$table->boolean('is_public')->default(false);
$table->integer('public_port')->nullable();

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
// Change the default value for the 'image' column
Schema::table('standalone_clickhouses', function (Blueprint $table) {
$table->string('image')->default('bitnamilegacy/clickhouse')->change();
});
// Optionally, update any existing rows with the old default to the new one
DB::table('standalone_clickhouses')
->where('image', 'bitnami/clickhouse')
->update(['image' => 'bitnamilegacy/clickhouse']);
}
public function down()
{
Schema::table('standalone_clickhouses', function (Blueprint $table) {
$table->string('image')->default('bitnami/clickhouse')->change();
});
// Optionally, revert any changed values
DB::table('standalone_clickhouses')
->where('image', 'bitnamilegacy/clickhouse')
->update(['image' => 'bitnami/clickhouse']);
}
};

View File

@@ -0,0 +1,52 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use App\Models\StandaloneClickhouse;
use App\Models\LocalPersistentVolume;
return new class extends Migration
{
/**
* Run the migrations.
*
* Migrates existing ClickHouse instances from Bitnami/BinamiLegacy images
* to the official clickhouse/clickhouse-server image.
*/
public function up(): void
{
if (!Schema::hasColumn('standalone_clickhouses', 'clickhouse_db')) {
Schema::table('standalone_clickhouses', function (Blueprint $table) {
$table->string('clickhouse_db')
->default('default')
->after('clickhouse_admin_password');
});
}
StandaloneClickhouse::where(function ($query) {
$query->where('image', 'like', '%bitnami/clickhouse%')
->orWhere('image', 'like', '%bitnamilegacy/clickhouse%');
})
->update([
'image' => 'clickhouse/clickhouse-server:latest',
'clickhouse_db' => DB::raw("COALESCE(clickhouse_db, 'default')")
]);
LocalPersistentVolume::where('resource_type', StandaloneClickhouse::class)
->where('mount_path', '/bitnami/clickhouse')
->update(['mount_path' => '/var/lib/clickhouse']);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
StandaloneClickhouse::where('image', 'clickhouse/clickhouse-server:latest')
->update(['image' => 'bitnami/clickhouse']);
LocalPersistentVolume::where('resource_type', StandaloneClickhouse::class)
->where('mount_path', '/var/lib/clickhouse')
->update(['mount_path' => '/bitnami/clickhouse']);
}
};