pre version 2
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (!Schema::hasColumn('email_settings', 'auth_method')) {
|
||||
Schema::table('email_settings', function (Blueprint $table) {
|
||||
$table->string('auth_method', 20)->default('password');
|
||||
$table->foreignId('google_oauth_connection_id')
|
||||
->nullable()
|
||||
->constrained('google_oauth_connections')
|
||||
->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('sender_accounts', 'auth_method')) {
|
||||
Schema::table('sender_accounts', function (Blueprint $table) {
|
||||
$table->string('auth_method', 20)->default('password');
|
||||
$table->foreignId('google_oauth_connection_id')
|
||||
->nullable()
|
||||
->constrained('google_oauth_connections')
|
||||
->nullOnDelete();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('email_settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('email_settings', 'google_oauth_connection_id')) {
|
||||
$table->dropForeign(['google_oauth_connection_id']);
|
||||
}
|
||||
if (Schema::hasColumn('email_settings', 'auth_method')) {
|
||||
$table->dropColumn(['auth_method', 'google_oauth_connection_id']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('sender_accounts', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('sender_accounts', 'google_oauth_connection_id')) {
|
||||
$table->dropForeign(['google_oauth_connection_id']);
|
||||
}
|
||||
if (Schema::hasColumn('sender_accounts', 'auth_method')) {
|
||||
$table->dropColumn(['auth_method', 'google_oauth_connection_id']);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user