Skip to content

Commit b15069e

Browse files
committed
Add update_wallets_logs_table migration
1 parent ab404be commit b15069e

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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('wallets_logs', function (Blueprint $table) {
15+
if (!Schema::hasColumn('wallets_logs', 'detail')) {
16+
$table->string('detail')->nullable()->after('status');
17+
}
18+
if (!Schema::hasColumn('wallets_logs', 'reference')) {
19+
$table->string('reference')->nullable()->after('ip');
20+
}
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
Schema::table('wallets_logs', function (Blueprint $table) {
30+
if (Schema::hasColumn('wallets_logs', 'detail')) {
31+
$table->dropColumn('detail');
32+
}
33+
if (Schema::hasColumn('wallets_logs', 'reference')) {
34+
$table->dropColumn('reference');
35+
}
36+
});
37+
}
38+
};

src/LaravelPayPocketServiceProvider.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ public function configurePackage(Package $package): void
1818
->name('laravel-pay-pocket')
1919
->hasConfigFile()
2020
->hasViews()
21-
->hasMigrations('create_wallets_logs_table', 'create_wallets_table');
21+
->hasMigrations(
22+
'create_wallets_logs_table',
23+
'create_wallets_table',
24+
'update_wallets_logs_table'
25+
);
2226
}
2327

2428
public function bootingPackage()
2529
{
2630
$this->publishes([
27-
__DIR__.'/../Enums/' => app_path('Enums'),
31+
__DIR__ . '/../Enums/' => app_path('Enums'),
2832
], 'pay-pocket-wallets');
2933
}
30-
}
34+
}

0 commit comments

Comments
 (0)