Skip to content

Commit

Permalink
Fixed default value for json field in MySql in migration files
Browse files Browse the repository at this point in the history
  • Loading branch information
samuraee authored Dec 3, 2023
1 parent 12f7fd2 commit 34b952c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions database/migrations/create_larapay_transaction_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ class CreateLarapayTransactionTable extends Migration

$table->text('description')->nullable();
$table->bigInteger('amount')->default(0);
$table->jsonb('extra_params')->nullable()->default('{}');
$table->jsonb('additional_data')->nullable()->default('{}');
$table->jsonb('sharing')->nullable()->default('{}');

if (env('DB_CONNECTION') == 'pgsql') { // for POSTGRESQL
$table->jsonb('extra_params')->nullable()->default('{}');
$table->jsonb('additional_data')->nullable()->default('{}');
$table->jsonb('sharing')->nullable()->default('{}');
} else { // for MYSQL
$table->jsonb('extra_params')->nullable();
$table->jsonb('additional_data')->nullable();
$table->jsonb('sharing')->nullable();
}

$table->dateTime('paid_at')->nullable();
$table->timestamps();
Expand Down

0 comments on commit 34b952c

Please sign in to comment.