mirror of
https://github.com/dyzulk/trustlab-api.git
synced 2026-01-26 13:22:05 +07:00
fix: make CA migration idempotent for multi-db migrate:fresh safety
This commit is contained in:
@@ -11,7 +11,8 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('ca_certificates', function (Blueprint $table) {
|
if (!Schema::connection('mysql_ca')->hasTable('ca_certificates')) {
|
||||||
|
Schema::connection('mysql_ca')->create('ca_certificates', function (Blueprint $table) {
|
||||||
$table->string('uuid', 32)->primary();
|
$table->string('uuid', 32)->primary();
|
||||||
$table->string('ca_type'); // root, intermediate_4096, intermediate_2048
|
$table->string('ca_type'); // root, intermediate_4096, intermediate_2048
|
||||||
$table->longText('cert_content')->nullable();
|
$table->longText('cert_content')->nullable();
|
||||||
@@ -28,12 +29,13 @@ return new class extends Migration
|
|||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('ca_certificates');
|
Schema::connection('mysql_ca')->dropIfExists('ca_certificates');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user