Skip to content

Commit 2b9a3c8

Browse files
XW-136 - Fix: Modify account and transaction table field type from float to decimal (#149)
1 parent e95ebf9 commit 2b9a3c8

2 files changed

+56
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('accounts', function (Blueprint $table) {
15+
$table->decimal('balance', 20, 2)->default(0.00)->change();
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('accounts', function (Blueprint $table) {
25+
$table->float('balance', 8, 2)->default(0.00)->change();
26+
});
27+
}
28+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('transactions', function (Blueprint $table) {
15+
$table->decimal('amount', 20, 2)->default(0.00)->change();
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('transactions', function (Blueprint $table) {
25+
$table->float('amount', 8, 2)->default(0.00)->change();
26+
});
27+
}
28+
};

0 commit comments

Comments
 (0)