chore: add admin seeder & add collation only to mysql database in plans table and activation table

This commit is contained in:
idevakk
2025-11-09 03:25:19 -08:00
parent b023ef75c3
commit 391af8a778
5 changed files with 1148 additions and 757 deletions

1862
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,8 +15,14 @@ return new class extends Migration
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->string('product_id')->collation('utf8_bin');
$table->string('pricing_id')->collation('utf8_bin');
$productId = $table->string('product_id');
$pricingId = $table->string('pricing_id');
// Apply collation only for MySQL
if (Schema::getConnection()->getDriverName() === 'mysql') {
$productId->collation('utf8_bin');
$pricingId->collation('utf8_bin');
}
$table->integer('price');
$table->integer('mailbox_limit')->default(15);
$table->boolean('monthly_billing')->default(true);

View File

@@ -15,7 +15,12 @@ return new class extends Migration
$table->id();
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->string('activation_key')->unique();
$table->string('price_id')->collation('utf8_bin');
$priceId = $table->string('price_id');
// Apply collation only for MySQL
if (Schema::getConnection()->getDriverName() === 'mysql') {
$priceId->collation('utf8_bin');
}
$table->boolean('is_activated')->default(false);
$table->timestamps();
});

View File

@@ -0,0 +1,25 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class AdminSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
User::create([
'name' => 'admin',
'email' => 'admin@zemail.me',
'password' => Hash::make('password'),
'level' => 9,
'email_verified_at' => now(),
]);
}
}

View File

@@ -16,6 +16,7 @@ class DatabaseSeeder extends Seeder
// User::factory(10)->create();
$this->call([
MetaSeeder::class,
AdminSeeder::class,
]);
}
}