over naar uuids, policies, predefined mutations aan kunnen passen
This commit is contained in:
@@ -18,7 +18,7 @@ return new class extends Migration
|
||||
$table->string('type');
|
||||
$table->integer('amount');
|
||||
$table->text('description')->nullable();
|
||||
$table->string('status')->default('pending');
|
||||
$table->string('status')->default('pending'); // pending, approved, rejected, voided
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,10 +13,11 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('predefined_mutations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('ledger_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('dynamic_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('amount');
|
||||
$table->string('type')->default('reward');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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('ledgers', function (Blueprint $table) {
|
||||
$table->string('status')->default('open');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('ledgers', function (Blueprint $table) {
|
||||
$table->dropColumn('status');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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('mutations', function (Blueprint $table) {
|
||||
$table->string('status')->default('pending')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mutations', function (Blueprint $table) {
|
||||
$table->string('status')->default('pending')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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('dynamics', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->after('id')->nullable();
|
||||
});
|
||||
|
||||
// Populate existing rows with UUIDs
|
||||
\App\Models\Dynamic::all()->each(function ($model) {
|
||||
$model->uuid = \Illuminate\Support\Str::uuid();
|
||||
$model->save();
|
||||
});
|
||||
|
||||
Schema::table('dynamics', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->unique()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('dynamics', function (Blueprint $table) {
|
||||
$table->dropColumn('uuid');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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('ledgers', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->after('id')->nullable();
|
||||
});
|
||||
|
||||
// Populate existing rows with UUIDs
|
||||
\App\Models\Ledger::all()->each(function ($model) {
|
||||
$model->uuid = \Illuminate\Support\Str::uuid();
|
||||
$model->save();
|
||||
});
|
||||
|
||||
Schema::table('ledgers', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->unique()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('ledgers', function (Blueprint $table) {
|
||||
$table->dropColumn('uuid');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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('mutations', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->after('id')->nullable();
|
||||
});
|
||||
|
||||
// Populate existing rows with UUIDs
|
||||
\App\Models\Mutation::all()->each(function ($model) {
|
||||
$model->uuid = \Illuminate\Support\Str::uuid();
|
||||
$model->save();
|
||||
});
|
||||
|
||||
Schema::table('mutations', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->unique()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mutations', function (Blueprint $table) {
|
||||
$table->dropColumn('uuid');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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('predefined_mutations', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->after('id')->nullable();
|
||||
});
|
||||
|
||||
// Populate existing rows with UUIDs
|
||||
\App\Models\PredefinedMutation::all()->each(function ($model) {
|
||||
$model->uuid = \Illuminate\Support\Str::uuid();
|
||||
$model->save();
|
||||
});
|
||||
|
||||
Schema::table('predefined_mutations', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->unique()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('predefined_mutations', function (Blueprint $table) {
|
||||
$table->dropColumn('uuid');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->after('id')->nullable();
|
||||
});
|
||||
|
||||
// Populate existing rows with UUIDs
|
||||
\App\Models\User::all()->each(function ($model) {
|
||||
$model->uuid = \Illuminate\Support\Str::uuid();
|
||||
$model->save();
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->unique()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('uuid');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user