vmangos
This commit is contained in:
@@ -8,7 +8,7 @@ return new class extends Migration
|
||||
{
|
||||
public function getConnection(): ?string
|
||||
{
|
||||
return app()->environment('testing') ? config('database.default') : 'azerothcore_auth';
|
||||
return app()->environment('testing') ? config('database.default') : 'vmangos_auth';
|
||||
}
|
||||
|
||||
public function up(): void
|
||||
|
||||
@@ -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 getConnection(): ?string
|
||||
{
|
||||
return app()->environment('testing') ? config('database.default') : 'vmangos_auth';
|
||||
}
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
$schema = Schema::connection($this->getConnection());
|
||||
|
||||
if (! $schema->hasTable('account_balances')) {
|
||||
$schema->create('account_balances', function (Blueprint $table): void {
|
||||
$table->unsignedInteger('account_id')->primary();
|
||||
$table->decimal('balance', 14, 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (! $schema->hasTable('payment_invoices')) {
|
||||
$schema->create('payment_invoices', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedInteger('account_id')->index();
|
||||
$table->decimal('amount', 14, 2);
|
||||
$table->string('mode', 20)->default('test');
|
||||
$table->string('status', 20)->default('pending')->index();
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (! $schema->hasTable('balance_transactions')) {
|
||||
$schema->create('balance_transactions', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedInteger('account_id')->index();
|
||||
$table->string('type', 20);
|
||||
$table->decimal('amount', 14, 2);
|
||||
$table->decimal('balance_after', 14, 2);
|
||||
$table->string('reference', 191)->unique();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// The tables may predate this migration. Preserve shared account balances.
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
{
|
||||
public function getConnection(): ?string
|
||||
{
|
||||
return app()->environment('testing') ? config('database.default') : 'vmangos_auth';
|
||||
}
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::connection($this->getConnection())->create('site_credentials', function (Blueprint $table): void {
|
||||
$table->unsignedInteger('account_id')->primary();
|
||||
$table->unsignedInteger('legacy_account_id')->nullable()->unique();
|
||||
$table->char('salt_hex', 64);
|
||||
$table->char('verifier_hex', 64);
|
||||
$table->timestamps();
|
||||
if (! app()->environment('testing')) {
|
||||
$table->foreign('account_id')->references('id')->on('account')->cascadeOnDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::connection($this->getConnection())->dropIfExists('site_credentials');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user