New Branch Structure
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
<?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
|
||||
{
|
||||
if (! Schema::hasTable('companies')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('companies', function (Blueprint $table): void {
|
||||
if (! Schema::hasColumn('companies', 'theme_key')) {
|
||||
$table->string('theme_key')->default('default')->after('timezone');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('companies', 'brand_primary')) {
|
||||
$table->string('brand_primary')->nullable()->after('theme_key');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('companies', 'brand_secondary')) {
|
||||
$table->string('brand_secondary')->nullable()->after('brand_primary');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('companies', 'brand_accent')) {
|
||||
$table->string('brand_accent')->nullable()->after('brand_secondary');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('companies', 'logo_path')) {
|
||||
$table->string('logo_path')->nullable()->after('brand_accent');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('companies', 'theme_settings')) {
|
||||
$table->json('theme_settings')->nullable()->after('logo_path');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('companies')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('companies', function (Blueprint $table): void {
|
||||
foreach (['theme_settings', 'logo_path', 'brand_accent', 'brand_secondary', 'brand_primary', 'theme_key'] as $column) {
|
||||
if (Schema::hasColumn('companies', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?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::create('stylist_theme_settings', function (Blueprint $table) { $table->id(); $table->string('theme_key')->unique(); $table->string('variant')->default('light'); $table->json('settings')->nullable(); $table->timestamps(); }); }
|
||||
public function down(): void { Schema::dropIfExists('stylist_theme_settings'); }
|
||||
};
|
||||
Reference in New Issue
Block a user