Merge branch 'next' into feature/authentik-provider

This commit is contained in:
🏔️ Peak
2024-12-11 15:24:26 +01:00
committed by GitHub
814 changed files with 31372 additions and 13434 deletions

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('subscriptions', function (Blueprint $table) {
$table->string('stripe_plan_id')->nullable()->after('stripe_cancel_at_period_end');
});
}

View File

@@ -14,7 +14,6 @@ return new class extends Migration
Schema::table('subscriptions', function (Blueprint $table) {
$table->string('stripe_feedback')->nullable()->after('stripe_cancel_at_period_end');
$table->string('stripe_comment')->nullable()->after('stripe_feedback');
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('subscriptions', function (Blueprint $table) {
$table->boolean('stripe_trial_already_ended')->default(false)->after('stripe_cancel_at_period_end');
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('team_invitations', function (Blueprint $table) {
$table->text('link')->change();
});
}

View File

@@ -16,7 +16,6 @@ return new class extends Migration
$table->longText('description')->nullable();
$table->longText('docker_compose_raw');
$table->longText('docker_compose')->nullable();
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('environment_variables', function (Blueprint $table) {
$table->foreignId('service_id')->nullable();
});
}

View File

@@ -14,7 +14,6 @@ return new class extends Migration
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('destination_type');
$table->dropColumn('destination_id');
});
}

View File

@@ -26,6 +26,5 @@ return new class extends Migration
$table->dropColumn('unreachable_email_sent');
$table->integer('unreachable_count')->default(0);
});
}
};

View File

@@ -22,7 +22,6 @@ return new class extends Migration
$table->boolean('is_logdrain_axiom_enabled')->default(false);
$table->string('logdrain_axiom_dataset_name')->nullable();
$table->string('logdrain_axiom_api_key')->nullable();
});
}

View File

@@ -66,6 +66,5 @@ return new class extends Migration
Schema::table('service_databases', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
};

View File

@@ -14,7 +14,6 @@ return new class extends Migration
Schema::table('applications', function (Blueprint $table) {
$table->string('docker_compose_custom_start_command')->nullable();
$table->string('docker_compose_custom_build_command')->nullable();
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('applications', function (Blueprint $table) {
$table->text('custom_docker_run_options')->nullable()->change();
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('application_settings', function (Blueprint $table) {
$table->boolean('connect_to_docker_network')->default(false);
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('applications', function (Blueprint $table) {
$table->string('manual_webhook_secret_gitea')->nullable();
});
}

View File

@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->string('redirect')->enum('www', 'non-www', 'both')->default('both')->after('domain');
$table->enum('redirect', ['www', 'non-www', 'both'])->default('both')->after('domain');
});
}

View File

@@ -18,7 +18,7 @@ return new class extends Migration
$table->boolean('is_metrics_enabled')->default(false);
$table->integer('metrics_refresh_rate_seconds')->default(5);
$table->integer('metrics_history_days')->default(30);
$table->string('metrics_token')->default(generateSentinelToken());
$table->string('metrics_token')->nullable();
});
}

View File

@@ -4,6 +4,8 @@ use App\Models\EnvironmentVariable;
use App\Models\Server;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Visus\Cuid2\Cuid2;
@@ -14,44 +16,45 @@ return new class extends Migration
*/
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('docker_compose_pr_location');
$table->dropColumn('docker_compose_pr');
$table->dropColumn('docker_compose_pr_raw');
});
Schema::table('subscriptions', function (Blueprint $table) {
$table->dropColumn('lemon_subscription_id');
$table->dropColumn('lemon_order_id');
$table->dropColumn('lemon_product_id');
$table->dropColumn('lemon_variant_id');
$table->dropColumn('lemon_variant_name');
$table->dropColumn('lemon_customer_id');
$table->dropColumn('lemon_status');
$table->dropColumn('lemon_renews_at');
$table->dropColumn('lemon_update_payment_menthod_url');
$table->dropColumn('lemon_trial_ends_at');
$table->dropColumn('lemon_ends_at');
});
Schema::table('environment_variables', function (Blueprint $table) {
$table->string('uuid')->nullable()->after('id');
});
try {
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('docker_compose_pr_location');
$table->dropColumn('docker_compose_pr');
$table->dropColumn('docker_compose_pr_raw');
});
Schema::table('subscriptions', function (Blueprint $table) {
$table->dropColumn('lemon_subscription_id');
$table->dropColumn('lemon_order_id');
$table->dropColumn('lemon_product_id');
$table->dropColumn('lemon_variant_id');
$table->dropColumn('lemon_variant_name');
$table->dropColumn('lemon_customer_id');
$table->dropColumn('lemon_status');
$table->dropColumn('lemon_renews_at');
$table->dropColumn('lemon_update_payment_menthod_url');
$table->dropColumn('lemon_trial_ends_at');
$table->dropColumn('lemon_ends_at');
});
Schema::table('environment_variables', function (Blueprint $table) {
$table->string('uuid')->nullable()->after('id');
});
EnvironmentVariable::all()->each(function (EnvironmentVariable $environmentVariable) {
$environmentVariable->update([
'uuid' => (string) new Cuid2,
]);
});
Schema::table('environment_variables', function (Blueprint $table) {
$table->string('uuid')->nullable(false)->change();
});
Schema::table('server_settings', function (Blueprint $table) {
$table->integer('metrics_history_days')->default(7)->change();
});
Server::all()->each(function (Server $server) {
$server->settings->update([
'metrics_history_days' => 7,
]);
});
EnvironmentVariable::all()->each(function (EnvironmentVariable $environmentVariable) {
$environmentVariable->update([
'uuid' => (string) new Cuid2,
]);
});
Schema::table('environment_variables', function (Blueprint $table) {
$table->string('uuid')->nullable(false)->change();
});
Schema::table('server_settings', function (Blueprint $table) {
$table->integer('metrics_history_days')->default(7)->change();
});
DB::table('server_settings')->update(['metrics_history_days' => 7]);
} catch (\Exception $e) {
Log::error('Error updating db: '.$e->getMessage());
}
}
/**

View File

@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->boolean('is_force_cleanup_enabled')->default(false)->after('is_sentinel_enabled');
$table->boolean('is_force_cleanup_enabled')->default(false);
});
}

View File

@@ -30,7 +30,6 @@ class AddServerCleanupFieldsToServerSettingsTable extends Migration
$serverSetting->docker_cleanup_threshold = $serverSetting->cleanup_after_percentage;
$serverSetting->save();
}
}
/**

View File

@@ -20,6 +20,5 @@ class EncryptExistingPrivateKeys extends Migration
echo 'Encrypting private keys failed.';
echo $e->getMessage();
}
}
}

View File

@@ -0,0 +1,54 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->dropColumn('metrics_token');
$table->dropColumn('metrics_refresh_rate_seconds');
$table->dropColumn('metrics_history_days');
$table->dropColumn('is_server_api_enabled');
$table->boolean('is_sentinel_enabled')->default(false);
$table->text('sentinel_token')->nullable();
$table->integer('sentinel_metrics_refresh_rate_seconds')->default(10);
$table->integer('sentinel_metrics_history_days')->default(7);
$table->integer('sentinel_push_interval_seconds')->default(60);
$table->string('sentinel_custom_url')->nullable();
});
Schema::table('servers', function (Blueprint $table) {
$table->dateTime('sentinel_updated_at')->default(now());
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->string('metrics_token')->nullable();
$table->integer('metrics_refresh_rate_seconds')->default(5);
$table->integer('metrics_history_days')->default(30);
$table->boolean('is_server_api_enabled')->default(false);
$table->dropColumn('is_sentinel_enabled');
$table->dropColumn('sentinel_token');
$table->dropColumn('sentinel_metrics_refresh_rate_seconds');
$table->dropColumn('sentinel_metrics_history_days');
$table->dropColumn('sentinel_push_interval_seconds');
$table->dropColumn('sentinel_custom_url');
});
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('sentinel_updated_at');
});
}
};

View File

@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsSharedToEnvironmentVariables extends Migration
{
public function up()
{
Schema::table('environment_variables', function (Blueprint $table) {
$table->boolean('is_shared')->default(false);
});
}
public function down()
{
Schema::table('environment_variables', function (Blueprint $table) {
$table->dropColumn('is_shared');
});
}
}

View File

@@ -0,0 +1,41 @@
<?php
use App\Models\EnvironmentVariable;
use App\Models\StandaloneRedis;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class MoveRedisPasswordToEnvs extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
try {
StandaloneRedis::chunkById(100, function ($redisInstances) {
foreach ($redisInstances as $redis) {
$redis_password = DB::table('standalone_redis')->where('id', $redis->id)->value('redis_password');
EnvironmentVariable::create([
'standalone_redis_id' => $redis->id,
'key' => 'REDIS_PASSWORD',
'value' => $redis_password,
]);
EnvironmentVariable::create([
'standalone_redis_id' => $redis->id,
'key' => 'REDIS_USERNAME',
'value' => 'default',
]);
}
});
Schema::table('standalone_redis', function (Blueprint $table) {
$table->dropColumn('redis_password');
});
} catch (\Exception $e) {
echo 'Moving Redis passwords to envs failed.';
echo $e->getMessage();
}
}
}

View File

@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->boolean('disable_two_step_confirmation')->default(false);
});
}
public function down()
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->dropColumn('disable_two_step_confirmation');
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->integer('server_disk_usage_notification_threshold')->default(80)->after('docker_cleanup_threshold');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->dropColumn('server_disk_usage_notification_threshold');
});
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('teams', function (Blueprint $table) {
$table->boolean('discord_notifications_server_disk_usage')->default(true)->after('discord_enabled');
$table->boolean('smtp_notifications_server_disk_usage')->default(true)->after('smtp_enabled');
$table->boolean('telegram_notifications_server_disk_usage')->default(true)->after('telegram_enabled');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('teams', function (Blueprint $table) {
$table->dropColumn('discord_notifications_server_disk_usage');
$table->dropColumn('smtp_notifications_server_disk_usage');
$table->dropColumn('telegram_notifications_server_disk_usage');
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->boolean('is_sentinel_debug_enabled')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->dropColumn('is_sentinel_debug_enabled');
});
}
};

View File

@@ -0,0 +1,60 @@
<?php
use App\Models\PersonalAccessToken;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
try {
$tokens = PersonalAccessToken::all();
foreach ($tokens as $token) {
$abilities = collect();
if (in_array('*', $token->abilities)) {
$abilities->push('root');
}
if (in_array('read-only', $token->abilities)) {
$abilities->push('read');
}
if (in_array('view:sensitive', $token->abilities)) {
$abilities->push('read', 'read:sensitive');
}
$token->abilities = $abilities->unique()->values()->all();
$token->save();
}
} catch (\Exception $e) {
\Log::error('Error renaming token permissions: '.$e->getMessage());
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
try {
$tokens = PersonalAccessToken::all();
foreach ($tokens as $token) {
$abilities = collect();
if (in_array('write', $token->abilities)) {
$abilities->push('*');
} else {
if (in_array('read', $token->abilities)) {
$abilities->push('read-only');
}
if (in_array('read:sensitive', $token->abilities)) {
$abilities->push('view:sensitive');
}
}
$token->abilities = $abilities->unique()->values()->all();
$token->save();
}
} catch (\Exception $e) {
\Log::error('Error renaming token permissions: '.$e->getMessage());
}
}
};

View File

@@ -0,0 +1,96 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('application_previews', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('service_applications', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('service_databases', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('standalone_postgresqls', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('standalone_redis', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('standalone_mongodbs', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('standalone_mysqls', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('standalone_mariadbs', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('standalone_keydbs', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('standalone_dragonflies', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
Schema::table('standalone_clickhouses', function (Blueprint $table) {
$table->timestamp('last_online_at')->default(now())->after('updated_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('application_previews', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('service_applications', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('service_databases', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('standalone_postgresqls', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('standalone_redis', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('standalone_mongodbs', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('standalone_mysqls', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('standalone_mariadbs', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('standalone_keydbs', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('standalone_dragonflies', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
Schema::table('standalone_clickhouses', function (Blueprint $table) {
$table->dropColumn('last_online_at');
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->longText('custom_nginx_configuration')->nullable()->after('static_image');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('custom_nginx_configuration');
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class AddIndexToActivityLog extends Migration
{
public function up()
{
try {
DB::statement('ALTER TABLE activity_log ALTER COLUMN properties TYPE jsonb USING properties::jsonb');
DB::statement('CREATE INDEX idx_activity_type_uuid ON activity_log USING GIN (properties jsonb_path_ops)');
} catch (\Exception $e) {
Log::error('Error adding index to activity_log: '.$e->getMessage());
}
}
public function down()
{
try {
DB::statement('DROP INDEX IF EXISTS idx_activity_type_uuid');
DB::statement('ALTER TABLE activity_log ALTER COLUMN properties TYPE json USING properties::json');
} catch (\Exception $e) {
Log::error('Error dropping index from activity_log: '.$e->getMessage());
}
}
}

View File

@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('application_settings', function (Blueprint $table) {
$table->boolean('disable_build_cache')->default(false);
});
}
public function down(): void
{
Schema::table('application_settings', function (Blueprint $table) {
$table->dropColumn('disable_build_cache');
});
}
};

View File

@@ -0,0 +1,58 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('email_notification_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('team_id')->constrained()->cascadeOnDelete();
$table->boolean('smtp_enabled')->default(false);
$table->text('smtp_from_address')->nullable();
$table->text('smtp_from_name')->nullable();
$table->text('smtp_recipients')->nullable();
$table->text('smtp_host')->nullable();
$table->integer('smtp_port')->nullable();
$table->string('smtp_encryption')->nullable();
$table->text('smtp_username')->nullable();
$table->text('smtp_password')->nullable();
$table->integer('smtp_timeout')->nullable();
$table->boolean('resend_enabled')->default(false);
$table->text('resend_api_key')->nullable();
$table->boolean('use_instance_email_settings')->default(false);
$table->boolean('deployment_success_email_notifications')->default(false);
$table->boolean('deployment_failure_email_notifications')->default(true);
$table->boolean('status_change_email_notifications')->default(false);
$table->boolean('backup_success_email_notifications')->default(false);
$table->boolean('backup_failure_email_notifications')->default(true);
$table->boolean('scheduled_task_success_email_notifications')->default(false);
$table->boolean('scheduled_task_failure_email_notifications')->default(true);
$table->boolean('docker_cleanup_success_email_notifications')->default(false);
$table->boolean('docker_cleanup_failure_email_notifications')->default(true);
$table->boolean('server_disk_usage_email_notifications')->default(true);
$table->boolean('server_reachable_email_notifications')->default(false);
$table->boolean('server_unreachable_email_notifications')->default(true);
$table->unique(['team_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('email_notification_settings');
}
};

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('discord_notification_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('team_id')->constrained()->cascadeOnDelete();
$table->boolean('discord_enabled')->default(false);
$table->text('discord_webhook_url')->nullable();
$table->boolean('deployment_success_discord_notifications')->default(false);
$table->boolean('deployment_failure_discord_notifications')->default(true);
$table->boolean('status_change_discord_notifications')->default(false);
$table->boolean('backup_success_discord_notifications')->default(false);
$table->boolean('backup_failure_discord_notifications')->default(true);
$table->boolean('scheduled_task_success_discord_notifications')->default(false);
$table->boolean('scheduled_task_failure_discord_notifications')->default(true);
$table->boolean('docker_cleanup_success_discord_notifications')->default(false);
$table->boolean('docker_cleanup_failure_discord_notifications')->default(true);
$table->boolean('server_disk_usage_discord_notifications')->default(true);
$table->boolean('server_reachable_discord_notifications')->default(false);
$table->boolean('server_unreachable_discord_notifications')->default(true);
$table->unique(['team_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('discord_notification_settings');
}
};

View File

@@ -0,0 +1,59 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('telegram_notification_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('team_id')->constrained()->cascadeOnDelete();
$table->boolean('telegram_enabled')->default(false);
$table->text('telegram_token')->nullable();
$table->text('telegram_chat_id')->nullable();
$table->boolean('deployment_success_telegram_notifications')->default(false);
$table->boolean('deployment_failure_telegram_notifications')->default(true);
$table->boolean('status_change_telegram_notifications')->default(false);
$table->boolean('backup_success_telegram_notifications')->default(false);
$table->boolean('backup_failure_telegram_notifications')->default(true);
$table->boolean('scheduled_task_success_telegram_notifications')->default(false);
$table->boolean('scheduled_task_failure_telegram_notifications')->default(true);
$table->boolean('docker_cleanup_success_telegram_notifications')->default(false);
$table->boolean('docker_cleanup_failure_telegram_notifications')->default(true);
$table->boolean('server_disk_usage_telegram_notifications')->default(true);
$table->boolean('server_reachable_telegram_notifications')->default(false);
$table->boolean('server_unreachable_telegram_notifications')->default(true);
$table->text('telegram_notifications_deployment_success_topic_id')->nullable();
$table->text('telegram_notifications_deployment_failure_topic_id')->nullable();
$table->text('telegram_notifications_status_change_topic_id')->nullable();
$table->text('telegram_notifications_backup_success_topic_id')->nullable();
$table->text('telegram_notifications_backup_failure_topic_id')->nullable();
$table->text('telegram_notifications_scheduled_task_success_topic_id')->nullable();
$table->text('telegram_notifications_scheduled_task_failure_topic_id')->nullable();
$table->text('telegram_notifications_docker_cleanup_success_topic_id')->nullable();
$table->text('telegram_notifications_docker_cleanup_failure_topic_id')->nullable();
$table->text('telegram_notifications_server_disk_usage_topic_id')->nullable();
$table->text('telegram_notifications_server_reachable_topic_id')->nullable();
$table->text('telegram_notifications_server_unreachable_topic_id')->nullable();
$table->unique(['team_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('telegram_notification_settings');
}
};

View File

@@ -0,0 +1,135 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
$teams = DB::table('teams')->get();
foreach ($teams as $team) {
try {
DB::table('email_notification_settings')->updateOrInsert(
['team_id' => $team->id],
[
'smtp_enabled' => $team->smtp_enabled ?? false,
'smtp_from_address' => $team->smtp_from_address ? Crypt::encryptString($team->smtp_from_address) : null,
'smtp_from_name' => $team->smtp_from_name ? Crypt::encryptString($team->smtp_from_name) : null,
'smtp_recipients' => $team->smtp_recipients ? Crypt::encryptString($team->smtp_recipients) : null,
'smtp_host' => $team->smtp_host ? Crypt::encryptString($team->smtp_host) : null,
'smtp_port' => $team->smtp_port,
'smtp_encryption' => $team->smtp_encryption,
'smtp_username' => $team->smtp_username ? Crypt::encryptString($team->smtp_username) : null,
'smtp_password' => $team->smtp_password,
'smtp_timeout' => $team->smtp_timeout,
'use_instance_email_settings' => $team->use_instance_email_settings ?? false,
'resend_enabled' => $team->resend_enabled ?? false,
'resend_api_key' => $team->resend_api_key,
'deployment_success_email_notifications' => $team->smtp_notifications_deployments ?? false,
'deployment_failure_email_notifications' => $team->smtp_notifications_deployments ?? true,
'backup_success_email_notifications' => $team->smtp_notifications_database_backups ?? false,
'backup_failure_email_notifications' => $team->smtp_notifications_database_backups ?? true,
'scheduled_task_success_email_notifications' => $team->smtp_notifications_scheduled_tasks ?? false,
'scheduled_task_failure_email_notifications' => $team->smtp_notifications_scheduled_tasks ?? true,
'status_change_email_notifications' => $team->smtp_notifications_status_changes ?? false,
'server_disk_usage_email_notifications' => $team->smtp_notifications_server_disk_usage ?? true,
]
);
} catch (Exception $e) {
\Log::error('Error migrating email notification settings from teams table: '.$e->getMessage());
}
}
Schema::table('teams', function (Blueprint $table) {
$table->dropColumn([
'smtp_enabled',
'smtp_from_address',
'smtp_from_name',
'smtp_recipients',
'smtp_host',
'smtp_port',
'smtp_encryption',
'smtp_username',
'smtp_password',
'smtp_timeout',
'use_instance_email_settings',
'resend_enabled',
'resend_api_key',
'smtp_notifications_test',
'smtp_notifications_deployments',
'smtp_notifications_database_backups',
'smtp_notifications_scheduled_tasks',
'smtp_notifications_status_changes',
'smtp_notifications_server_disk_usage',
]);
});
}
public function down(): void
{
Schema::table('teams', function (Blueprint $table) {
$table->boolean('smtp_enabled')->default(false);
$table->string('smtp_from_address')->nullable();
$table->string('smtp_from_name')->nullable();
$table->string('smtp_recipients')->nullable();
$table->string('smtp_host')->nullable();
$table->integer('smtp_port')->nullable();
$table->string('smtp_encryption')->nullable();
$table->text('smtp_username')->nullable();
$table->text('smtp_password')->nullable();
$table->integer('smtp_timeout')->nullable();
$table->boolean('use_instance_email_settings')->default(false);
$table->boolean('resend_enabled')->default(false);
$table->text('resend_api_key')->nullable();
$table->boolean('smtp_notifications_test')->default(false);
$table->boolean('smtp_notifications_deployments')->default(false);
$table->boolean('smtp_notifications_database_backups')->default(true);
$table->boolean('smtp_notifications_scheduled_tasks')->default(false);
$table->boolean('smtp_notifications_status_changes')->default(false);
$table->boolean('smtp_notifications_server_disk_usage')->default(true);
});
$settings = DB::table('email_notification_settings')->get();
foreach ($settings as $setting) {
try {
DB::table('teams')
->where('id', $setting->team_id)
->update([
'smtp_enabled' => $setting->smtp_enabled,
'smtp_from_address' => $setting->smtp_from_address ? Crypt::decryptString($setting->smtp_from_address) : null,
'smtp_from_name' => $setting->smtp_from_name ? Crypt::decryptString($setting->smtp_from_name) : null,
'smtp_recipients' => $setting->smtp_recipients ? Crypt::decryptString($setting->smtp_recipients) : null,
'smtp_host' => $setting->smtp_host ? Crypt::decryptString($setting->smtp_host) : null,
'smtp_port' => $setting->smtp_port,
'smtp_encryption' => $setting->smtp_encryption,
'smtp_username' => $setting->smtp_username ? Crypt::decryptString($setting->smtp_username) : null,
'smtp_password' => $setting->smtp_password,
'smtp_timeout' => $setting->smtp_timeout,
'use_instance_email_settings' => $setting->use_instance_email_settings,
'resend_enabled' => $setting->resend_enabled,
'resend_api_key' => $setting->resend_api_key,
'smtp_notifications_deployments' => $setting->deployment_success_email_notifications || $setting->deployment_failure_email_notifications,
'smtp_notifications_database_backups' => $setting->backup_success_email_notifications || $setting->backup_failure_email_notifications,
'smtp_notifications_scheduled_tasks' => $setting->scheduled_task_success_email_notifications || $setting->scheduled_task_failure_email_notifications,
'smtp_notifications_status_changes' => $setting->status_change_email_notifications,
]);
} catch (Exception $e) {
\Log::error('Error migrating email notification settings from teams table: '.$e->getMessage());
}
}
}
};

View File

@@ -0,0 +1,92 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$teams = DB::table('teams')->get();
foreach ($teams as $team) {
try {
DB::table('discord_notification_settings')->updateOrInsert(
['team_id' => $team->id],
[
'discord_enabled' => $team->discord_enabled ?? false,
'discord_webhook_url' => $team->discord_webhook_url ? Crypt::encryptString($team->discord_webhook_url) : null,
'deployment_success_discord_notifications' => $team->discord_notifications_deployments ?? false,
'deployment_failure_discord_notifications' => $team->discord_notifications_deployments ?? true,
'backup_success_discord_notifications' => $team->discord_notifications_database_backups ?? false,
'backup_failure_discord_notifications' => $team->discord_notifications_database_backups ?? true,
'scheduled_task_success_discord_notifications' => $team->discord_notifications_scheduled_tasks ?? false,
'scheduled_task_failure_discord_notifications' => $team->discord_notifications_scheduled_tasks ?? true,
'status_change_discord_notifications' => $team->discord_notifications_status_changes ?? false,
'server_disk_usage_discord_notifications' => $team->discord_notifications_server_disk_usage ?? true,
]
);
} catch (Exception $e) {
\Log::error('Error migrating discord notification settings from teams table: '.$e->getMessage());
}
}
Schema::table('teams', function (Blueprint $table) {
$table->dropColumn([
'discord_enabled',
'discord_webhook_url',
'discord_notifications_test',
'discord_notifications_deployments',
'discord_notifications_status_changes',
'discord_notifications_database_backups',
'discord_notifications_scheduled_tasks',
'discord_notifications_server_disk_usage',
]);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('teams', function (Blueprint $table) {
$table->boolean('discord_enabled')->default(false);
$table->string('discord_webhook_url')->nullable();
$table->boolean('discord_notifications_test')->default(true);
$table->boolean('discord_notifications_deployments')->default(true);
$table->boolean('discord_notifications_status_changes')->default(true);
$table->boolean('discord_notifications_database_backups')->default(true);
$table->boolean('discord_notifications_scheduled_tasks')->default(true);
$table->boolean('discord_notifications_server_disk_usage')->default(true);
});
$settings = DB::table('discord_notification_settings')->get();
foreach ($settings as $setting) {
try {
DB::table('teams')
->where('id', $setting->team_id)
->update([
'discord_enabled' => $setting->discord_enabled,
'discord_webhook_url' => Crypt::decryptString($setting->discord_webhook_url),
'discord_notifications_deployments' => $setting->deployment_success_discord_notifications || $setting->deployment_failure_discord_notifications,
'discord_notifications_status_changes' => $setting->status_change_discord_notifications,
'discord_notifications_database_backups' => $setting->backup_success_discord_notifications || $setting->backup_failure_discord_notifications,
'discord_notifications_scheduled_tasks' => $setting->scheduled_task_success_discord_notifications || $setting->scheduled_task_failure_discord_notifications,
'discord_notifications_server_disk_usage' => $setting->server_disk_usage_discord_notifications,
]);
} catch (Exception $e) {
\Log::error('Error migrating discord notification settings from teams table: '.$e->getMessage());
}
}
}
};

View File

@@ -0,0 +1,114 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
$teams = DB::table('teams')->get();
foreach ($teams as $team) {
try {
DB::table('telegram_notification_settings')->updateOrInsert(
['team_id' => $team->id],
[
'telegram_enabled' => $team->telegram_enabled ?? false,
'telegram_token' => $team->telegram_token ? Crypt::encryptString($team->telegram_token) : null,
'telegram_chat_id' => $team->telegram_chat_id ? Crypt::encryptString($team->telegram_chat_id) : null,
'deployment_success_telegram_notifications' => $team->telegram_notifications_deployments ?? false,
'deployment_failure_telegram_notifications' => $team->telegram_notifications_deployments ?? true,
'backup_success_telegram_notifications' => $team->telegram_notifications_database_backups ?? false,
'backup_failure_telegram_notifications' => $team->telegram_notifications_database_backups ?? true,
'scheduled_task_success_telegram_notifications' => $team->telegram_notifications_scheduled_tasks ?? false,
'scheduled_task_failure_telegram_notifications' => $team->telegram_notifications_scheduled_tasks ?? true,
'status_change_telegram_notifications' => $team->telegram_notifications_status_changes ?? false,
'server_disk_usage_telegram_notifications' => $team->telegram_notifications_server_disk_usage ?? true,
'telegram_notifications_deployment_success_topic_id' => $team->telegram_notifications_deployments_message_thread_id ? Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id) : null,
'telegram_notifications_deployment_failure_topic_id' => $team->telegram_notifications_deployments_message_thread_id ? Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id) : null,
'telegram_notifications_backup_success_topic_id' => $team->telegram_notifications_database_backups_message_thread_id ? Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id) : null,
'telegram_notifications_backup_failure_topic_id' => $team->telegram_notifications_database_backups_message_thread_id ? Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id) : null,
'telegram_notifications_scheduled_task_success_topic_id' => $team->telegram_notifications_scheduled_tasks_thread_id ? Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id) : null,
'telegram_notifications_scheduled_task_failure_topic_id' => $team->telegram_notifications_scheduled_tasks_thread_id ? Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id) : null,
'telegram_notifications_status_change_topic_id' => $team->telegram_notifications_status_changes_message_thread_id ? Crypt::encryptString($team->telegram_notifications_status_changes_message_thread_id) : null,
]
);
} catch (Exception $e) {
\Log::error('Error migrating telegram notification settings from teams table: '.$e->getMessage());
}
}
Schema::table('teams', function (Blueprint $table) {
$table->dropColumn([
'telegram_enabled',
'telegram_token',
'telegram_chat_id',
'telegram_notifications_test',
'telegram_notifications_deployments',
'telegram_notifications_status_changes',
'telegram_notifications_database_backups',
'telegram_notifications_scheduled_tasks',
'telegram_notifications_server_disk_usage',
'telegram_notifications_test_message_thread_id',
'telegram_notifications_deployments_message_thread_id',
'telegram_notifications_status_changes_message_thread_id',
'telegram_notifications_database_backups_message_thread_id',
'telegram_notifications_scheduled_tasks_thread_id',
]);
});
}
public function down(): void
{
Schema::table('teams', function (Blueprint $table) {
$table->boolean('telegram_enabled')->default(false);
$table->text('telegram_token')->nullable();
$table->text('telegram_chat_id')->nullable();
$table->boolean('telegram_notifications_test')->default(true);
$table->boolean('telegram_notifications_deployments')->default(true);
$table->boolean('telegram_notifications_status_changes')->default(true);
$table->boolean('telegram_notifications_database_backups')->default(true);
$table->boolean('telegram_notifications_scheduled_tasks')->default(true);
$table->boolean('telegram_notifications_server_disk_usage')->default(true);
$table->text('telegram_notifications_test_message_thread_id')->nullable();
$table->text('telegram_notifications_deployments_message_thread_id')->nullable();
$table->text('telegram_notifications_status_changes_message_thread_id')->nullable();
$table->text('telegram_notifications_database_backups_message_thread_id')->nullable();
$table->text('telegram_notifications_scheduled_tasks_thread_id')->nullable();
});
$settings = DB::table('telegram_notification_settings')->get();
foreach ($settings as $setting) {
try {
DB::table('teams')
->where('id', $setting->team_id)
->update([
'telegram_enabled' => $setting->telegram_enabled,
'telegram_token' => $setting->telegram_token ? Crypt::decryptString($setting->telegram_token) : null,
'telegram_chat_id' => $setting->telegram_chat_id ? Crypt::decryptString($setting->telegram_chat_id) : null,
'telegram_notifications_deployments' => $setting->deployment_success_telegram_notifications || $setting->deployment_failure_telegram_notifications,
'telegram_notifications_status_changes' => $setting->status_change_telegram_notifications,
'telegram_notifications_database_backups' => $setting->backup_success_telegram_notifications || $setting->backup_failure_telegram_notifications,
'telegram_notifications_scheduled_tasks' => $setting->scheduled_task_success_telegram_notifications || $setting->scheduled_task_failure_telegram_notifications,
'telegram_notifications_server_disk_usage' => $setting->server_disk_usage_telegram_notifications,
'telegram_notifications_deployments_message_thread_id' => $setting->telegram_notifications_deployment_success_topic_id ? Crypt::decryptString($setting->telegram_notifications_deployment_success_topic_id) : null,
'telegram_notifications_status_changes_message_thread_id' => $setting->telegram_notifications_status_change_topic_id ? Crypt::decryptString($setting->telegram_notifications_status_change_topic_id) : null,
'telegram_notifications_database_backups_message_thread_id' => $setting->telegram_notifications_backup_success_topic_id ? Crypt::decryptString($setting->telegram_notifications_backup_success_topic_id) : null,
'telegram_notifications_scheduled_tasks_thread_id' => $setting->telegram_notifications_scheduled_task_success_topic_id ? Crypt::decryptString($setting->telegram_notifications_scheduled_task_success_topic_id) : null,
]);
} catch (Exception $e) {
\Log::error('Error migrating telegram notification settings from teams table: '.$e->getMessage());
}
}
}
};

View File

@@ -0,0 +1,57 @@
<?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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('slack_notification_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('team_id')->constrained()->cascadeOnDelete();
$table->boolean('slack_enabled')->default(false);
$table->text('slack_webhook_url')->nullable();
$table->boolean('deployment_success_slack_notifications')->default(false);
$table->boolean('deployment_failure_slack_notifications')->default(true);
$table->boolean('status_change_slack_notifications')->default(false);
$table->boolean('backup_success_slack_notifications')->default(false);
$table->boolean('backup_failure_slack_notifications')->default(true);
$table->boolean('scheduled_task_success_slack_notifications')->default(false);
$table->boolean('scheduled_task_failure_slack_notifications')->default(true);
$table->boolean('docker_cleanup_success_slack_notifications')->default(false);
$table->boolean('docker_cleanup_failure_slack_notifications')->default(true);
$table->boolean('server_disk_usage_slack_notifications')->default(true);
$table->boolean('server_reachable_slack_notifications')->default(false);
$table->boolean('server_unreachable_slack_notifications')->default(true);
$table->unique(['team_id']);
});
$teams = DB::table('teams')->get();
foreach ($teams as $team) {
try {
DB::table('slack_notification_settings')->insert([
'team_id' => $team->id,
]);
} catch (\Throwable $e) {
\Log::error('Error migrating slack notification settings from teams table: '.$e->getMessage());
}
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('slack_notification_settings');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::dropIfExists('waitlists');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::create('waitlists', function (Blueprint $table) {
$table->id();
$table->string('uuid');
$table->string('type');
$table->string('email')->unique();
$table->boolean('verified')->default(false);
$table->timestamps();
});
}
};

View File

@@ -0,0 +1,72 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
if (DB::table('instance_settings')->exists()) {
Schema::table('instance_settings', function (Blueprint $table) {
$table->text('smtp_from_address')->nullable()->change();
$table->text('smtp_from_name')->nullable()->change();
$table->text('smtp_recipients')->nullable()->change();
$table->text('smtp_host')->nullable()->change();
$table->text('smtp_username')->nullable()->change();
});
$settings = DB::table('instance_settings')->get();
foreach ($settings as $setting) {
try {
DB::table('instance_settings')->where('id', $setting->id)->update([
'smtp_from_address' => $setting->smtp_from_address ? Crypt::encryptString($setting->smtp_from_address) : null,
'smtp_from_name' => $setting->smtp_from_name ? Crypt::encryptString($setting->smtp_from_name) : null,
'smtp_recipients' => $setting->smtp_recipients ? Crypt::encryptString($setting->smtp_recipients) : null,
'smtp_host' => $setting->smtp_host ? Crypt::encryptString($setting->smtp_host) : null,
'smtp_username' => $setting->smtp_username ? Crypt::encryptString($setting->smtp_username) : null,
]);
} catch (Exception $e) {
\Log::error('Error encrypting instance settings email columns: '.$e->getMessage());
}
}
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->string('smtp_from_address')->nullable()->change();
$table->string('smtp_from_name')->nullable()->change();
$table->string('smtp_recipients')->nullable()->change();
$table->string('smtp_host')->nullable()->change();
$table->string('smtp_username')->nullable()->change();
});
if (DB::table('instance_settings')->exists()) {
$settings = DB::table('instance_settings')->get();
foreach ($settings as $setting) {
try {
DB::table('instance_settings')->where('id', $setting->id)->update([
'smtp_from_address' => $setting->smtp_from_address ? Crypt::decryptString($setting->smtp_from_address) : null,
'smtp_from_name' => $setting->smtp_from_name ? Crypt::decryptString($setting->smtp_from_name) : null,
'smtp_recipients' => $setting->smtp_recipients ? Crypt::decryptString($setting->smtp_recipients) : null,
'smtp_host' => $setting->smtp_host ? Crypt::decryptString($setting->smtp_host) : null,
'smtp_username' => $setting->smtp_username ? Crypt::decryptString($setting->smtp_username) : null,
]);
} catch (Exception $e) {
\Log::error('Error decrypting instance settings email columns: '.$e->getMessage());
}
}
}
}
};

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->dropColumn('is_resale_license_active');
$table->dropColumn('resale_license');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->boolean('is_resale_license_active')->default(false);
$table->longText('resale_license')->nullable();
});
}
};